php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32180 Operations with floating points bug
Submitted: 2005-03-03 19:59 UTC Modified: 2005-03-16 01:05 UTC
From: snirh at inag dot pt Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.10 OS: WINDOWS SERVER 2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: snirh at inag dot pt
New email:
PHP Version: OS:

 

 [2005-03-03 19:59 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-09 12:57 UTC] tony2001@php.net
It has nothing to do with OCI8.
<?php
$a = "-,6";
var_dump((float)$a);
var_dump($a+2);
?>
Personally I think we should not support floats written in such a braindead style. 
 [2005-03-16 01:05 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 07:01:31 2025 UTC