Extracting an nth bit from a decimal

I'm trying to use the right shift (>>) operator to extract an nth bit from a decimal and its giving me an error: Value was either too large or too small for a UInt16". 

Here is an example : 62914560 >> 0

How do I solve this one?

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • If you want to do a right shift you can use a combination of the Floor and Pow functions.

    Floor(number / Pow(2,shift))

    In the case of your example, let's do a right shift of 5 bits:

    Floor(62914560 / Pow(2,5)) = 1966080

    Which is the same as doing:

    62914560 >> 5

    This can be used in a calculation or in a value transform.

print this pagePrint this page
Like Follow
  • 8 mths agoLast active
  • 1Replies
  • 32Views
  • 2 Following