Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by wrog (Friar)
on Dec 14, 2014 at 08:47 UTC ( [id://1110294]=note: print w/replies, xml ) Need Help??


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

I figure for base2 stuff length is better than log (no need to worry about rounding/transcendental crap), e.g.,
4*length sprintf'%x',~0

Replies are listed 'Best First'.
Re^3: reliably test integer size for portable bit-fiddling? (~0)
by BrowserUk (Patriarch) on Dec 14, 2014 at 09:46 UTC

    Avoid the multiply:

    say length sprintf "%b", ~0;; 64

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found