IpDecimal
The IP decimal allows for IP Addresses to be any number between 0 and 4,294,967,296 or 2^32. This format is well suited for doing IP math and storing in database.
How to convert an IP Address to IP Decimal format
Your IP address is 10.1.1.200 and your IP decimal is but how do you go back and forth. Your IpAddress is 10.1.1.200:
- 10 * 256 + 1 = 2,561
- 2561 * 256 + 1 = 655,617
- 655617 * 256 + 200 = 167,838,152
Converting your IP decimal back to an IP address is a bit more difficult, as you have to deal with remainders. It’s not too bad if you have access to a mod() command in a programming language. Unfortunately Cold Fusion’s mod() command does not handle numbers larger than an Int. IP Decimals can get pretty big, so I wrote my own modlong() command to handle larger Int.






