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

Q1:

Q2:

Solution:

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.

--

--

No responses yet