Ask Your Question

Revision history [back]

You can have a look at https://floating-point-gui.de/

The reason is that floating-point numbers are multiple of a (negative) power of 2, and since 0.2=1/5, it can not be represented exactly.

Actually, none of 14 * 1.2 nor 16.8 are exact, but the cancellation in the sum luckilly leads to zero, so the correct result results from two errors, see:

sage: a = 16.8
sage: a.exact_rational()
4728779608739021/281474976710656
sage: a.sign_mantissa_exponent()
(1, 4728779608739021, -48)

You can have a look at https://floating-point-gui.de/

The reason is that floating-point numbers are multiple of a (negative) power of 2, and since 0.2=1/5, $0.2=1/5$, it can not be represented exactly.exactly (the equality $1/5 = k/2^m$ has no integer solution in $k$ and $m$).

Actually, none of 14 * 1.2 nor 16.8 are exact, but the cancellation in the sum luckilly leads to zero, so the correct result results from two errors, see:

sage: a = 16.8
sage: a.exact_rational()
4728779608739021/281474976710656
sage: a.sign_mantissa_exponent()
(1, 4728779608739021, -48)

You can have a look at https://floating-point-gui.de/

The reason is that floating-point numbers are multiple of a (negative) power of 2, and since $0.2=1/5$, it can not be represented exactly (the equality $1/5 = k/2^m$ m/2^e$ has no integer solution in $k$ $m$ and $m$).$a$).

Actually, none of 14 * 1.2 nor 16.8 are exact, but the cancellation in the sum luckilly leads to zero, so the correct result results from two errors, see:

sage: a = 16.8
sage: a.exact_rational()
4728779608739021/281474976710656
sage: a.sign_mantissa_exponent()
(1, 4728779608739021, -48)

You can have a look at https://floating-point-gui.de/

The reason is that floating-point numbers are multiple of a (negative) power of 2, and since $0.2=1/5$, it can not be represented exactly (the equality $1/5 = m/2^e$ has no integer solution in $m$ and $a$).$e$).

Actually, none of 14 * 1.2 nor 16.8 are exact, but the cancellation in the sum luckilly leads to zero, so the correct result results from two errors, see:

sage: a = 16.8
sage: a.exact_rational()
4728779608739021/281474976710656
sage: a.sign_mantissa_exponent()
(1, 4728779608739021, -48)