php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18978 mathematical bug
Submitted: 2002-08-20 02:08 UTC Modified: 2002-08-20 02:21 UTC
From: leocui at msn dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.2.1 OS: Mandrake 8.1
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: leocui at msn dot com
New email:
PHP Version: OS:

 

 [2002-08-20 02:08 UTC] leocui at msn dot com
There is a mathematical bug in PHP 4.0.6, 4.1.2 and 4.2.1.
When I try to run the following script:
<?php
echo "20.91-20.85=";
eCho 20.91-20.85;
echo "<br>";
echo "10.33-10.23=";
echo 10.33-10.23;
echo "<br>";
echo "20.33-20.23=";
echo 20.33-20.23;
echo "<br>";
echo "21.33-21.23=";
echo 21.33-21.23;
echo "<br>";
echo "30.33-30.23=";
echo 30.33-30.23;
echo "<br>";

I got the following result,

20.91-20.85=0.059999999999999		(Wrong)
10.33-10.23=0.1  					(Right)
20.33-20.23=0.099999999999998		(Wrong)
21.33-21.23=0.099999999999998		(Wrong)
30.33-30.23=0.099999999999998		(Wrong)

Obviously it??s wrong. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-20 02:21 UTC] alan_k@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://www.php.net/manual/en/language.types.float.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC