Re: double val to long val conversion issue

From: Date: Sun, 10 Feb 2013 08:35:41 +0000
Subject: Re: double val to long val conversion issue
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-65752@lists.php.net to get a copy of this message
Hi! > On x86_64 (so, with or without -O2) > > > $ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807 > double=9223372036854775808 > signed=8000000000000000 > unsigned=8000000000000000 > > > On ppc64 > > $ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807 > double=9223372036854775808 > signed=0x7fffffffffffff > unsigned=8000000000000000 So, looks like on ppc64 double->long conversion works differently than on x86_64. Maybe best solution would be to make the patch with ifdef for ppc64 so that it would do the same as Intel... Though I'm not sure if somebody on this platform would expect PHP behave as C does, or as Intel counterpart does. I'd say I personally probably would prefer Intel-compatible behavior since most software would be expected to be tested on Intel. But formally I'm not sure it's even wrong behavior... -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#65752) next »