[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: math-emu on buildd machine?

So that might be a known errata?  The following program should yield
1.4013e-45 twice (the bug might show up only at -mieee -O0, I don't know).

float x = 1.0;
double y;

int g(float z)
  printf ("%g\n", z);

Well, AFAICS this is an error; %g refers to a double, and you're passing a
float, so that output would be undefined.

No, floats are always promoted to doubles in unprototyped function or as part of variadic parameters.

But regardless of whether I add a (double) cast here, and regardless of
whether I use -mieee (which should still be the default now on Debian's
gcc), if I build with -O2, I get 2.65249e-315 printed out twice.  If I build
with -O0 I instead get


This was what I expected. The right value is 2^-149, that is 1.4013e-45, but the alpha does not do it. The architecture handbook says "A trap handler can convert an S_ floating denormal value into the corresponding T_ floating finite value by adding 896 to the exponent and normalizing", but here 896 is not added and I get a denormal double, 2.65249e-315.

Actually both compiled programs are correct. You get a zero if the denormal is casted back to float (which makes a zero, because it is way off the range of a float); you get 2.65249e-315 if the compiler performs some copy propagation and sees through the conversion (because if it was not for the errata, the two values should indeed have been equal).

Beyond that, I haven't looked closely at the math you're doing to verify
that the alpha is getting it wrong, but I can confirm that this problem is
consistently reproducible and isn't tied to math-emu.

Thanks, I've XFAILed the test upstream and the maintainer of the Debian package will upload a new version in the next week.


Reply to: