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
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: hsunke at muenster dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC