# Dec2Bin9 ( decnum )

Converts a decimal number to its binary equivalent.

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

M S Pease |

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".

## Comments

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: http://www.briandunning.com/cf/218 |
||

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