Why Computers Screw up doing Math on Floating Point Numbers

In computer Programming Floating point number represents Whole numbers that may be positive or negative with a Decimal Point.

Tue Apr 26, 2022

Computers Screw Up doing math…! Avuna Nijama…?

Well, Yes

We Human beings believe computers than Humans in doing math but Computer Screw up doing math when the complexity of math problem increases and with floating point numbers

Ok what really is a Floating Point number

In computer Programming Floating point number represents Whole numbers that may be positive or negative with a Decimal Point.

Eg 9.1 , 0.567 , -1.176 , -1.098 are floating point numbers.

Idantha Kaadu Point ki raa


Computers do math fairly good with Integers but but 

Where really is the problem with Floating point numbers we will find out why 

Generally, Humans do math in Base-10 or popularly Decimal Number system (0-9) while Computers do same math in Base-2 Binary Number system (0,1) 

Decimal Number System can’t process numbers such as 1/3 , 1/9 and we use something called Recursion similarly BNS can’t process numbers such as 1/10,2/10 but they do not understand recursion as a result they can’t do math as expected on those numbers. 

32 bit computers use 23 significant bits to store mantissa , 64 bit computers use 52 significant bits for mantissa and they can’t go to infinity for a number that is recursive.

 Does that above 0.30000000000004 matters 

 Well, depending on the situation for normal case it can be negligible but for something like bitcoins it is to be considered and must have a way to tackle it. 

 Generally, developers avoid using Float numbers in the programs to avoid above Rounding error or they preferably use formatting to do so.


FLM Team