3 ms·
Javascript actually uses floats to describe integers, so with very large integers, you actually lose precision. This does 2 things. It allows for arbitrary siz
by rocqua 8y ago
Javascript actually uses floats to describe integers, so with very large integers, you actually lose precision.
This does 2 things. It allows for arbitrary size integers (whereas before, javascript had integers up to FLOAT.MAX), and it represents all these integers with perfect precison.
- falcrist 8y agoAs someone mostly stuck in the C, C++, C#, assembly, and BASIC, this is new to me. In those languages, an integer is actually infinite precision with limited range. A quick Google shows that the "number" primitive in JavaScript is a double. Are you telling me JavaScript has NO integer type? Maybe I haven't seen enough languages yet, but that seems pretty crazy to me.
- rocqua 8y agoI agree with you on all points. I don't think I've ever written more than 100 lines of javascript. And a lot more of the C like stuf. Yet, I do see the morbid sense in only using floats.
- colejohnson66 8y agoNo you’re right. There is no integer-like type in Javascript. Only floating point