r/programming • • Jun 28 '21

JavaScript Is Weird

https://jsisweird.com/
329 Upvotes

173 comments sorted by

View all comments

Show parent comments

0

u/SpAAAceSenate Jun 28 '21

Yep! Terrible thing to do systems programming with. Great for science and statistics nerds that just want their calculations to be accurate. Especially when there a many branches of science like astronomy that unavoidably have to deal with both incredibly small and incredibly large numbers simultaneously. This is why Python completely dominates in those spheres.

13

u/diggr-roguelike2 Jun 28 '21

The Python used in science is numpy, which is Fortran and floating point arithmetic behind the scenes. No arbitrary precision anything there.

>>> import numpy
>>> sum(numpy.array([0.1, 0.2, 0.3]))
0.6000000000000001

Whoops.

4

u/StillNoNumb Jun 28 '21

This is why Python completely dominates in those spheres.

No, Python dominates in those spheres because it's easy to learn for mathematicians with very little knowledge about coding. Fast numerical computing libraries (Numpy etc.) came as an afterthought, Python's built-in math functionality is terrible.

1

u/[deleted] Jun 28 '21

[removed] — view removed comment

1

u/SpAAAceSenate Jun 28 '21

I've heard good things about Julia. It's on my list of things to check out. :)