Yes, double can represent any number that can float. Similarly for parity, etc.
A floating point number is represented in the form as 1.01bx 2^-1
(0.625, in this case). Significant components of a number are the value, which is basically a binary number with a number notation, usually immediately after the first digit, and an exponent.
The only significant difference between binary floating point formats is the number of bits for each component. The more bits a number is used, the more bits are available for each part. Thus, a 32-bit "float" can have 1.01000000000000000000000 for significant, and (a "64-bit" "double" will have about 50 digits after the dot. This means that any number that is exactly represented in the float is also accurately represented in double, because you have both increased accuracy (reading: more significant digits) and an increased range, this is similar to how a 64-bit integer variable can contain any 32-bit integer; the extra bits are largely unused.
Of course, any bits that were chopped off due to a rounding error will not be returned back to a number when converting to the double value 0.3 that you have in your float, being an inaccurate result, for example, 0.2999999875 or something (I I donβt want to calculate), Iβm not going to approach 0.3 when you convert it to double - it will still remain 0.2999999875. If you want a closer approximation, you will need to repeat the doubling calculations from the start.
source share