#32180 [Com]: Operations with floating points bug

From: Date: Fri, 04 Mar 2005 07:25:46 +0000
Subject: #32180 [Com]: Operations with floating points bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74812@lists.php.net to get a copy of this message
ID: 32180 Comment by: KRomas at goldentele dot com Reported By: snirh at inag dot pt Status: Feedback Bug Type: *Database Functions Operating System: WINDOWS SERVER 2003 PHP Version: 4.3.10 New Comment: echo '<PRE>'; $res = $obj_oracle->Get_rows('SELECT (-3/5) AS floatp FROM dual'); $res2 = $obj_oracle->Get_rows('SELECT to_char(-3/5, \'09999.9999\') AS floatp FROM dual'); var_dump($res); echo $res[0]['FLOATP'] + 2; echo '<BR>'; echo $res2[0]['FLOATP'] + 2; ------------------- array(1) { [0]=> array(1) { ["FLOATP"]=> string(3) "-,6" } } 2 1.4 Previous Comments: ------------------------------------------------------------------------ [2005-03-03 22:28:04] sniper@php.net What does 'var_dump($result);' output? ------------------------------------------------------------------------ [2005-03-03 19:59:33] snirh at inag dot pt Description: ------------ Using OCI libs to return values from a database, if this values is negative floating point the result cannot be used as number! Reproduce code: --------------- $sql = "SELECT (-3/5) AS floatp FROM dual"; $conn2 = ocilogon("login", "pass", $srvc); $stmt = ociparse($conn2, $sql); ociexecute($stmt, OCI_DEFAULT); while (ocifetch($stmt)) { echo $result = ociresult($stmt, "FLOATP")."\n\n"; } echo $result + 2; // This code return 2!! Expected result: ---------------- 1.4 Actual result: -------------- 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32180&edit=1

« previous php.bugs (#74812) next »