php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4449 Mod computation error!
Submitted: 2000-05-15 04:48 UTC Modified: 2001-02-10 16:03 UTC
From: ukustar at kimo dot com dot tw Assigned:
Status: Closed Package: Other
PHP Version: 3.0.16 OS: FreeBSD
Private report: No CVE-ID: None
 [2000-05-15 04:48 UTC] ukustar at kimo dot com dot tw
$a=2.01;
echo ($a*100)%10;
//output is "0", but it should be "1"
$a=2.02;
echo ($a*100)%10;
//output is "2", this is correct!
//I found most float variable are correct, 
//but few are incorrect.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 16:03 UTC] jimw@php.net
rounding errors happen when doing floating point math, depending on your system.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC