Java Primitive Data Types -Floats
key
IEEE (Institute of Electronics and Electrical Engineers) Standard 754
- Convert the following base 10 decimals to binary.
- 0.1 = 0.0001 1001 1001 1001 1001 1001 1001 1000
- 0.2
- -0.25
- -0.5
- 8.125
- Convert the binary numbers in 1. to 1-plus normalized base 2 representation with exponent E written in excess-127 format: N = ± (1.b1b2b3 ...b23 )2 x 2+E (Round b23 based on b24.)
- 1.1001 1001 1001 1001 1001 101 x 100111 1011
-
-
-
-
The Java primitive data type float is 4 bytes, or 32 bits:
|
1 bit Sign |
8 bit exponent |
23 bit mantissa |
- Write your 1-plus normalized base 2 representation with excess-127 exponent as a java float (rounded) and as an 8-digit hexadecimal.
- 0011 1101 1100 1100 1100 1100 1100 1101
3DCCCCCD
-
-
-
-