[As I write, this bug report has yet to hit p5p. I hope this follow- up follows it to the list. Anyway ...]

I wrote:
Bleadperl gets abs() wrong for all numbers larger than the narrower of INT_MAX
or the mantissa of a double.

This is not a compiler issue: I've tried both gcc-3.3 and 4.0.

For (32-bit) [EMAIL PROTECTED]:
$ ./miniperl -lwe 'print(abs) for (0, -1e-200 * 1e-200, 1, -1,
2**31, -2**31, 2**32, -2**32, 2**52, -2**52, 2**63, -2**63,
2**64, -2**64, 1e50, -1e50, 1e200*1e200, 1e200*-1e200);'
0
0
1
1
2147483648
2147483648
-4294967296
-4294967296
-4.5035996273705e+15
-4.5035996273705e+15
-9.22337203685478e+18
-9.22337203685478e+18
-1.84467440737096e+19
-1.84467440737096e+19
-1e+50
-1e+50
-inf
-inf

The problem is a slip-up in the constification of pp.c. I attach a patch to fix it, and to add tests for abs() to op/arith.t. I also took the opportunity to soften the test script's hard dependency on Config.pm. (The patch is larger than it deserves to be because abs() needs testing early, and all the hardwired test numbers thereafter needed to change.)
--
Dominic Dunlop

Attachment: abs_patch
Description: Binary data

Reply via email to