Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Turning very larger numbers into an array of bits

by Anonymous Monk
on Feb 05, 2017 at 01:16 UTC ( [id://1181119]=note: print w/replies, xml ) Need Help??


in reply to Turning very larger numbers into an array of bits

Where are your big numbers coming from? If you're manipulating them at all, you probably need a multiple-precision math library. If you use Math::GMP, there's gmp_tstbit. (Math::BigInt doesn't seem to have an efficient way to fetch a particular bit.)
  • Comment on Re: Turning very larger numbers into an array of bits

Replies are listed 'Best First'.
Re^2: Turning very larger numbers into an array of bits
by syphilis (Archbishop) on Feb 05, 2017 at 06:44 UTC
    If you use Math::GMP, there's gmp_tstbit

    Yes, I'd be using the gmp library (accessed either via Math::GMPz or Math::GMP).

    Math::BigInt doesn't seem to have an efficient way to fetch a particular bit

    Math::BigInt works with base 10 representations of numbers, which makes it less than ideal for determining values of particular bits.

    Cheers,
    Rob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found