NumToHex ( integer )
Convert Base 10 number to Base 16
Average rating: 4.1 (42 votes) Log in to vote
Jeremiah Small - Show more from this author
Soliant Consulting, Inc.
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
To convert a base 10 number to hexadecimal you repeatedly divide the number by 16, each time recording the remainder. At the end of this line up all of the remainders and reverse their order. As you know, hexadecimal is base 16, and hence makes use of 6 extra symbols (ABCDEF). A = 10, and F, 15. 16 is written as 10. When converting to any base above 10 a remainder equal to or greater than 10 has to be written using the correct symbol.
Converting 3440 to hexadecimal
3440/16 = 215 (Mod = 0dec or 0hex)
215/16 = 13 (Mod = 7dec or 7hex)
13/16 = 0 (Mod = 13dec or Dhex)
In reverse order, the hex reads D70
Hence, 3440dec = D70hex
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.