Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
As I always got s.th. like 123.99, but I don't want 'super-market-prices'!my $p = &PricePerUnit(..); $units = int(0.5 + ($units*$p*100) )/100;
What is my mistake? The accepted non-accuracy can't be that big?int(0.5 + ($units*$p*100) ) => 12400 (ok!!) but now deviding 12400 by 100 I get 123.99 instead of 124.00 or 124
Carl
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: strange rounding
by bart (Canon) on Nov 29, 2004 at 13:06 UTC | |
by osunderdog (Deacon) on Nov 29, 2004 at 15:24 UTC | |
Re: strange rounding
by reneeb (Chaplain) on Nov 29, 2004 at 13:06 UTC | |
by Anonymous Monk on Nov 29, 2004 at 16:03 UTC | |
by BrowserUk (Patriarch) on Nov 29, 2004 at 16:07 UTC | |
by Anonymous Monk on Nov 30, 2004 at 09:28 UTC | |
Re: strange rounding
by edan (Curate) on Nov 29, 2004 at 12:56 UTC | |
Re: strange rounding
by I0 (Priest) on Dec 01, 2004 at 07:13 UTC | |
Re: strange rounding
by Anonymous Monk on Nov 29, 2004 at 12:39 UTC |