|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: write off function using regexby Krambambuli (Deacon) |
| on May 24, 2010 at 08:24 UTC ( #841339=note: print w/ replies, xml ) | Need Help?? |
|
Maybe something like which outputs 9.90 => 9.90 9.91 => 9.90 9.9111 => 9.90 9.94999 => 9.90 9.95 => 9.95 9.950001 => 9.95 9.96 => 9.95 9.99 => 9.95 9.99999 => 9.95would fit too ? Your wanted writeoff function is then simply floor( 20 * x) /20.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||