EasyManua.ls Logo

Siemens SIMATIC IOT - Page 85

Siemens SIMATIC IOT
133 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Maintaining and repairing the device
6.6 Configure IOT2050 SM
SIMATIC IOT2050
Operating Instructions, 03/2024, A5E39456816-AF
85
power_count -= 1;
}
mantissa_int += 1;
return pow(-1, sign) * mantissa_int * pow(2, exponent);
}
Example: converts real to float with Python
def real_to_float(u32:int) -> float:
"""
Convert IEEE754 floating point.
"""
sign = u32 >> 31
exponent = ((u32 >> 23) & 0xFF) - 127
mantissa = u32 & 0x7FFFFF
power_count = -1
mantissa_int = 0
for i in range(0, 23):
mantissa_int += ((mantissa >> (22 - i)) & 1) * pow(2,
power_count)
power_count -= 1
mantissa_int += 1
return pow(-1, sign) * mantissa_int * pow(2, exponent)

Table of Contents

Other manuals for Siemens SIMATIC IOT

Related product manuals