Skip to content

Commit

Permalink
bc: regression on old perl (#511)
Browse files Browse the repository at this point in the history
* bc: regression on old perl

* The default mode of this bc is not bc at all because it is not arbitrary precision; numbers are just perl floating point values
* It's still useful enough as a basic calculator but probably the program should be rewritten
* For fun I booted DamnSmallLinux live-cd v4.4.10
* The version of perl on this old linux doesn't include Math::BigFloat
* bc would not load, even in default mode because of a "use" statement; lazy-load with "require" avoids the error

* Simplify error message if BigFloat is missing

Normally this would be present but possibly a perl was built without it.
  • Loading branch information
mknos committed Mar 23, 2024
1 parent ebba233 commit 78bcd31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/bc
Expand Up @@ -2034,10 +2034,10 @@ sub command_line()
while (@ARGV) {
my $f = shift @ARGV;
if ($f eq '-b') {
use Math::BigFloat;
eval { require Math::BigFloat } or die "This program requires the Math::BigFloat module\n";
$bignum = 1;
} elsif ($f eq '-d') {
use Data::Dumper;
eval { require Data::Dumper } or die "This program requires the Data::Dumper module\n";
$debug = 1;
} elsif ($f eq '-y') {
$yydebug = 1;
Expand Down

0 comments on commit 78bcd31

Please sign in to comment.