Multiplication

Tell me why this is so:

>>> 50.0 * 1.1<br> 55.000000000000007<br> >>> 50.0 * 1. + 50.0 * .1<br> 55.0

50000 90000 or 90 or...
October 8th 19 at 00:37
3 answers
October 8th 19 at 00:39
If you need accuracy, use a fixed point depending on the system the types are fixed, money, currency - ebony.Brown79 commented on October 8th 19 at 00:42
What is the approximate number I understand you tell me why exactly 50 and 90, but there is no rest at 70 for example?
And what minusovat? This is a section of Q&A! - Broderick_Shanahan commented on October 8th 19 at 00:45
it's the number depends on how it fits into the idea
I did not minusovat, but most likely for not using search. - ebony.Brown79 commented on October 8th 19 at 00:48
October 8th 19 at 00:41
October 8th 19 at 00:43
So because not every number is representable by a finite decimal, finite representable binary fraction. The error you get is when that infinite binary fraction retain in the mantissa of a finite length.

For example, 0.3_10 = 0.010011001100110011..._2 = 0.01(0011)_2 — an infinite periodic binary fraction.

0.0100110011001100110011_2 = 0.2999999523162841796875_10

Find more questions by tags ProgrammingMathematics