toasteecup@lemmy.worldtoProgramming@programming.dev•Why is 0.1 + 0.2 returns 0.30000000000000004 in JavaScript?English
17·
2 days agoPython has no issues representing
1/3 + 1/3 + 1/3
as 1. I just opened a python interpreter, imported absolutely no libraries and typed
1/3 + 1/3 + 1/3
enter and got 1 as the result. Seems like if python could do that, JavaScript should be able to as well.
I’ll pass on the js interpreter. I don’t feel like learning the arcane runes.
To your point, Python handles those by giving you 0.300000004 might have missed a zero but valid point nonetheless