devxlogo

How Many Digits Does a Floating-Point Variable Have?

How Many Digits Does a Floating-Point Variable Have?

The standard function template std::numeric_limits (defined in ) returns the implementation-dependent number of digits that a certain type has:

#include int main(){std::numeric_limits ::digits10; //6 on my machinestd::numeric_limits ::digits10; // 15std::numeric_limits ::digits10; // 18}

devx-admin

Share the Post: