Le 10/02/2013 15:58, Gustavo Lopes a écrit : > If we want to eliminate the undefined behavior, we should do (on archs > with 64-bit longs): > > (long)(unsigned long)(fmod(d, pow(2., 64.))) > > Can you test this program on ppc64:
$ gcc -O3 -lm conv.c && ./a.out 9223372036854775808 -9223372036854775808 -9223372036854775808 $ gcc -O3 -lm conv.c && ./a.out 4e21 -2943463994972700672 -1 $ gcc -O3 -lm conv.c && ./a.out 4e19 3106511852580896768 -1 > I get this: > $ gcc -O3 -lm conv.c && ./a.out 9223372036854775808 > -9223372036854775808 -9223372036854775808 > $ gcc -O3 -lm conv.c && ./a.out 4e21 > -2943463994972700672 0 > $ gcc -O3 -lm conv.c && ./a.out 4e19 > 3106511852580896768 0 Remi. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php