In terms of the original problem as presented, I believe that it an alternate approach employing the exponentiation operator/functions would be more efficient and side-step the format conversion problems.
In Perl:
perl -le 'print $_, ": 0 to ", 2**$_ - 1 for 0..32'
#include <stdio.h> #include <math.h> int main (void) { int i; for (i = 0; i <= 32; i++) printf("%d: 0 to %.f\n", i, pow(2, i) - 1); return(0); }
perl -le "print unpack'N', pack'B32', '00000000000000000000001010110011'"
In reply to Re: Integer overflow in Perl and C
by rob_au
in thread Integer overflow in Perl and C
by amrangaye
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |