Mail Archives: djgpp/1996/02/11/07:31:16
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 -