Merge pull request #1557 from GriffinRichards/fix-calcrom-0

Fix calcrom's handling of 0s
This commit is contained in:
GriffinR 2021-11-17 15:11:23 -05:00 committed by GitHub
commit cfb9ae40d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -104,16 +104,19 @@ my $partial_documented_as_string;
# Performing addition on a string converts it to a number. Any string that fails
# to convert to a number becomes 0. So if our converted number is 0, but our string
# is nonzero, then the conversion was an error.
$undocumented_as_string =~ s/^\s+|\s+$//g;
my $undocumented = $undocumented_as_string + 0;
(($undocumented != 0) and ($undocumented_as_string ne "0"))
(($undocumented != 0) or (($undocumented == 0) and ($undocumented_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$undocumented_as_string'";
$partial_documented_as_string =~ s/^\s+|\s+$//g;
my $partial_documented = $partial_documented_as_string + 0;
(($partial_documented != 0) and ($partial_documented_as_string ne "0"))
(($partial_documented != 0) or (($partial_documented == 0) and ($partial_documented_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$partial_documented_as_string'";
$total_syms_as_string =~ s/^\s+|\s+$//g;
my $total_syms = $total_syms_as_string + 0;
(($total_syms != 0) and ($total_syms_as_string ne "0"))
(($total_syms != 0) or (($total_syms == 0) and ($total_syms_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$total_syms_as_string'";
($total_syms != 0)