in reply to Rounding errors problem
Floating point arithmetic is inherently imprecise. Since you record as pennies, Math::BigInt might be a better choice than Math::BigFloat. Currency exchange rates are, in themselves, a bit fuzzy, so I suggest getting your spec clarified as to how rounding is done, what quotation is used, when the quote is changed, etc. There is an accountant somewhere in this job. There's where to get the real needs.
Update: If Math::BigInt is overkill, what do you need with Math::BigFloat? To round an ordinary perl number, a float, to an integer ($n+.5)|0 or else sprintf "%.0f",$n. Again, talk to the accountant.
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Rounding errors problem
by perlcgi (Hermit) on Sep 28, 2001 at 16:06 UTC | |
by merlyn (Sage) on Sep 28, 2001 at 18:19 UTC | |
by grinder (Bishop) on Sep 28, 2001 at 18:35 UTC | |
by perlcgi (Hermit) on Sep 28, 2001 at 19:37 UTC |
In Section
Seekers of Perl Wisdom