The expression
(2/6)^5 == 2^5 / 6^5
is false? This language is intended to be good at Math. Ruby and Python both evaluated it to true.
version 1.4.1
Standard floating-point behavior. Python3:
>>> (2/6)**5
0.004115226337448558
>>> 2**5 / 6**5
0.00411522633744856
>>>
Julia:
julia> (2/6)^5
0.004115226337448558
julia> 2^5 / 6^5
0.00411522633744856
In Python2 and Ruby they're equal because both sides are zero since /
does integer division.
Use rationals:
julia> (2//6)^5 == 2^5 // 6^5
true
Most helpful comment
Use rationals: