Mail Archives: djgpp-workers/2003/09/09/14:33:09
--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. Results=
from libc and our new long double math library are displayed.<BR>
<BR>
<BR>
#include <stdio.h><BR>
long double modfl(long double, long double *);<BR>
int<BR>
main(void)<BR>
{<BR>
const long double Infinity =3D (1.0L/0.0L);<BR>
long double Argument, FracPart, IntPart;<BR>
<BR>
FracPart =3D modfl(+Infinity, &IntPart);<BR>
printf("modfl(%+Lg, &IntPart): FracPart =3D %+Lg, Int=
Part =3D %+Lg\n",<BR>
+Infinity, FracPart, IntPart); <BR>
<BR>
FracPart =3D modfl(-Infinity, &IntPart);<BR>
printf("modfl(%+Lg, &IntPart): FracPart =3D %+Lg, Int=
Part =3D %+Lg\n",<BR>
-Infinity, FracPart, IntPart); <BR>
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>
in the object pointed to by iptr<BR>
<BR>
modfl in libc.a:<BR>
---------------<BR>
modfl(+Inf, &IntPart): FracPart =3D -NaN, IntPart =3D +Inf<BR>
modfl(-Inf, &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, &IntPart): FracPart =3D +0, IntPart =3D +Inf<BR>
modfl(-Inf, &IntPart): FracPart =3D -0, IntPart =3D -Inf<BR>
<BR>
<BR>
KB Williams<BR>
</FONT></HTML>
--part1_163.2566e055.2c8f7691_boundary--
- Raw text -