diff options
-rw-r--r-- | lib/Math/Decimal/FastPP.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Math/Decimal/FastPP.pm b/lib/Math/Decimal/FastPP.pm index c1a04df..538fb92 100644 --- a/lib/Math/Decimal/FastPP.pm +++ b/lib/Math/Decimal/FastPP.pm @@ -30,7 +30,8 @@ sub dadd my $bs = $bi . $bf; my $cs = $as + $bs; $cs = sprintf("%0${ce}i", $cs); - return substr($cs, 0, length($cs) - $ce) . '.' . + return + substr($cs, 0, length($cs) - $ce) . '.' . substr($cs, length($cs) - $ce); } @@ -47,7 +48,8 @@ sub dmul my $cs = $as * $bs; my $ce = $ae + $be; $cs = sprintf("%0${ce}i", $cs); - return substr($cs, 0, length($cs) - $ce) . '.' . + return + substr($cs, 0, length($cs) - $ce) . '.' . substr($cs, length($cs) - $ce); } @@ -61,7 +63,8 @@ sub drhtz if ($ad > '5' . '0' x (length($ad) - 1)) { --$as; } } $as = sprintf("%0$_[1]i", $as); - return substr($as, 0, length($as) - $_[1]) . '.' . + return + substr($as, 0, length($as) - $_[1]) . '.' . substr($as, length($as) - $_[1]); } @@ -75,7 +78,8 @@ sub drhfz if ($ad >= '5' . '0' x (length($ad) - 1)) { --$as; } } $as = sprintf("%0$_[1]i", $as); - return substr($as, 0, length($as) - $_[1]) . '.' . + return + substr($as, 0, length($as) - $_[1]) . '.' . substr($as, length($as) - $_[1]); } |