The baseConvert function tells me that the numbers 3614123224 and 7909090520 has the same binary representation! WHY??
Code: Select all
put baseConvert("3614123224", 10, 2) is baseConvert("7909090520", 10, 2) -- yields true
Regards,
Gerrie
Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller
Code: Select all
put baseConvert("3614123224", 10, 2) is baseConvert("7909090520", 10, 2) -- yields true
Kind of both. The number is an actual quantity calculated as the sum of four 32-bit integers, and only one of the four integers is the decimal representation of a 4-byte chunk of binary data. I'm trying to write a hashing algorithm.FourthWorld wrote: ↑Thu Dec 20, 2018 4:18 amWhat does the number represent? Is it an actual quantity, or a decimal representation of byte values? If the latter, the binaryEncode and binaryDecode functions may help, since they can operate on a series of values in one pass, with lots of conversion options.