Skip to content

Commit

Permalink
Merge pull request #235 from mknos/bc-bignumfix
Browse files Browse the repository at this point in the history
bc: integer precision problem with -b mode
  • Loading branch information
briandfoy authored Sep 10, 2023
2 parents f183084 + 279e79f commit 6e92286
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bin/bc
Original file line number Diff line number Diff line change
Expand Up @@ -2164,11 +2164,10 @@ sub yylex

# number, is it integer or float?
if ($line =~ s/^(\d+)//) {
$yylval = 0 + ($char.$1);
$yylval = Math::BigFloat->new($yylval) if $bignum;
my $str = $char . $1;
$yylval = $bignum ? Math::BigFloat->new($str) : int($str);
} else {
$yylval = 0 + $char;
$yylval = Math::BigFloat->new($yylval) if $bignum;
$yylval = $bignum ? Math::BigFloat->new($char) : int($char);
}
$type = $INT;

Expand Down

0 comments on commit 6e92286

Please sign in to comment.