in reply to Program Not Printing Help
Perl does its arithmetic with double-precision floating point, so you probably get 52-bit precision.
for (49..54) { $x=2**$_; $y = $x + 1.1; print $_, "\t", $y-$x; } 49 1.125 50 1 51 1 52 1 53 2 54 0
In C++, the size of integer types isn't specified, but long long is probably 64 bits.
If you want to deal with really big numbers, you need to use a package like Math::BigInt.
If you only use ++ and reverse on your "numbers", perl's increment magic will make it Just Work (TM).
$x="100000000000000000000"; $x++; print $x, "\n"; $x += 1; print $x, "\n"'; 100000000000000000001 1e+20
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Program Not Printing Help
by davido (Cardinal) on May 16, 2014 at 16:38 UTC | |
by no_slogan (Deacon) on May 16, 2014 at 16:40 UTC |