Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Bitwise AND with large numbers

by BrowserUk (Pope)
on Apr 12, 2012 at 19:46 UTC ( #964817=note: print w/replies, xml ) Need Help??

in reply to Bitwise AND with large numbers

Whilst Math::BigInt and similar arbitrary precision modules work for this, they leave a lot to be desired when it comes to performing fixed-precision math. As well as being dog slow, they don't round or truncate as fixed-precision does, and that can lead to the need for lots of extra work to 'fix' intermediate values in calculations.

If you have a lot of 128-bit integers (16-bytes/32-hex bytes) to manipulate, and need fixed precision semantics, then look at salva's Math::Int128 it is efficient and stable and provides the correct semantics for bitwise manipulations of 128-bit digests, hashes and similar.

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.

The start of some sanity?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://964817]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2018-02-21 03:18 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.