www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/11/07:31:16

Date: Sun, 11 Feb 1996 14:16:47 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Weiqi Gao <weiqigao AT crl DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: acos(2.0) problem?

On Wed, 7 Feb 1996, Weiqi Gao wrote:

> main()
> {
>   acos(2.0);
>   perror("Auch");
> }
> ==================
> 
> which I compiled with
> 
> =====================
> gcc -g test.c -o test
> =====================
> 
> I was expecting a output of "Auch: ERANGE Error", but instead I got
> the following
> 
> =================================================================
> Exiting due to signal SIGFPE 
> Floating Point exception at eip=00001e72

The default `acos' in libc.a doesn't check for numeric errors, but instead
boldly goes where no arc-cosine has gone before (look at its source in
djlsr200.zip).  I think it's against ANSI/ISO standard, but that's how the
things are right now.  If you link your program with -lm, you will get
better version of `acos' from libm.a, which I think *will* detect the
error (but I didn't try this). 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019