cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Find length of floating point numbers
Find length of floating point numbers
Oct 31, 2010 at 9:20am UTC
arnabkaycee
(1)
I need some help on how to find the number of digits in float/double numbers. Can anyone suggest a suitable function?
Example : if the number is 2.569845, then the function "digitLength" should return 7.
Please Help someone.
Oct 31, 2010 at 9:24am UTC
Bazzy
(6281)
Floating point numbers are stored with a weird format in binary.
When you convert them to decimal the number of digit may vary ( eg:
http://www.cplusplus.com/reference/iostream/manipulators/setprecision/
)
Topic archived. No new replies allowed.