php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55388 type conversion problem
Submitted: 2011-08-09 21:55 UTC Modified: 2011-08-13 10:42 UTC
From: admin at micropro dot cz Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.6 OS: Windows 7, Debian Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: admin at micropro dot cz
New email:
PHP Version: OS:

 

 [2011-08-09 21:55 UTC] admin at micropro dot cz
Description:
------------
Problem with float whole numbers in type conversion.

Test script:
---------------
// This outputs: float(920)
var_dump('9.2' * 100);

// This outputs: int(919)
var_dump(intval('9.2' * 100));

// This outputs: int(920)
var_dump(intval(strval('9.2' * 100)));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-13 10:42 UTC] laruence@php.net
-Status: Open +Status: Bogus
 [2011-08-13 10:42 UTC] laruence@php.net
Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 18:01:32 2025 UTC