Brian Dunning's FileMaker Custom Functions

IsNthBinRoot ( Number ; Factor )

Calculates whether a number is a binary positional number, i.e., 001 is the first binary position, 010 (2) is the second binary position, 100 (4) is the third binary position, etc..

  Average rating: 4.6 (23 votes) Log in to vote

Tim Griffith   Tim Griffith - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
IsNthBinRoot ( 256 ; "" )
IsNthBinRoot ( 11 ; "" )
  Sample output:
9,
0

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

IsNthBinRoot ( Number ; Factor ) Factor is initially an empty set "". Calculates whether a number is a binary positional number, i.e., 001 is the first binary position, 010 (2) is the second binary position, 100 (4) is the third binary position, etc.. All numbers that do not represent a binary position return zero ('0'). DEPENDENCY FUNCTION: 'IsNthRootNumToBin (decNumber ; binary )' This dependent function is comment included at the end of this function for your convenience.

 

Comments

Erich   Erich, Germany
Aug 15, 2012
What about:

let(
[
lb=if(Number;lg(Number);1,3)
];
if(lb = int(lb);1+lb;0)
)

It's much shorter.
 

Log in to post comments.

 

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

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: