php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20693 round() doesn't always work
Submitted: 2002-11-28 03:22 UTC Modified: 2005-09-22 21:42 UTC
From: bero at media dot net dot pl Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.2.3 OS: Debian GNU/Linux (pool)
Private report: No CVE-ID:
 [2002-11-28 03:22 UTC] bero at media dot net dot pl
In a simple script consisting a single line like 
<? round(195.583,2); ?>
round() produces a proper output. However in one of my scripts, where round() is used inside a method of a sophisticated object, it gives the folowig results:
echo round(195.583, 2); -> 195
echo round(195.583, 1); -> 195
echo round(195.583, 0); -> 195
echo round(195.583, -1); -> 200
echo round(195.583, -2); -> 200

I use PHP4.2.3 with Apache 1.3.26, both of them are original Debian's binaries. I have reproduced this behaviour on several machines.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-28 19:13 UTC] bero at media dot net dot pl
upps,the real problem was setlocale()....
 [2002-11-29 01:00 UTC] sniper@php.net
user error -> bogus.

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 04:02:11 2014 UTC