Float Conversion

You might also like

Download as xls, pdf, or txt
Download as xls, pdf, or txt
You are on page 1of 4

This sheet requires the Analysis Toolpak to be loaded. Select the Tools Menu > Add-Ins...

> check Analysis Toolpack

2 words

decimal
hex

4 bytes

decimal
hex
binary

32 bits

first bit
invert
next 8 bits
decimal
subtract 127

most significant
high word
16457
4049
high byte
64
40
01000000

0
1
10000000
128
1

Least significant
low word
4059
0FDB
73
49
01001001

15
0F
00001111

SIGN

EXPONENT

final 23 bits 10010010000111111011011


decimal
4788187
80 00 00 hex
8388608
divide 0.570796371
add 1 1.570796371 MANTISSA
FLOAT = SIGN x MANTISSA x ( 2 ^ EXPONENT )
FLOAT
Courtesy of

www.simplymodbus.ca
Rev02 - Nov 2, 2007

3.1415927

low byte
219
DB
11011011

final 23 bits

dd-Ins... > check Analysis Toolpack

ast significant
INSTRUCTIONS
< Enter these 2 words as decimal numbers
< or enter these 2 words in hex
< or enter these 4 bytes as decimal numbers
< or enter these 4 bytes in hex
< or enter these 4 bytes as 8 bit binary strings
alternate method of calculating the mantissa
each row is half of that above
1 1 is always included
1
0.5
0.5
0
0.25
0
0
0.125
0
1
0.0625
0.0625
0
0.03125
0
0
0.015625
0
1
0.0078125
0.0078125
0
0.00390625
0
0
0.001953125
0
0
0.000976563
0
0
0.000488281
0
1
0.000244141 0.000244141
1
0.00012207
0.00012207
1
6.10352E-05 6.10352E-05
1
3.05176E-05 3.05176E-05
1
1.52588E-05 1.52588E-05
1
7.62939E-06 7.62939E-06
0
3.8147E-06
0
1
1.90735E-06 1.90735E-06
1
9.53674E-07 9.53674E-07
0
4.76837E-07
0
1
2.38419E-07 2.38419E-07
1
1.19209E-07 1.19209E-07
total 1.570796371 MANTISSA

This sheet requires the Analysis Toolpak to be loaded. Select the Tools Menu > Add-Ins... > check Analysis Toolpack

FLOAT

3.1415926534 < Enter floating point number

FLOAT = SIGN x MANTISSA x ( 2 ^ EXPONENT )

1st bit

add 127
next 8 bits

1
0
1
128
10000000

SIGN

Courtesy of

EXPONENT

www.simplymodbus.ca
subtract 1
80 00 00 hex
multiply

1.570796327 MANTISSA
0.570796327
8388608
4788186.632

Rev02 - Nov 2, 2007

final 23 bits 10010010000111111011011


32 bits
4 bytes

binary
hex
decimal

2 words

hex
decimal

01000000
40
64
byte1
high byte
4049
16457
high word
most significant

01001001
49
73
byte2

00001111
0F
15
byte3

11011011
DB
219
byte4
low byte

0FDB
4059
low word
Least significant

heck Analysis Toolpack

.simplymodbus.ca

You might also like