getting numbers after decimal point in float value as exact as input in c++ or c

I wanted to print the output of the float or double value as exact as my input.
so for each number different significant value as input.


int main()
        float e=4.887; // 3 digits after decimal and so on
        double f=49.9759349; // want exactly same 7 digit in this case without specifying 7lf
        printf(%f %lf",a,b);
        return 0;

// when i try to run the code in any ways it gives the output as i specify it.
// if i have restricted it to .5lf or .3f then its obvious that it outputs as specified. 
// But what about if i don't specify the output format and want it same as input.

Source: c#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.