diff options
author | Chip Salzenberg <chip@perl.com> | 1994-10-19 04:35:28 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-03 10:03:25 +1200 |
commit | afea815c58c54233979716dd5770b69df2df51f8 (patch) | |
tree | bf6107a8d7d46c38e2126db0a1112a932449670b /lib/bigfloat.pl | |
parent | 34d04c8d9a0f251c651e2f9860ac3ffc476d363d (diff) | |
download | perl-afea815c58c54233979716dd5770b69df2df51f8.tar.gz |
Don't use $4 when it might be undef
Diffstat (limited to 'lib/bigfloat.pl')
-rw-r--r-- | lib/bigfloat.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bigfloat.pl b/lib/bigfloat.pl index 9ad171f295..d687c784f1 100644 --- a/lib/bigfloat.pl +++ b/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'; } |