From: Kbwms AT aol DOT com Message-ID: <7ea92299.36167b51@aol.com> Date: Sat, 3 Oct 1998 15:30:25 EDT To: Eli Zaretskii Cc: djgpp-workers AT delorie DOT com Mime-Version: 1.0 Subject: Re: Troubles Compiling the Test Programs Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Mailer: AOL 3.0 16-bit for Windows sub 38 Dear Eli Zaretskii, On 09-28-98 at 05:42:15 EST you wrote: > > > Sure. How many other functions do we have to change? > > Seems like e_fmod.c, e_remainder.c (and their float brethren), and > k_standard.c are the only ones that are the candidates. Can you > devise test cases that will see if the problems with -0 happen there > as well? Here is a demo of remainder()/fmod() "(and their float brethren)": Testing remainder() vs. fmod(): X Y remainder(X,Y) fmod(X,Y) -0.25 1.75 -2.500000e-01 -2.500000e-01 -1.25 1.75 5.000000e-01 -1.250000e+00 -2.25 1.75 -5.000000e-01 -5.000000e-01 -3.25 1.75 2.500000e-01 -1.500000e+00 -4.25 1.75 -7.500000e-01 -7.500000e-01 -5.25 1.75 0.000000e+00 0.000000e+00 (8000000000000000) (8000000000000000) -6.25 1.75 7.500000e-01 -1.000000e+00 -7.25 1.75 -2.500000e-01 -2.500000e-01 -8.25 1.75 5.000000e-01 -1.250000e+00 -9.25 1.75 -5.000000e-01 -5.000000e-01 -10.25 1.75 2.500000e-01 -1.500000e+00 -11.25 1.75 -7.500000e-01 -7.500000e-01 -12.25 1.75 0.000000e+00 0.000000e+00 (8000000000000000) (8000000000000000) Testing remainderf() vs. fmodf(): X Y remainderf(X,Y) fmodf(X,Y) -0.25 1.75 -2.500000e-01 -2.500000e-01 -1.25 1.75 5.000000e-01 -1.250000e+00 -2.25 1.75 -5.000000e-01 -5.000000e-01 -3.25 1.75 2.500000e-01 -1.500000e+00 -4.25 1.75 -7.500000e-01 -7.500000e-01 -5.25 1.75 0.000000e+00 0.000000e+00 (80000000) (80000000) -6.25 1.75 7.500000e-01 -1.000000e+00 -7.25 1.75 -2.500000e-01 -2.500000e-01 -8.25 1.75 5.000000e-01 -1.250000e+00 -9.25 1.75 -5.000000e-01 -5.000000e-01 -10.25 1.75 2.500000e-01 -1.500000e+00 -11.25 1.75 -7.500000e-01 -7.500000e-01 -12.25 1.75 0.000000e+00 0.000000e+00 (80000000) (80000000) The remainder function seems to be working. A demo program is appended. K.B. Williams ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #include #include #include int main() { double X, Y; Y = 1.75; printf("Testing remainder() vs. fmod():\n"); printf(" X Y remainder(X,Y) fmod(X,Y)\n"); for (X = 0.25; X <= 12.25; ++X) { double Modulo, Remndr; ieee_double_shape_type AnyDbl; Remndr = remainder(-X, Y); Modulo = fmod(-X, Y); printf("%6.2f%6.2f%15e%15e", -X, Y, Remndr, Modulo); if (Remndr == 0) { AnyDbl.value = Remndr; printf(" (%08x%08x)", AnyDbl.parts.msw, AnyDbl.parts.lsw); AnyDbl.value = Modulo; printf(" (%08x%08x)", AnyDbl.parts.msw, AnyDbl.parts.lsw); } printf("\n"); } printf("\nTesting remainderf() vs. fmodf():\n"); printf(" X Y remainderf(X,Y) fmodf(X,Y)\n"); for (X = 0.25; X <= 12.25; ++X) { float Modulo, Remndr; ieee_float_shape_type AnyFlt; Remndr = remainderf(-X, Y); Modulo = fmodf(-X, Y); printf("%6.2f%6.2f%15e%15e", -X, Y, Remndr, Modulo); if (Remndr == 0) { AnyFlt.value = Remndr; printf(" (%08x)", AnyFlt.word); AnyFlt.value = Modulo; printf(" (%08x)", AnyFlt.word); } printf("\n"); } return 0; }