php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70954 Wrong Calculation
Submitted: 2015-11-22 15:08 UTC Modified: 2015-11-22 20:43 UTC
From: sukram230799 at outlook dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.6.15 OS: Window 10
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: sukram230799 at outlook dot com
New email:
PHP Version: OS:

 

 [2015-11-22 15:08 UTC] sukram230799 at outlook dot com
Description:
------------
---
From manual page: http://www.php.net/index
---

PHP is calculating wrong or inacurate.

Test script:
---------------
echo(272.19-273.15);

Expected result:
----------------
-0.96

Actual result:
--------------
-0.95999999999998

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-22 20:43 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Type: Documentation Problem +Type: Bug
 [2015-11-22 20:43 UTC] requinix@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-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 07:00:02 2026 UTC