I have a double x
, resulting from a calculation, for which x > 1.0
returns true
. I want to be able to print the exact representation in scientific notation of that number without rubbish digits. I know it has 64 bits
therefore I'd like to see the exact number it represents.
I am having problems because for example if y = 1.01
and i do printf("%.20lf", y)
I get 1.01000000000000000888
, which has trash digits at the end.
I am fine with any notation (scientific or whatever) as long as I can read the exact double that x
or y
represents.
This could be trivial but I cannot find any solution. Thanks for tips.