in reply to Decimal Increment Bug?
This is a FAQ Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)? Use printf:
use warnings; use strict; my $i = 0.1; my $v = 0 - $i; while ( $v < 9 ) { $v += $i; printf "%.1f%s", $v, $/; }
|
---|
In Section
Seekers of Perl Wisdom