I understand that floating-point numbers have limitations so this can be expected:
>>> 0.1 + 0.2 == 0.3 False
But why is this so? Can computers not store 0.45, 0.55 reliably or correctly?
>>> 0.45 + 0.55 == 1.00 True
I want to know how in the first case the computer was unable to correct its inaccuracy, but in a later version.
As you know, most decimal numbers cannot be stored exactly. This is true for all of your above numbers except 1.0.
1.0
. 0.3 . , .
0.3
0.1 + 0.2, , 0.3. "" .
0.1 + 0.2
, 0.1 0.2 . , , - 0.30000000000000004.
0.1
0.2
0.30000000000000004
0.45 + 0.55 .
0.45 + 0.55
Source: https://habr.com/ru/post/1681010/More articles:A multi-threaded Python script takes more than a non-threaded script - pythonWhat is the difference between updated hook and watchers in VueJS? - vue.jsНевозможно Inter-Lock между процессами при использовании модуля многопроцессорности в Python - pythonvuejs2 and the selected choice problem - vue.jsI want to compare leaf duration date with current date in odoo python - pythonhow to implement Exactly one time Spark Streaming + Kafka Integration - apache-sparkFixed width of child decreases in flexbox - htmlWhere to save the Android database? - androidandroid: указанный ребенок уже имеет родителя. Вы должны вызвать removeView() - androidWhy does iter borrow mutably when used in a security template? - rustAll Articles