diff options
author | P. J. McDermott <pj@pehjota.net> | 2017-01-17 14:53:31 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2017-01-17 14:53:31 (EST) |
commit | fc81a53c673f7c073c1ce0ea68f0df8e8057ff9c (patch) | |
tree | 5980daae1ba7616cc4914c8cc4e55f1eef7ad3c3 /lib | |
parent | 1414956f6039dd59f48aa447bf78606f0ef02eae (diff) | |
download | Math-Decimal-FastPP-fc81a53c673f7c073c1ce0ea68f0df8e8057ff9c.zip Math-Decimal-FastPP-fc81a53c673f7c073c1ce0ea68f0df8e8057ff9c.tar.gz Math-Decimal-FastPP-fc81a53c673f7c073c1ce0ea68f0df8e8057ff9c.tar.bz2 |
drhtz(), drhfz(): Replace regex dots with more strict expressions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Math/Decimal/FastPP.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Math/Decimal/FastPP.pm b/lib/Math/Decimal/FastPP.pm index 0dca737..21ab2d2 100644 --- a/lib/Math/Decimal/FastPP.pm +++ b/lib/Math/Decimal/FastPP.pm @@ -162,7 +162,7 @@ of significant digits right of the radix point. sub drhtz { - my ($ai, $af, $ad) = $_[0] =~ m/^(.*)\.(.{$_[1]})(.*)$/ or return; + 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; } @@ -193,7 +193,7 @@ of significant digits right of the radix point. sub drhfz { - my ($ai, $af, $ad) = $_[0] =~ m/^(.*)\.(.{$_[1]})(.*)$/ or return; + 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; } |