|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41152 round()ing HUGE numbers
Submitted: 2007-04-20 17:09 UTC Modified: 2007-04-20 17:46 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mark at divindedesigns dot ca Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 5.2.1 OS: linux/windows
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.
Block user comment
Status: Assign to:
Bug Type:
From: mark at divindedesigns dot ca
New email:
PHP Version: OS:


 [2007-04-20 17:09 UTC] mark at divindedesigns dot ca
when you round(378240328403284.234) or other large numbers... php automatically translates it with scientific notation... i'm just wondering if we can add that as an option only... say round(#,#,SCIENTIFIC) or whatnot...

i know you can use number_format()... but that's not the intended use of that function.

Reproduce code:
echo round(324324434324322324.324,2);

Expected result:
outputs "324324434324322324.32"

Actual result:
outputs "3.2432443432432E+17"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-20 17:20 UTC]
round() doesn't change the number, output depends on the value of "precision" in your php.ini.
 [2007-04-20 17:27 UTC] mark at divindedesigns dot ca
can we change that? these things should be able to be changed on the fly... no?
in my mind... round() should do just that... rounding the number... not be translating with scientific notation... i can see if we make that an option to the round()... some may find that useful... but for the rest of us... having super large numbers being translated on the fly into scientific notation, is just a recipe for disaster...
 [2007-04-20 17:32 UTC]
>can we change that?
Use (s)printf() if you want to format the numbers yourself. 

>having super large numbers being translated on the fly into
>scientific notation, is just a recipe for disaster..
What kind of disaster are you talking about?
 [2007-04-20 17:46 UTC] mark at divindedesigns dot ca
say... in a budgeting program(if only i had that much money LOL)... where your expecting numbers to firstly round into nice dollar amounts, then to add up all nice and pretty... well... scientific notation doesnt add up all that nicely...

i know theres work arounds... my complaint isnt that i cant work around it... but that its not working, as it should be... round() should not be translating naturally...
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 12:05:49 2023 UTC