php.net |  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
 [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;
printf("%2.2f",(float)5.2+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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-17 21:11 UTC] yohgaki@php.net
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 http://www.php.net/downloads.php

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] sniper@php.net
Works fine here with latest CVS.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 14:01:30 2024 UTC