BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone explain these outputs:
print +( 1<<(2**$_+$_-1) )-1 for 4,5,6;; 524287 68719476735 31 print unpack 'b*', pack 'Q', ( 1<<(2**$_+$_-1) )-1 for 4,5,6;; 1111111111111111111000000000000000000000000000000000000000000000 1111111111111111111111111111111111110000000000000000000000000000 1111100000000000000000000000000000000000000000000000000000000000
What I am expecting:
1111111111111111111000000000000000000000000000000000000000000000
1111111111111111111111111111111111110000000000000000000000000000
1111111111111111111111111111111111111111111111111111111111111111
I know it can't be Perl's fault? But there it is...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl's bad at arithmetic?
by Eily (Monsignor) on Mar 27, 2015 at 23:29 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2015 at 23:37 UTC | |
by Eily (Monsignor) on Mar 28, 2015 at 00:00 UTC | |
by BrowserUk (Patriarch) on Mar 28, 2015 at 00:11 UTC | |
|
Re: Perl's bad at arithmetic?
by roboticus (Chancellor) on Mar 27, 2015 at 23:31 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2015 at 23:39 UTC | |
by roboticus (Chancellor) on Mar 28, 2015 at 00:04 UTC | |
by BrowserUk (Patriarch) on Mar 28, 2015 at 00:10 UTC |