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 this is not your bug, you can add a comment by following this link.
If this is your bug, but 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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 18:01:28 2024 UTC