pow() showing odd long/float boundary case characteristics

From: Date: Tue, 13 Nov 2001 13:13:57 +0000
Subject: pow() showing odd long/float boundary case characteristics
Groups: php.dev 
Request: Send a blank email to php-dev+get-70344@lists.php.net to get a copy of this message
The pow() regression test is failing due to this strange characteristic: <? $a[] = 2147483646; $a[] = pow(2147483646,1); $a[] = 2147483647; $a[] = pow(2147483647,1); $a[] = 2147483648; $a[] = pow(2147483648,1); var_dump($a); ?> Produces: array(6) { [0]=> int(2147483646) [1]=> int(2147483646) [2]=> int(2147483647) [3]=> float(2147483647) [4]=> float(2147483648) [5]=> float(2147483648) } ie. pow(2147483647,1) returns a float where one would expect it to return an int. Off by one error somewhere? Same thing happens on the negative boundary. -Rasmus

« previous php.dev (#70344) next »