Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Floating Point Constants

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



◕ This article is regarding
Floating Point Constants
Ways to write floating point constant
Example to write floating point constant.

Last updated on: .



◕ Floating Point Constants.

There are three floating point types:
float
double
long double.


We can use floating point number as constant.
By default, floating point constants are Type double.



◕ We can write floating point constants in two ways:
- If we want a constant to be type float, we have to use a f or F suffix.
- For Type long double, we have to use L suffix.



◕ The examples are given bellow:

float india = 1.234f;
This is a float constant.



float india = 1.2345E12F;
This is a float constant.



float india = 1.23456E32;
This is a double constant.



float india = 9.9L;
This is a long double constant.



Related articles:
Why floating point numbers are called floating point numbers?
Floating points numbers
Different way to write Floating-Point Numbers in C++
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