Answer the question
In order to leave comments, you need to log in
Multiplication
Tell me why it turns out like this:
50,000 or 90 or 90,000 ...
>>> 50.0 * 1.1
55.000000000000007
>>> 50.0 * 1. + 50.0 * .1
55.0
Answer the question
In order to leave comments, you need to log in
Because floating point numbers are represented in a computer in an "approximate" form.
en.wikipedia.org/wiki/%D0%A7%D0%B8%D1%81%D0%BB%D0%BE_%D1%81_%D0%BF%D0%BB%D0%B0%D0%B2%D0 %B0%D1%8E%D1%89%D0%B5%D0%B9_%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%BE%D0%B9
This happens because not every number that can be represented by a finite decimal fraction can be represented by a finite binary fraction. An error is obtained when this infinite binary fraction is stored in a mantissa of finite length.
For example, 0.3_10 = 0.010011001100110011..._2 = 0.01(0011)_2 is an infinite periodic binary fraction.
0.0100110011001100110011_2 = 0.2999999523162841796875_10
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question