[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (elisp)Numbers

From: Eli Zaretskii
Subject: Re: (elisp)Numbers
Date: Wed, 22 Oct 2003 17:42:39 +0200

> From: Richard Stallman <address@hidden>
> Date: Wed, 22 Oct 2003 05:25:37 -0400
> I get the same results.  I figured out why.  I'm using an x86.  Facos
> calls acos, but in Fsqrt the call to sqrt gets open-coded using the
> fsqrt instruction.  fsqrt doesn't set errno as it is expected to.
> Perhaps that is a GCC bug.

I don't think it's a bug at all.  Last time I looked closely at the
code emitted by GCC in such situations, it indeed issues the FSQRT
instruction, but after that carefully examines the appropriate bits in
the x87 status register, and if any of the bits are set that indicate
that a numeric exception has happened, it calls the `sqrt' function
from the library, assuming (quite correctly, IMHO) that the library
code will deal with abnormal results according to whatever ANSI/Posix
requires in the particular environment and platform where you run the

If you say "gcc -S" and look at the code, don't you see the FSQRT
instruction being followed by tests on bits in the FPU status word,
followed by the call to `sqrt' from the library?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]