When using Adobe ColdFusion and trying to convert a hexadecimal string to a decimal string, we don't seem to get the result we want / expect.
<cfset i = #InputBaseN("A1000050", 16)# > <cfdump var="#i#">
displayed -1593835440 We expected 2701131856
In the Windows calculator, when we convert A1000050 to dec qword, we get our expected result. However, if we use dword, this gives us the save value that ColdFusion gives.
Are we doing something wrong in ColdFusion? How can we get the expected value?
Binary value of the expected value (according to Windows calc programmer mode)
0000 0000 0000 0000 0000 0000 0000 0000 1010 0001 0000 0000 0000 0000 0101 0000
= 2701131856
The binary value that we actually get
1010 0001 0000 0000 0000 0000 0101 0000
= -1593835440
shaun source share