Steven D'Aprano <[email protected]> added the comment:
It looks like Python is correct and the other languages may be just truncating
the output.
In the Lua interpreter:
> =277*0.1
27.7
> = 277*0.1 == 27.7
false
Perl:
$ perl -e "use feature qw(say); say 277*0.1"
27.7
$ perl -e "use feature qw(say); if (277*0.1 != 27.7) {say 'unequal'}"
unequal
In Ruby:
irb(main):001:0> 277*0.1
=> 27.7
irb(main):002:0> 277*0.1 == 27.7
=> false
Julia agrees with Python:
julia> 277*0.1
27.700000000000003
So does the Rhino javascript interpreter:
js> 277*0.1
27.700000000000003
I think Eric's instinct was correct.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42148>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com