Don't ask to ask, just ask | |
PerlMonks |
Re: Re: Re: (Golf) Formatting Integer To Moneyby thelenm (Vicar) |
on Aug 29, 2002 at 18:45 UTC ( [id://193853]=note: print w/replies, xml ) | Need Help?? |
Here's a 44 with a few small improvements to yours:
It seems that the sprintf solutions fail sometimes in rounding, e.g. "123456789012345.125" becomes "123,456,789,012,345.12" instead of "123,456,789,012,345.13". Update: I was just informed by thospel++ that IEEE rounding is toward even, not upward. That explains the behavior, though I'm not sure if it's the desired behavior for this problem. -- Mike --
In Section
Meditations
|
|