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: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 + 19 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC