The stupid question is the question not asked | |
PerlMonks |
Re: Rounding values upwards on an arbitrary basisby xdg (Monsignor) |
on Jul 02, 2003 at 21:09 UTC ( [id://270962]=note: print w/replies, xml ) | Need Help?? |
Here's an approach to the rounding up function. I've left the algorithm of what to round by at each level as exercise for the reader, as you said you know how using log()
-xdg Addendum: This rounds up, but not over -- for the case where 4 rounds up to 5, but 5 rounds up to 10 (!), then the function is even simpler:
Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.
In Section
Seekers of Perl Wisdom
|
|