Search:
Forum
General C++ Programming
decimal points of a double
decimal points of a double
Apr 5, 2012 at 8:20am UTC
nsw1216
(39)
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.
Apr 5, 2012 at 8:43am UTC
kbw
(9488)
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.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs