|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-02-04 14:15 UTC] remi@php.net
Description:
------------
zend_dval_to_lval have different result on x86_64 and ppc64 (and probably other arch)
This cause some test failure:
Test & operator : 64bit long tests [tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt]
Test ~N operator : 64bit long tests [tests/lang/operators/bitwiseNot_basiclong_64bit.phpt]
Test | operator : 64bit long tests [tests/lang/operators/bitwiseOr_basiclong_64bit.phpt]
Test ^ operator : 64bit long tests [tests/lang/operators/bitwiseXor_basiclong_64bit.phpt]
Test % operator : 64bit long tests [tests/lang/operators/modulus_basiclong_64bit.phpt]
Test decbin function : 64bit long tests [ext/standard/tests/math/decbin_basiclong_64bit.phpt]
Test dechex function : 64bit long tests [ext/standard/tests/math/dechex_basiclong_64bit.phpt]
Test decoct function : 64bit long tests [ext/standard/tests/math/decoct_basiclong_64bit.phpt]
Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) [ext/standard/tests/strings/chunk_split_variation2.phpt]
Test script:
---------------
php -r 'printf("%ld\n", 0x7fffffffffffffff);'
php -r 'printf("%ld\n", 0x7fffffffffffffff+1);'
Expected result:
----------------
9223372036854775807
-9223372036854775808
Actual result:
--------------
9223372036854775807
9223372036854775807
Patches0001-Fixed-bug-64142-dval-to-lval-different-behavior-on-p.patch (last revision 2013-02-04 14:30 UTC by remi@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
> (long)(double)9223372036854775807-1 = 9223372036854775807 Ah sorry, I read that wrong. It can't obviously be rounding down, because the result seems larger; you're subtracting one here when you're adding 1 on top... The part about the closes doubles is wrong too, they're already spaced by 1024 by then. In any case, your explanation in the commit seems both irrelevant and wrong. AS to the wrong part, in x86_64: printf("%ld\n",((long)(double)9223372036854775807)+1); double dd = 9223372036854775807; printf("%ld\n", ((long)dd) + 1); gives -9223372036854775808 -9223372036854775807 So the -9223372036854775808 result is just an artifact of the compiler doing away with the casts completely.