delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/09/09/14:33:09

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Kbwms AT aol DOT com
Message-ID: <163.2566e055.2c8f7691@aol.com>
Date: Tue, 9 Sep 2003 14:31:45 EDT
Subject: Bug in modfl() in libc.a
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_163.2566e055.2c8f7691_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

As results from the demo program below show, there is a bug in the version of 
function modfl() that resides in libc.a.  Results from libc and our new long 
double math library are displayed.


#include <stdio.h>
long double modfl(long double, long double *);
int
main(void)
{
    const long double Infinity = (1.0L/0.0L);
    long double Argument, FracPart, IntPart;

    FracPart = modfl(+Infinity, &IntPart);
    printf("modfl(%+Lg, &IntPart): FracPart = %+Lg, IntPart = %+Lg\n",
            +Infinity, FracPart, IntPart); 

    FracPart = modfl(-Infinity, &IntPart);
    printf("modfl(%+Lg, &IntPart): FracPart = %+Lg, IntPart = %+Lg\n",
            -Infinity, FracPart, IntPart); 
    exit(0);
}

According to paragraph F.9.3.12 of ISO/IEC 9899:1999 (E),

-- modfl(+-Infinity, iptr) returns +-0 and stores +-Infinity in the
               in the object pointed to by iptr

modfl in libc.a:
---------------
modfl(+Inf, &IntPart): FracPart = -NaN, IntPart = +Inf
modfl(-Inf, &IntPart): FracPart = -NaN, IntPart = -Inf

========================================

modfl in new long double math library:
---------------------------------------
modfl(+Inf, &IntPart): FracPart = +0, IntPart = +Inf
modfl(-Inf, &IntPart): FracPart = -0, IntPart = -Inf


KB Williams

--part1_163.2566e055.2c8f7691_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">As results from the demo program below show, there is a=20=
bug in the version of function modfl() that resides in libc.a.&nbsp; Results=
 from libc and our new long double math library are displayed.<BR>
<BR>
<BR>
#include &lt;stdio.h&gt;<BR>
long double modfl(long double, long double *);<BR>
int<BR>
main(void)<BR>
{<BR>
&nbsp;&nbsp;&nbsp; const long double Infinity =3D (1.0L/0.0L);<BR>
&nbsp;&nbsp;&nbsp; long double Argument, FracPart, IntPart;<BR>
<BR>
&nbsp;&nbsp;&nbsp; FracPart =3D modfl(+Infinity, &amp;IntPart);<BR>
&nbsp;&nbsp;&nbsp; printf("modfl(%+Lg, &amp;IntPart): FracPart =3D %+Lg, Int=
Part =3D %+Lg\n",<BR>
&nbsp;&nbsp;&nbsp;         +Infinity, FracPart, IntPart); <BR>
<BR>
&nbsp;&nbsp;&nbsp; FracPart =3D modfl(-Infinity, &amp;IntPart);<BR>
&nbsp;&nbsp;&nbsp; printf("modfl(%+Lg, &amp;IntPart): FracPart =3D %+Lg, Int=
Part =3D %+Lg\n",<BR>
&nbsp;&nbsp;&nbsp;         -Infinity, FracPart, IntPart); <BR>
&nbsp;&nbsp;&nbsp; exit(0);<BR>
}<BR>
<BR>
According to paragraph F.9.3.12 of ISO/IEC 9899:1999 (E),<BR>
<BR>
-- modfl(+-Infinity, iptr) returns +-0 and stores +-Infinity in the<BR>
&nbsp;&nbsp;          &nbsp;&nbsp; in the object pointed to by iptr<BR>
<BR>
modfl in libc.a:<BR>
---------------<BR>
modfl(+Inf, &amp;IntPart): FracPart =3D -NaN, IntPart =3D +Inf<BR>
modfl(-Inf, &amp;IntPart): FracPart =3D -NaN, IntPart =3D -Inf<BR>
<BR>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>
<BR>
modfl in new long double math library:<BR>
---------------------------------------<BR>
modfl(+Inf, &amp;IntPart): FracPart =3D +0, IntPart =3D +Inf<BR>
modfl(-Inf, &amp;IntPart): FracPart =3D -0, IntPart =3D -Inf<BR>
<BR>
<BR>
KB Williams<BR>
</FONT></HTML>
--part1_163.2566e055.2c8f7691_boundary--

- Raw text -


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