#44092 [Opn]: exp() function returns incorrect result if passed hex

From: Date: Sun, 10 Feb 2008 17:27:41 +0000
Subject: #44092 [Opn]: exp() function returns incorrect result if passed hex
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122154@lists.php.net to get a copy of this message
ID: 44092 Updated by: zoe@php.net Reported By: zoe@php.net Status: Open Bug Type: *Math Functions Operating System: Linux 32 PHP Version: 5.3CVS-2008-02-10 (CVS) New Comment: If this patch goes in, the test exp_error.phpt will need a small change too. I'm happy to do that. Previous Comments: ------------------------------------------------------------------------ [2008-02-10 17:20:21] zoe@php.net Description: ------------ In PHP5.3 is a hex string is passed to exp() it is interpreted as 0 and the result of exp(0) = 1 is returned. In PHP6 the hex string is correctly interpreted and the corrcet value is returned by exp(). I believe the PHP6 behaviour is preferred. This patch http://www.pastebin.ca/898812 corrects the PHP5.3 behaviour. Reproduce code: --------------- --TEST-- Test exp() - pass exp hex string --INI-- precision=14 --FILE-- <?php $value= "0x5F"; $res = exp($value); var_dump($res); ?> --EXPECTF-- float(1.811239082889E+41) Expected result: ---------------- See above Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44092&edit=1

« previous php.bugs (#122154) next »