[PATCH] Fix for 64-bit arch errors in zend_operators.c

php.internals

Ard Biesheuvel

22 years ago
Hello group, Currently, the +, - en * operations in zend_operators in C do their calculcations on long arguments with doubles, and check if the result would fit in a long. This failed for me on FreeBSD/alpha (in some of the math tests), because doubles are not accurate enough to represent LONG_MIN or LONG_MAX. This causes the comparison '((double) LONG_MAX) + 1 > (double) LONG_MAX' to result in 'false' because they have the same double representation. Since a lot of tests use LONG_MAX in comparisons, this caused a lot of them to fail on this architecture. One solution could be to use long doubles, but in my opinion it is better to check the sign bit directly. A patch is attached.
-- Ard

Zeev Suraski

22 years ago
The patch looks good - I committed it. Thanks! Zeev At 18:01 13/09/2003, Ard Biesheuvel wrote: