Brian Dunning's FileMaker Custom Functions

BitTest2 ( value ; bit )

Checks whether bit 'bit' in value 'value' is on or off

  Average rating: 4.2 (34 votes) Log in to vote

Stephen Drake   Stephen Drake

Share on Facebook Share on Twitter

  Sample input:
33 ; 5
  Sample output:

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

A non-recursive alternative to BitTest.

Bits are numbered from zero.

Div ( value ; 2 ^ bit ) is odd if the tested bit is set,
lower bits that are set add zero to the result,
higher bits that are set add an even number to the result.

If required, you could add error checking to make sure bit and value are >= 0.
Alternatively, you can use the function as is to test bits in the fractional part of the value or to test negative values.



Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.