Soft test points:
How to convert decimals to binary (reproduced)
https://jingyan.baidu.com/article/eb9f7b6dc692e9c79264e878.html
Method 1: Use paper and pen to calculate
-
The decimal fraction is converted into a binary fraction, mainly by multiplying the decimal part by 2 and taking the integer part until the decimal point is 0. Let's take the decimal 0.625 as an example and convert it to binary.
-
Multiply the fractional part 0.625 by 2, and take the integer part 1, as shown in the figure:
-
Multiply the remaining fractional part by 0.25 by 2, and take the integer part 0, as shown in the figure:
-
Multiply the remaining fractional part 0.5 by 2, and take the integer part 1, as shown in the figure:
-
At this point, the fractional part is already 0, and the calculation ends. Now, we will write the obtained numbers from top to bottom to get 101, as shown in the figure:
-
Then we get 0.625 converted to binary decimal, as shown in the figure:
END
Precautions
-
After some decimals are multiplied by 2, the decimal part has not been able to get 0, such as 0.333333. This only requires a certain degree of accuracy.