php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37554 strange behavior of intval()
Submitted: 2006-05-22 22:29 UTC Modified: 2006-05-23 06:28 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hsunke at muenster dot de Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.1.4 OS: Debian Linux
Private report: No CVE-ID: None
 [2006-05-22 22:29 UTC] hsunke at muenster dot de
Description:
------------
I know about "unpredictable" issues with floatingpoint calculations, but this one is quite funny:

...
echo intval(100*(27/100));
//output: 27
echo intval(100*(28/100));
//output: 28
echo intval(100*(29/100));
//output: 28
echo intval(100*(30/100));
//output: 30
echo intval(100*(31/100));
//output: 31
...


Reproduce code:
---------------
echo intval(100*(29/100));


Expected result:
----------------
29

Actual result:
--------------
28

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-23 06:28 UTC] derick@php.net
Might be funny... but it's still the same problem.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 22 13:01:24 2020 UTC