Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
to round decimals numbers to a price (2 dec)
I have
I 'explode' this calc and I found
I have
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;
I 'explode' this calc and I found
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
Back to
Seekers of Perl Wisdom