RosettaCodeData/Task/Pathological-floating-point-problems/Perl/pathological-floating-point-problems-2.pl
2023-07-01 13:44:08 -04:00

8 lines
265 B
Perl

use bignum qw(bexp);
$e = bexp(1,43);
$years = 25;
$balance = $e - 1;
print "Starting balance, \$(e-1): \$$balance\n";
for $i (1..$years) { $balance = $i * $balance - 1 }
printf "After year %d, you will have \$%1.15g in your account.\n", $years, $balance;