KEY Java Primitive Data Types -Floats IEEE (Institute of Electronics and Electrical Engineers) Standard 754

1. Convert the following base 10 decimals to binary. a) 0.1 = 0.0001 1001 1001 1001 1001 1001 1001 1001 b) 0.2 = 0.0011 0011 0011 0011 0011 0011 0011 0011 c) -0.25 = -0.01 d) -0.5 = -0.1 e) 8.125 = 1000.001

2. Convert the binary numbers in 1. to 1-plus normalized base 2 representation with exponent E +E written in excess-127 format: N =  (1.b1b2b3 …b23 )2 x 2 (Round b23 based on b24.) a) 1.1001 1001 1001 1001 1001 101 x 100111 1011 b) 1.1001 1001 1001 1001 1001 101 x 100111 1100 c) -1.0000 0000 0000 0000 0000 000 x 100111 1101 d) -1.0000 0000 0000 0000 0000 000 x 100111 1110 e) 1.0000 0100 0000 0000 0000 000 x 101000 0010

The Java primitive data type float is 4 bytes, or 32 bits: 1 bit Sign 8 bit exponent 23 bit mantissa

3. Write your 1-plus normalized base 2 representation with excess-127 exponent as a java float (rounded) and as an 8-digit hexadecimal. a) 0011 1101 1100 1100 1100 1100 1100 1101 3DCCCCCD b) 0011 1110 0100 1100 1100 1100 1100 1101 3E4CCCCD c) 1011 1110 1000 0000 0000 0000 0000 0000 BE800000 d) 1011 1111 0000 0000 0000 0000 0000 0000 BF000000 e) 0100 0001 0000 0010 0000 0000 0000 0000 41020000