I am surprised to receive seemingly incorrect results even with basic operations [...] How can this be?
The IEEE-754 binary floating-point numbers ( which Julia uses ) cannot represent numbers exactly, such as 0.05, 0.85, and 0.1.
, 0.05 Julia, , , , 0,05, 0,05. , , 0.05*0.05, 0,0025.
?
julia> 1-0.2-0.2-0.2-0.2-0.2
5.551115123125783e-17
julia> 0.6/0.2 == 3
false
( !),
. TeX.
?
? , , Julia , , .
, , Rational{Int64}, , 64- .
( ) :
julia> 1
1
julia> 1 - 17
1
, arbitrary-precision , Rational{BigInt} (. - )