in reply to How to deal with a 59-bit bitmask that is given in decimal integer string form?

Your number is too big for perls integer arithmetic, so it is stored as floating point with its inherent fuzzyness.

You might use a math module like bignum:

perl -e '$x="576458570460036993"; print ($x & 15);' 15 perl -e 'use bignum; $x="576458570460036993"; print ($x & 15);' 1
  • Comment on Re: How to deal with a 59-bit bitmask that is given in decimal integer string form?
  • Download Code

Replies are listed 'Best First'.
Re^2: How to deal with a 59-bit bitmask that is given in decimal integer string form?
by Xenofur (Monk) on Jul 12, 2008 at 14:17 UTC
    Awesome, exactly what i needed. Thanks a lot for the quick and simple answer!