in reply to Re: Problems with number resolution
in thread Problems with number resolution
Thanks Poj,
To have the sum as integer, the (number*100) has to be converted to an integer using round.use Math::Round qw/round/; my @nr=('32431.19', '20', '-10', '-31800'); my $x=0; foreach (@nr) { $x+=round($_*100); print "$_ => ".$x/100 ."\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problems with number resolution
by Laurent_R (Canon) on Jan 02, 2018 at 00:19 UTC | |
by Anonymous Monk on Jan 02, 2018 at 06:57 UTC | |
by Laurent_R (Canon) on Jan 02, 2018 at 08:42 UTC |