delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/19/02:41:31

Date: Mon, 19 Mar 2001 09:37:48 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Whats up with sqrt?
In-Reply-To: <k90abt0dbe655htsov7mleapeos0702qu8@4ax.com>
Message-ID: <Pine.SUN.3.91.1010319093723.21558I@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 18 Mar 2001, Jason Green wrote:

> "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote:
> 
> > In fact, for most arguments, code produced by latest versions of GCC
> > doesn't even call the library function, it emits an FP instruction
> > that computes the square root directly.
> 
> What arguments would cause the library function to be called?

Only those which cause the FSQRT instruction to produce Inf or NaN.

You can clearly see this in the code produced by GCC, if you compile a
simple C source with "gcc -S" and examine the assembly: it issues
FSQRT, and then examines the C0..C3 condition code bits in the x87
status word.  If these bits say that the result is abnormal, the
library function is called to cope with the problem.

(This is one more reason why it is a good idea to mask numeric
exception in the startup code, as latest versions of DJGPP do: if you
don't do that, you will have SIGFPEs even if the library is written to
carefully avoid them.)

- Raw text -


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