Floating Point Numbers: A Few Ideas

Floating Point Numbers: A Few Ideas

A number containing one fractional (this is the post-decimal part of a number) part where there are no limitations on the no. of digits after the decimal point is known to be a floating point number.

A few examples are -25.52, 15.567845321, 3.0 etc.

Why is there a reference to the term “floating point”?

It’s a commonly known fact that the number of digits before and after a decimal point is not fixed. Hence, the decimal point is referred to as one that FLOATS among the digits. Thus, came the name “floating point.”

A simple example for the sake of explanation is taken as the number 12.34. The number in our example is a floating point number. The number 0012.3400 is same as that of 12.34. The number of digits before and after a decimal point has increased, but the equality stayed intact.

Important point to be noted-

Most floating point numbers represented on computers are mere approximations. Hence, the main goal of programmers is to get a “reasonably correct result” by using these approximate numbers in a calculation.

Are floating point numbers required?

The computer memory is limited, and hence, it becomes extremely difficult to store numbers in computers with limitless precision. The use of binary fractions or decimals doesn’t matter. There will certainly be a limit on the number of digits at some particular point. Thus, a certain degree of inaccuracy remains on specific calculations. Let’s go through these 3 cases:

  • Say, for example, an engineer’s assigned a construction project (construction of a highway). In this case, if the measurement in lengths or widths gets slightly altered by mistake or by misjudgment, it wouldn’t matter much. For example, if the width of the highway is taken as 20.01m instead of 20m, it wouldn’t matter a thing. A relative accuracy is accepted in this case.
  • A circuit designer’s involved in designing microchips. In this case, a simple 0.0001m (one-tenth of a mm) is a huge difference.
  • A physicist is involved in a calculation that requires the values of the speed of light (3.00×10^8 m/s approx.) and Newton’s Gravitational constant (6.674×10^−11 N⋅m2/kg approx.).

 In the case of the engineer and the designer, a specific number format is needed that can bring accuracy at different magnitudes (higher or lower). The higher magnitude will be suitable for the engineer. The lower will be suitable for the designer. But in the case of the physicist, the calculation would involve numbers at both magnitudes of the number line.

Thus, it can be concluded from the cases above that a fixed amount of fractional digits, as well as integers, isn’t always useful. The only solution is a format where floating point numbers are used. Thus, we’ll be able to remove the limitation of the number of digits before and after a decimal point.

Working of Floating Point Numbers

A number is composed of two parts by floating point numbers:

  1. Significand- Significand contains the important digits of a number. Negative significands are used to represent negative numbers.
  2. Exponent- In the case of floating point numbers, the exponent is considered to be the power of base (10). Negative exponents are used to represent numbers that are very close to 0. The exponent can be represented with the inclusion of base, or it can just be written with an “E” to separate it from the significand.

Remember that the decimal point should be placed between the 1st and the 2nd digit of a significand in floating point numbers.

untitled

The above format can be used to:

  • Depict several numbers at extremely different magnitudes.
  • Provide a same relative accuracy at almost all magnitudes.
  • Provide a relative accuracy when there are calculations across different magnitude numbers.

Floating point numbers do also have a disadvantage. They consume more system storage space than fixed digit numbers. The reason is pretty obvious. They consume more space to accommodate a large number of digits before or after (or both) a decimal point. With that, we’ll sign off for now. Hope you had a good read.

Sudipto Das

Sudipto writes technical and educational content periodically for wizert.com and backs it up with extensive research and relevant examples. He's an avid reader and a tech enthusiast at the same time with a little bit of “Arsenal Football Club” thrown in as well. He's got a B.Tech in Electronics and Instrumentation.
Follow him on twitter @SudiptoDas1993

Leave a Comment

Your email address will not be published. Required fields are marked *