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}

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist