|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19417 Float Operation get rounded
Submitted: 2002-09-15 10:38 UTC Modified: 2002-10-08 21:48 UTC
From: admin at eurologon dot com Assigned:
Status: Closed Package: Math related
PHP Version: 4.2.1 OS: RH7.2
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 !
Your email address:
Solve the problem:
7 + 11 = ?
Subscribe to this entry?

 [2002-09-15 10:38 UTC] admin at eurologon dot com
All the following lines output an integer value (6) instead of a float one (6.9):

echo 5.2+1.7;   
echo (float)5.2+(float)1.7;
echo sprintf("%2.2f",(float)5.2+1.7);
same thing with "*" operator:
echo (float)60*0.7; 
returns 0

php 4.2.1 (ftp+gd+ctype+bcmath+zlib)
Apache 1.3.26


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-17 21:11 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

I don't have problem. Try CVS version and open again if problem exists.
 [2002-10-08 21:48 UTC]
Works fine here with latest CVS.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 16:01:33 2024 UTC