# Calc: how to check a bit (binary)

Let’s say A1 contains 824 (integer)
-that’s 1100111000 in binary
how can I check the value’s bit 4 ? (expecting the return it to be 1 or “true”)

The preferred numeration of the dyadic digits seems to start with 0 for the rightmost digit (place value
`1 = 2^0`). At least my answer is based on this numeration where your “4” would be a “3”.

You surely know that Calc does not support an ‘Interger’ range (like Int, Long …) for sheet cells. Numeric values are always ‘Double’.
The (misnamed) function DEC2BIN is limited to an output of 10 dyadic digits, and can only work with numbers up to 511. The result is text!

As long as there is no problem with the ‘Double’ representation (“exact” conversion of the integer value), you may use
`=MOD(QUOTIENT(A1;2^B1);2)` to get the k-th dyadic digit of the integer value in A1 if you number the digits starting with 0 (zeroth digit) at the right (LSB) and having placed the value of k in cell B1.

Preferring a Boolean representation of the dyadic digits you can use `=ISODD(QUOTIENT(A1;2^B1))`.

I didn’t analyze this exactly but you will get exact conversion based on the above formulas at least up to the number `140737488355327` which is `2^47-1` or `11111111111111111111111111111111111111111111111` dyadic.