Browse DevX
Sign up for e-mail newsletters from DevX


Detecting the Properties and Limits of Numeric Datatypes

Each built-in datatype in C++ possesses different properties, all of which contain a wealth information important to the design of your application. Find out how the <limits> library can help you programmatically access this critical data.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

++ has about 10 distinct integral datatypes and three more floating point datatypes. Each datatype has different numeric properties such as the numeric range, the maximum number of digits it can represent, and a different precision. These properties are critical in financial, scientific, graphical, and DSP applications. This article will discuss how to obtain the numeric properties of fundamental datatypes programmatically by using the <limits> library.

"How many digits can a double store?", "What is the maximum positive value that signed long can represent?", and similar questions are critical to the design of your application. How do you get the answers to these questions in a systematic and portable fashion?

Use the standard <limits> library to obtain the numeric properties of built-in datatypes.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date