# Different way to write Floating-Point Numbers in C++

## C++

Popular Google Pages:

◕ Send a story and get ₹ 200/- More..

◕ Bengali Story writing competition. More..

◕ This article is regarding

**
Different way to write Floating-Point Numbers in C++.**

What is E notation in C++?

Different way to write E notation in C++.

Last updated on: 31th December 2016.

◕ Different way to write Floating-Point Numbers in C++

C++ has two ways to write floating-point numbers.

▨ **1st**

The standard decimal-point notation which we have been using in our daily life.

Example:

21.21 is a floating-point number.

99999.22 is a floating-point number.

0.000009 is a floating-point number.

1.0 is a floating-point number.

Please note:

1.0 is a floating point number. Here the fractional part is 0.

But still we have to write the decimal point which ensures that the number is represented in floating-point format and not as an integer.

▨ **2nd**

We can represent floating-point values with **E notation.**

**E notation** guarantees that a number is stored in floating-point format in a program, even if no decimal point is used.

E notation is most useful for very large and very small numbers.

Example of **E notation:**

3.142E5

The above number means that the value 3.142 should multiplied by 100000.

The E5 means 10 to the power 5, which is 1 followed by 5 zeros.

Thus 3.142E5 means 314200.

Here 5 is called an **Exponent** and the 3.142 is called **Mantissa.**

◕ Some important examples of **E notation** are give bellow:

1.23e+8

We can use E or e. Both are the same meaning.

The + sigh on the exponent is optional.

1.234E-4

The exponent can be negative.

Negative exponent means to divide the number by the power of 10 instead of multiplying.

Here the result will be **1.234 / 10000.**

E notation guarantees that a number is stored in floating-point format in a program, even if no decimal point is used.

6E7

This is same as 6.0E+07.

-12.34e5

We can have + or - sign in front of a floating-point number.

Here the result will be **-12.34 x 100000.**

E notation is most useful for very large numbers.

5.98E24

This is the mass of earth in kilograms.

E notation is most useful for very small numbers.

9.11e-31

This is the mass of an electron in kilograms.

1.2 E6

This is invalid.

Because spaces are not allowed in a floating-point number.

Related articles:

What is char16_t and char32_t in C++?

Integer Type in C++

Rules for Variable Names

Variable in C++

Fundamental Data Types & Compound Data Types

What is called Directive and Header File in C++ ?

What is Block Statement in C++ ?

Top of the page

# Amazon & Flipkart Special Products

Top of the page