3 ms·
> insane choice of making floats its only and default number type Javascript math on integers within +/- 10^20ish produces integers and works as expected. It'
by ajross 7y ago
> insane choice of making floats its only and default number type
Javascript math on integers within +/- 10^20ish produces integers and works as expected. It's true that division produces a fraction, so if you're expecting 2's complement integer truncation (absolutely the kind of "funny math" that users in this context are expected to hate) you won't get it.
I don't see this as such a terrible design choice. The alternative is python's equally crazy menagerie of almost-but-not-quite-hidden numeric types waiting to bite you in unexpected ways.
- dragonwriter 7y ago> The alternative is python's equally crazy menagerie of almost-but-not-quite-hidden numeric types waiting to bite you in unexpected ways. No, it's not. Python and JS aren't the only two approaches to numbers, even among dynamic languages (Schemes numeric tower, which favors exact types, is another.)
- eropple 7y agoThe alternative is static types.