Converting IEEE754 (Float) (Part 2)

by Feb 15, 2019

Yesterday we looked at how PowerShell can turn IEEE754 floating point values returned by a sensor into the actual value. This involved reversing the byte order and using the BitConverter class.

If you have received a IEEE754 value in hex format, like 0x3FA8FE3B, the first task is to split the hex value into four bytes. There is a surprisingly easy way to do this: treat the hex value as an IPv4 address. These addresses internally use four bytes as well.

Here is a quick and simple approach to turn the sensor hex value into a useful numeric value:

$hexInput = 0x3FA8FE3B

$bytes = ([Net.IPAddress]$hexInput).GetAddressBytes()
$numericValue = [BitConverter]::ToSingle($bytes, 0)

"Sensor: $numericValue"

Your learning points:

  • Convert numbers to an IPAddress object to split the number into bytes. This approach can also be used to get the Least Significant Byte (LSB)or Most Significant Byte (MSB)from a number – PowerShell Conference EU 2019 – June 4-7, Hannover Germany – visit There aren’t too many trainings around for experienced PowerShell scripters where you really still learn something new. But there’s one place you don’t want to miss: PowerShell Conference EU – with 40 renown international speakers including PowerShell team members and MVPs, plus 350 professional and creative PowerShell scripters. Registration is open at, and the full 3-track 4-days agenda becomes available soon. Once a year it’s just a smart move to come together, update know-how, learn about security and mitigations, and bring home fresh ideas and authoritative guidance. We’d sure love to see and hear from you!

Twitter This Tip! ReTweet this Tip!