Find length of floating point numbers

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.
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.