Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: reliably test integer size for portable bit-fiddling? (~0)

by Anonymous Monk
on Dec 09, 2014 at 00:53 UTC ( [id://1109669]=note: print w/replies, xml ) Need Help??


in reply to Re^2: reliably test integer size for portable bit-fiddling? (~0)
in thread reliably test integer size for portable bit-fiddling?

*cough*
$ perl -E " say log(~0)/log(2) " 31.9999999996641 $ perl -E " say int 0.999+log(~0)/log(2) " 32

Replies are listed 'Best First'.
Re^4: reliably test integer size for portable bit-fiddling? (~0)
by tye (Sage) on Dec 10, 2014 at 15:34 UTC
    $ perl -le "print log(~0+1)/log(2)" 32

    or, to be safe

    $ perl -e 'printf "%.0f\n", log(~0+1)/log(2)' 32

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1109669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found