Brian Dunning's FileMaker Custom Functions

Dec2Bin9 ( decnum )

Converts a decimal number to its binary equivalent.

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

M S Pease   M S Pease

Share on Facebook Share on Twitter

  Sample input:
Dec2Bin9 ( 511 )
  Sample output:

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

Non-recursive function to convert a decimal number to its binary equivalent, currently to 9 places (decimal 511 max).

The other "Dec2Bin" custom function didn't work for me, so I formulated this version. It is very simple to edit this function to accommodate larger decimal inputs, or limit it to smaller inputs. I needed nine binary places, so this is the result, named "Dec2Bin9".



comment   comment, VR
Oct 6, 2011
It is very simple to construct a function to accommodate ANY decimal input:

DecToBin ( decimal )

Let ( [
next = Div ( decimal ; 2 )
] ;
Case ( next ; DecToBin ( next ) )
Mod ( decimal ; 2 )

See also:

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.