I've got some numbers and I'm trying to determine if rounding will occur if I store them as the type float. The numbers have six digits( e.g. 1.23456e001). How can I determine the number of significant digits that are stored in a float?
This is a discussion on Number of Significant Digits in a Float within the C++ Programming forums, part of the General Programming Boards category; I've got some numbers and I'm trying to determine if rounding will occur if I store them as the type ...
I've got some numbers and I'm trying to determine if rounding will occur if I store them as the type float. The numbers have six digits( e.g. 1.23456e001). How can I determine the number of significant digits that are stored in a float?
There is a define in <float.h> [or <cfloat>] called FLT_DIG (DBL_DIG or LDBL_DIG for double and long double respectively).
I'm not sure if this a "best case" or "worst case" situation.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.