delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/09/11/19:19:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Kbwms AT aol DOT com
Message-ID: <176.1f7b2c00.2c925cd7@aol.com>
Date: Thu, 11 Sep 2003 19:18:47 EDT
Subject: Re: Arithmetic Exceptions in C99
To: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
X-Mailer: 8.0 for Windows sub 6015
Reply-To: djgpp-workers AT delorie DOT com

--part1_176.1f7b2c00.2c925cd7_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

In a message dated 9/3/2003 10:38:04 AM Eastern Standard Time, 
rudd AT cyberoptics DOT com writes:

> If we are thinking about using the exception mechanism, we should 
> consider how it will affect the "builtin" math functions.  For instance, 
> if you invoke sqrt() in a C program, and don't compile with 
> -fno-builtin, the compiler will first try to compute the square root by 
> simply using the fsqrt instruction.  If something goes wrong (for 
> instance, for a negative argument), the library routine is called, 
> because it presumably has the particular error handling that is 
> appropriate.  We need to make sure that this mechanism still works.
> 

I have not been able to confirm this because my test driver is able to call 
sqrtl() every time regardless of whether -fno-builtin is used.  On the other 
hand, if I write at the top of my program

#define sqrtl(x)   __builtin_sqrtl(x)

then the builtin gets called except when "something goes wrong" as Eric puts 
it.

Thank you, Eric Rudd, for bringing up the topic of builtins.  After reviewing 
my code in sqrtl(), it was clear that some rearrangement of the code is in 
order.


KB Williams

--part1_176.1f7b2c00.2c925cd7_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<HTML><FONT FACE=3Darial,helvetica><FONT  SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"=
Georgia" LANG=3D"0">In a message dated 9/3/2003 10:38:04 AM Eastern Standard=
 Time, rudd AT cyberoptics DOT com writes:<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT  COLOR=3D"#000000"=
 style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"A=
rial" LANG=3D"0">If we are thinking about using the exception mechanism, we=20=
should <BR>
consider how it will affect the "builtin" math functions.&nbsp; For instance=
, <BR>
if you invoke sqrt() in a C program, and don't compile with <BR>
-fno-builtin, the compiler will first try to compute the square root by <BR>
simply using the fsqrt instruction.&nbsp; If something goes wrong (for <BR>
instance, for a negative argument), the library routine is called, <BR>
because it presumably has the particular error handling that is <BR>
appropriate.&nbsp; We need to make sure that this mechanism still works.<BR>
</BLOCKQUOTE><BR>
</FONT><FONT  COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><BR>
I have not been able to confirm this because my test driver is able to call=20=
sqrtl() every time regardless of whether </FONT><FONT  COLOR=3D"#000000" sty=
le=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"Arial=
" LANG=3D"0">-fno-builtin </FONT><FONT  COLOR=3D"#000000" style=3D"BACKGROUN=
D-COLOR: #ffffff" SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">is u=
sed.&nbsp; On the other hand, if I write at the top of my program<BR>
<BR>
#define sqrtl(x)&nbsp;&nbsp; __builtin_sqrtl(x)<BR>
<BR>
then the builtin gets called except when "</FONT><FONT  COLOR=3D"#000000" st=
yle=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"Aria=
l" LANG=3D"0">something goes wrong" </FONT><FONT  COLOR=3D"#000000" style=
=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"Georgia" LA=
NG=3D"0">as Eric puts it.<BR>
<BR>
Thank you, Eric Rudd, for bringing up the topic of builtins.&nbsp; After rev=
iewing my code in sqrtl(), it was clear that some rearrangement of the code=20=
is in order.<BR>
<BR>
<BR>
KB Williams</FONT></HTML>

--part1_176.1f7b2c00.2c925cd7_boundary--

- Raw text -


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