Hello, Can anyone please tell me how can I convert this float number: 12,25 to binary? I know how to convert the "12" but not the 0.25
Any help is much appreciated. Thanks
Hello, Can anyone please tell me how can I convert this float number: 12,25 to binary? I know how to convert the "12" but not the 0.25
Any help is much appreciated. Thanks
Keep Multiplying the number after decimal by 2 till it becomes 1.0
eg. 0.25*2 = 0.50
0.50*2 = 1.00
and the result is in reverse order being .01
(d means decimal, b means binary)
1.) You write 12d in binary and remove it from your float. Only the remainder (.25d) will be left. 2.) You write the dot. 3.) while the remainder (0.25d) is not zero, multiply it with 2 (-> 0.50d), remove and write the digit left of the dot (0), and continue with the new remainder (.50d).