diff options
author | P. J. McDermott <pj@pehjota.net> | 2017-01-17 15:23:27 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2017-01-17 15:23:27 (EST) |
commit | 52a46715c75bd15f7ae4d8145de74b7ee691f38c (patch) | |
tree | cbb87377602599211a707015334751ffc7d965cd /lib/Math | |
parent | 892a2d2cc5bc2b67d14409627dc0eb7a0c1c6305 (diff) | |
download | Math-Decimal-FastPP-52a46715c75bd15f7ae4d8145de74b7ee691f38c.zip Math-Decimal-FastPP-52a46715c75bd15f7ae4d8145de74b7ee691f38c.tar.gz Math-Decimal-FastPP-52a46715c75bd15f7ae4d8145de74b7ee691f38c.tar.bz2 |
Math::Decimal::FastPP: Don't interpolate literal strings
Diffstat (limited to 'lib/Math')
-rw-r--r-- | lib/Math/Decimal/FastPP.pm | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/Math/Decimal/FastPP.pm b/lib/Math/Decimal/FastPP.pm index 21ab2d2..bc5ffbe 100644 --- a/lib/Math/Decimal/FastPP.pm +++ b/lib/Math/Decimal/FastPP.pm @@ -82,7 +82,7 @@ use warnings; use Exporter qw(import); our @EXPORT_OK = qw(dadd dmul drhtz drhfz); -our $VERSION = "0.001"; +our $VERSION = '0.001'; =head2 dadd() @@ -96,25 +96,25 @@ sub dadd { my ($ai, $af) = split(/\./, $_[0]); my ($bi, $bf) = split(/\./, $_[1]); - $af ||= ""; - $bf ||= ""; + $af ||= ''; + $bf ||= ''; my $ae = length($af); my $be = length($bf); my $ce; if ($ae == $be) { $ce = $ae; } elsif ($ae < $be) { - $af .= "0" x ($be - $ae); + $af .= '0' x ($be - $ae); $ce = $be; } else { - $bf .= "0" x ($ae - $be); + $bf .= '0' x ($ae - $be); $ce = $ae; } my $as = $ai . $af; 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); } @@ -130,8 +130,8 @@ sub dmul { my ($ai, $af) = split(/\./, $_[0]); my ($bi, $bf) = split(/\./, $_[1]); - $af ||= ""; - $bf ||= ""; + $af ||= ''; + $bf ||= ''; my $as = $ai . $af; my $ae = length($af); my $bs = $bi . $bf; @@ -139,7 +139,7 @@ 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); } @@ -165,12 +165,12 @@ sub drhtz my ($ai, $af, $ad) = $_[0] =~ m/^(-?\d*)\.(\d{$_[1]})(\d*)$/ or return; my $as = $ai . $af; if ($as >= 0) { - if ($ad > "5" . "0" x (length($ad) - 1)) { ++$as; } + if ($ad > '5' . '0' x (length($ad) - 1)) { ++$as; } } else { - if ($ad > "5" . "0" x (length($ad) - 1)) { --$as; } + 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]); } @@ -196,12 +196,12 @@ sub drhfz my ($ai, $af, $ad) = $_[0] =~ m/^(-?\d*)\.(\d{$_[1]})(\d*)$/ or return; my $as = $ai . $af; if ($as >= 0) { - if ($ad >= "5" . "0" x (length($ad) - 1)) { ++$as; } + if ($ad >= '5' . '0' x (length($ad) - 1)) { ++$as; } } else { - if ($ad >= "5" . "0" x (length($ad) - 1)) { --$as; } + 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]); } |