php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27332 wrong result
Submitted: 2004-02-20 10:43 UTC Modified: 2004-02-20 10:45 UTC
From: valeriy-v at yandex dot ru Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.3.4 OS: windows xp
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: valeriy-v at yandex dot ru
New email:
PHP Version: OS:

 

 [2004-02-20 10:43 UTC] valeriy-v at yandex dot ru
Description:
------------
<?php
echo 22512.65+0-22511.03,'<br>';
?>

will print 1.6200000000026

Reproduce code:
---------------
<?php
echo 22512.65+0-22511.03,'<br>';
?>

Expected result:
----------------
wrong result 1.6200000000026

Actual result:
--------------
1.68

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-20 10:45 UTC] derick@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.
 
Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC