perl -le 'print sprintf("%6.1f: ", $_), reverse(split //, unpack("b*", pack("F", $_))) for map {eval} @ARGV' #### 33.3 33.4 '33.3+33.3' '33.4+33.3' '33.3+33.3+33.4' '33.4+33.3+33.3' #### 33.3:0100000001000000101001100110011001100110011001100110011001100110 33.4:0100000001000000101100110011001100110011001100110011001100110011 66.6:0100000001010000101001100110011001100110011001100110011001100110 66.7:0100000001010000101011001100110011001100110011001100110011001100 100.0:0100000001011001000000000000000000000000000000000000000000000000 100.0:0100000001011000111111111111111111111111111111111111111111111111 #### 33.3 is represented as 2^5 times B1.0000101001100110011001100110011001100110011001100110 33.4 is represented as 2^5 times B1.0000101100110011001100110011001100110011001100110011 66.6 is represented as 2^6 times B1.0000101001100110011001100110011001100110011001100110 66.7 is represented as 2^6 times B1.0000101011001100110011001100110011001100110011001100 100.0 (exactly) is represented as 2^6 times B1.1001000000000000000000000000000000000000000000000000 100.0 (not quite) is represented as 2^6 times B1.1000111111111111111111111111111111111111111111111111 #### 33.3 + 33.3 is then 2^5 times: 1.0000101001100110011001100110011001100110011001100110 + 1.0000101001100110011001100110011001100110011001100110 --------------------------------------------------------- 10.0001010011001100110011001100110011001100110011001100 But that's too long for a double, so it's represented as 2^6 times 1.0000101001100110011001100110011001100110011001100110 33.4 + 33.3 is then 2^5 times: 1.0000101100110011001100110011001100110011001100110011 + 1.0000101001100110011001100110011001100110011001100110 --------------------------------------------------------- 10.0001010110011001100110011001100110011001100110011001 Now, smashing that into a double results in 2^6 times: 1.0000101011001100110011001100110011001100110011001100 #### 66.6 + 33.4 is now 2^6 times: 1.0000101001100110011001100110011001100110011001100110 + 0.1000010110011001100110011001100110011001100110011010 --------------------------------------------------------- 1.1001000000000000000000000000000000000000000000000000 66.7 + 33.3 is now 2^6 times: 1.0000101011001100110011001100110011001100110011001100 + 0.1000010100110011001100110011001100110011001100110011 --------------------------------------------------------- 1.1000111111111111111111111111111111111111111111111111