Solved problem 5.1: double to binary