i have hex number (eg 46EA6000) and i wanted convert it to float(eg 30000.0)
i found the code in c++:
UINT nType; int iLen, iCnt, iDataCtr; unsigned char bData; union FloatHex{ unsigned char uData[4]; // Four bytes to hold an IEEE 754 float float fValue; // The IEEE 754 float }uConvert;
//Loop through the HEX chars, and convert to byte values //Because we read the float HEX string MSB to LSB, we must store //the data MSB to LSB. So, iDataCtr was created to help readability. iDataCtr = (iLen / 2) - 1; //2 text chars per HEX byte. (0-based counter) for (iCnt=0; iCnt<iLen; ++iCnt){ //Read high nibble char & store bData = strHex.GetAt(iCnt); //Read high nibble char from string if (bData > '9') //Convert ASCII A-F to decimal 10-15 bData -= 7; bData <<= 4; //move to high nib & store uConvert.uData[iDataCtr] = bData; // Get low nibble (next char in string) ++iCnt; //inc char ptr bData = strHex.GetAt(iCnt); //get next char (low nibble) if (bData > '9') //Convert ASCII A-F to decimal 10-15 bData -= 7; bData -= '0'; //convert from ASCII to hex uConvert.uData[iDataCtr] |= bData;//merge hex value --iDataCtr; //dec data union ptr } m_Float = uConvert.fValue;but i dont know how to write it in autohotkey language
Can anyone help me??
Thx in advance!
Futu