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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bero at media dot net dot pl
New email:
PHP Version: OS:

 

 [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: Thu Apr 25 15:01:30 2024 UTC