Home   |   About   |   Terms   |   Contact    
Read & Learn

Floating points numbers


☯ All C++ Articles     ☯ All Articles

A new product.

Popular Google Pages:

◕ This article is regarding Floating points numbers.
Last updated on: .

◕ What is Floating points numbers?

After integer types the floating point types are the second major group of fundamental C++ types.

A floating point type number represents a number with fractional parts, such as the value of a pie = 3.142.

A floating point type also provides a much greater range in values.
For an example,
If we want to represent the number of the bacterial cells in a human body, which is estimated to be greater than 100,000,000,000,000 and we are unable to represent the number with type int, then we can use one of the floating point types.

◕ Floating Point Types

There are three floating point types: float, double, and long double.
In general float is 32 bits, double is 64 bits, and long double is 80, 96, or 128 bits.

All these floating point types has the following things:
- Significant figures which floating point types can represent.
- The minimum allowable range of exponents.

▨ Significant figures:
Significant figures are the meaningful digits in a number.

The population of India is almost 125 crore.
Here the number has 3 significant figures.

Another example:
If we write the length of a wire as 100.25 meters.
Then the number of the significant figures will be 5.

Please note that:
The number of significant figures does not depend on the location of the decimal point.

▨ Allowable range of exponents:
The range of exponents for all three floating point types are at least from –37 to +37.

Related articles:
Why floating point numbers are called floating point numbers?
Floating points numbers
Different way to write Floating-Point Numbers in C++
Floating Point Constants
climits in C++
sizeof Operator in C++
Bits & Bytes
Integer Type in C++
Signed char and Unsigned char in C++
Rules for Variable Names
Variable in C++
Fundamental Data Types & Compound Data Types

Popular Google Pages:

Top of the page

Amazon & Flipkart Special Products


Top of the page