How Computers Deal With Floating Point Numbers?

IEEE 754 ➜ Standard computers use to represent the floating points

Ex: Let us take 9.1 and convert to IEEE standard.

Vice versa;

Floating point rounding error in computer with an example

Questions and solutions




Solutions for floating-point error

  1. Use Appropriate data types.

(Java Developer ➜ Big Decimal)

2. If you have currency, can store minimal places.

ex: Let us say you get;

99 cents ➜ 1 dollar

99 dollars➜ 199 cents

When you present it back, can divide this by 100 and get the real value.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store