summaryrefslogtreecommitdiffstats
path: root/lib/Math/Decimal/FastPP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Math/Decimal/FastPP.pm')
-rw-r--r--lib/Math/Decimal/FastPP.pm30
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]);
}