php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14397 Wrong results when reading a float
Submitted: 2001-12-10 02:05 UTC Modified: 2002-01-28 10:41 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:3 (60.0%)
From: hofmann at isl dot org Assigned:
Status: No Feedback Package: Sybase (dblib) related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
21 + 46 = ?
Subscribe to this entry?

 
 [2001-12-10 02:05 UTC] hofmann at isl dot org
I have successfully written a float number into a sybase system - that I can display correctly with isql.
But when reading with php I got back 0 oder some strange numbers as 6.784567 instead of teh correct float number.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-10 02:36 UTC] hofmann at isl dot org
I found that the wrong float results happen with float(8) but NOT with float(16) !!!
 [2002-01-07 02:35 UTC] lobbin@php.net
Can you reproduce this error with PHP 4.1.1?
 [2002-01-28 10:41 UTC] sander@php.net
No feedback.
 [2002-03-18 05:20 UTC] tony at ec-server dot com
I have the same error with PHP4.1.1.
Even though I use float(16) instead of float(8),
or use decimal(15,5), I got the wrong display when fetch a float/decimal/double field.
 [2002-09-10 12:45 UTC] kinkie at tiscalinet dot it
I have verified the same problem.

In a table stored on a mssql 6.5 server, accessed via FreeTDS (both release 0.53 and 0.60.rc3) I have a column which is a float(24).

I can confirm that accessing that table works fine both from the tsql utility supplied with freetds and from sqsh.

That column's fields are however zeroed out when I access from inside PHP. This is both on 4.1.1 and 4.2.2.
The host operating system is Redhat 7.1.
 [2003-03-13 04:40 UTC] gwenzel at emb dot de
I Experienced the same problem, but found a workaround.
If I enclose the offending column by 

CAST(clumn AS DECIMAL) 

I get the correct result.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC