Home   |   About   |   Terms   |   Contact    
Read & Learn
 

Why floating point numbers are called floating point numbers?

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



◕ This article is regarding Why floating point numbers are called floating point numbers?
Last updated on: .




◕ Why floating point numbers are called floating point numbers?

With floating-point types, we can represent the numbers such as 1.5 and 3.142 and 565656.56 etc.
This means the numbers with a fractional part.



A computer stores such values in two parts.
One part represents the base value, and the other part scales that value up or down.



Look at the analogy:
Consider the two numbers 12.34567 and 1234.567.
Both are identical except the decimal points.

We can represent the first number as 0.1234567 (the base value) and 100 (the scaling factor).
Same as, we can represent the second number as 0.1234567 (the same base value) and 10000 (the scaling factor).

Here the scaling factor serves to move the decimal point, hence the term floating-point.



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++ ?


Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page