* Re: DEC cc assembler bug
@ 1994-11-30 21:19 Jonathan Rozes
0 siblings, 0 replies; only message in thread
From: Jonathan Rozes @ 1994-11-30 21:19 UTC (permalink / raw)
I received this from a developer on a machine I run. Since
it has been reported to DEC in the past and still not been
fixed, I think I'll share it here as well.
--
Here is a test case for the alpha assembler bug in converting constants.
It was reported for OSF/1 1.x and is still present in OSF/1 3.0.
The C program below prints this:
1.0001550095108276e-04 3903a478 3f1a37ed
1.0820747754938310e-01 3941db71 3fbbb37c
1.1979850985234844e-04 ba4aa4f0 3f1f678a
-1.0817311005210172e-02 e7fbfba6 bf862762
-1.5304564931392372e+01 ef47ad6d c02e9bef
All the outputs are incorrect in the bottom bit, even though all five
decimal inputs are very close to exact double precision values. There
should be no difficulty about which way they should round. This large
an error in converting from decimal to binary representation violates
the IEEE 754 spec.
The program was compiled with standard cc, version 3.11 with no
optimizations or other switches to speak of. The bug does not appear when
the 'cc -migrate' compiler is used.
The right answers are:
1.0001550095108278e-04 3903a479 3f1a37ed
1.0820747754938312e-01 3941db72 3fbbb37c
1.1979850985234846e-04 ba4aa4f1 3f1f678a
-1.0817311005210174e-02 e7fbfba7 bf862762
-1.5304564931392374e+01 ef47ad6e c02e9bef
The decimal values produced by the DEC cc compiler are more or less correct:
.t_floating 1.000155009510827775e-4:1
.t_floating 1.082074775493831187e-1:1
.t_floating 1.197985098523484581e-4:1
.t_floating -1.0817311005210172e-02:1
.t_floating -1.5304564931392372e+01:1
--
/*
* Quickie C program to show DEC cc assembler bug
*
* Steve Moshier <smoshier@diamond.tufts.edu>
*
*/
double x[] = {
1.000155009510827775e-4,
1.082074775493831187e-1,
1.197985098523484581e-4,
-1.081731100521017390e-2,
-1.530456493139237395e1
};
main()
{
union
{
unsigned int l[2];
double d;
} u;
int i;
for (i=0; i<5; i++)
{
u.d = x[i];
printf ("%.16e %08x %08x\n", u.d, u.l[0], u.l[1]);
}
}
+++ Jonathan Rozes, jrozes@musketeers.tufts.edu, jrozes@cs.tufts.edu
+++ http://www.tufts.edu/~jrozes/
+++ Mind Over Liver: The liver probably contains 100 million cells, but
1,000 livers do not add up to a rich inner life. <GDF:SA 09/92>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1994-11-30 21:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-11-30 21:19 DEC cc assembler bug Jonathan Rozes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox