delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/10/03/11:52:03

From: Kbwms AT aol DOT com
Message-ID: <91bf22d6.361647c2@aol.com>
Date: Sat, 3 Oct 1998 11:50:26 EDT
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp-workers AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Troubles Compiling the Test Programs
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?

The fmod functions are adequately tested via the new test vectors.

There is a bug in rint()/rintf() in the alphas.  The version in the
previous libm.a is okay.  Here is a demo on both libraries:

		Old libm.a
		----------
Testing rint():
Unrounded Number = +0.500000, Rounded Int = +0
Unrounded Number = -0.500000, Rounded Int = +0
rint returns = (80000000 00000000)
Unrounded Number = +1.500000, Rounded Int = +2
Unrounded Number = -1.500000, Rounded Int = -2
Unrounded Number = +2.500000, Rounded Int = +2
Unrounded Number = -2.500000, Rounded Int = -2
Unrounded Number = +3.500000, Rounded Int = +4
Unrounded Number = -3.500000, Rounded Int = -4
Unrounded Number = +4.500000, Rounded Int = +4
Unrounded Number = -4.500000, Rounded Int = -4
Testing rintf():
Unrounded Number = +0.500000, Rounded Int = +0
Unrounded Number = -0.500000, Rounded Int = +0
rintf returns = (80000000)
Unrounded Number = +1.500000, Rounded Int = +2
Unrounded Number = -1.500000, Rounded Int = -2
Unrounded Number = +2.500000, Rounded Int = +2
Unrounded Number = -2.500000, Rounded Int = -2
Unrounded Number = +3.500000, Rounded Int = +4
Unrounded Number = -3.500000, Rounded Int = -4
Unrounded Number = +4.500000, Rounded Int = +4
Unrounded Number = -4.500000, Rounded Int = -4

		New libm.a
		----------
Testing rint():
Unrounded Number = +0.500000, Rounded Int = +0.5
Unrounded Number = -0.500000, Rounded Int = -0.5
rint returns = (bfe00000 00000000)
Unrounded Number = +1.500000, Rounded Int = +1.5
Unrounded Number = -1.500000, Rounded Int = -1.5
Unrounded Number = +2.500000, Rounded Int = +2.5
Unrounded Number = -2.500000, Rounded Int = -2.5
Unrounded Number = +3.500000, Rounded Int = +3.5
Unrounded Number = -3.500000, Rounded Int = -3.5
Unrounded Number = +4.500000, Rounded Int = +4.5
Unrounded Number = -4.500000, Rounded Int = -4.5
Testing rintf():
Unrounded Number = +0.500000, Rounded Int = +0.5
Unrounded Number = -0.500000, Rounded Int = -0.5
rintf returns = (bf000000)
Unrounded Number = +1.500000, Rounded Int = +1.5
Unrounded Number = -1.500000, Rounded Int = -1.5
Unrounded Number = +2.500000, Rounded Int = +2.5
Unrounded Number = -2.500000, Rounded Int = -2.5
Unrounded Number = +3.500000, Rounded Int = +3.5
Unrounded Number = -3.500000, Rounded Int = -3.5
Unrounded Number = +4.500000, Rounded Int = +4.5
Unrounded Number = -4.500000, Rounded Int = -4.5

A demo program is appended.

I'll get to the remainder functions next.


K.B. Williams
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* ---------- */
/* rintdemo.c */
/* ---------- */
#include <fdlibm.h>
#include <stdio.h>
#include <math.h>

int
main()
{
	ieee_double_shape_type  AnyDbl;
	ieee_float_shape_type   AnyFlt;

	int	k;

	printf("Testing rint():\n");

	for (k = 0; k < 5; ++k)
	{
		double	RoundedInt, Unrounded;
		Unrounded  = k + .5;
		RoundedInt = rint(Unrounded);
		printf("Unrounded Number = %+f, Rounded Int = %+g\n",
			Unrounded, RoundedInt);
		Unrounded  = -Unrounded;
		RoundedInt = rint(Unrounded);
		printf("Unrounded Number = %+f, Rounded Int = %+g\n",
			Unrounded, RoundedInt);
		if (k == 0)
		{
			AnyDbl.value = RoundedInt;
			printf("rint returns = (%08x %08x)\n",
				AnyDbl.parts.msw, AnyDbl.parts.lsw);
		}
	}

	printf("Testing rintf():\n");

	for (k = 0; k < 5; ++k)
	{
		float	RoundedInt, Unrounded;
		Unrounded  = k + .5;
		RoundedInt = rintf(Unrounded);
		printf("Unrounded Number = %+f, Rounded Int = %+g\n",
			Unrounded, RoundedInt);
		Unrounded  = -Unrounded;
		RoundedInt = rintf(Unrounded);
		printf("Unrounded Number = %+f, Rounded Int = %+g\n",
			Unrounded, RoundedInt);
		if (k == 0)
		{
			AnyFlt.value = RoundedInt;
			printf("rintf returns = (%08x)\n", AnyFlt.word);
		}
	}
	return 0;
}

- Raw text -


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