summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/bigfloat.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/lib/bigfloat.pl')
-rw-r--r--gnu/usr.bin/perl/lib/bigfloat.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/usr.bin/perl/lib/bigfloat.pl b/gnu/usr.bin/perl/lib/bigfloat.pl
index 9ad171f295a..d687c784f1c 100644
--- a/gnu/usr.bin/perl/lib/bigfloat.pl
+++ b/gnu/usr.bin/perl/lib/bigfloat.pl
@@ -41,8 +41,10 @@ $rnd_mode = 'even';
sub main'fnorm { #(string) return fnum_str
local($_) = @_;
s/\s+//g; # strip white space
- if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && "$2$4" ne '') {
- &norm(($1 ? "$1$2$4" : "+$2$4"),(($4 ne '') ? $6-length($4) : $6));
+ if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/
+ && ($2 ne '' || defined($4))) {
+ my $x = defined($4) ? $4 : '';
+ &norm(($1 ? "$1$2$x" : "+$2$x"), (($x ne '') ? $6-length($x) : $6));
} else {
'NaN';
}