0

I am trying to convert this HEX value fba46c58 to a signed int then take that number and divide it by 1000000. I have tried the following code but I don't seem to come up with the correct number. Overall I need the end number to equal -73.11044

Tried this code:

let testd = parseInt("fba46c58", 16)
if ((testd & 0x8000) > 0) {
    testd = testd - 0x10000;
}

// Getting: 4221856856 / 1000000 = 4221.856856
// Want to get: -73.11044

Any help would be amazing thank you!

gregwinn
  • 941
  • 1
  • 9
  • 16

0 Answers0