decimal points of a double

Hi all,

I would like to ask is it possible to truncate a double number with variable decimal points ?

For example,
a=0.003457834 truncate to a=0.0034578
a=0.00002378454 truncate to a=0.000023785
a=0.0000000435768 truncate to a=0.000000043577

Is it possible to do the conversion as shown above in C++ ?

Thanks in advance.
floating point numbers are typically not stored in a decimal format. What you see is the result of a conversion to decimal. You can (and should) deal with that conversion on display.

http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
Topic archived. No new replies allowed.