5 ms·
Shouldn't this be called either "arbitrary size integers" or "arbitrary precision integer arithmetic"? Integers by definition already have infinite precision..
by falcrist 8y ago
Shouldn't this be called either "arbitrary size integers" or "arbitrary precision integer arithmetic"?
Integers by definition already have infinite precision...
- olliej 8y agoDomain terminology - integer on a computer means fixed precision. BigInt is for whatever reason the most common name used
- falcrist 8y agoInteger in all programming languages I've seen so far means infinite precision with limited range. Floating point numbers are used for values that have finite precision but typically much larger range. I guess I'm making a distinction between precision and range. I was pretty sure they couldn't be used interchangeably. Now I'm seeing "precision" being used to describe the size of the integer. I feel like that's a bit of a misnomer.
- rocqua 8y agoJavascript 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
- black-tea 8y agoArbitrary precision is the correct terminology. I can already represent any size integer I want on any computer. I could just declare that MAXINT represents Graham's number (for example). That doesn't mean that I can represent every integer between zero and Graham's number, though.
- slivym 8y agoBut it's not the precision that's arbitrary it's the range. If your number format represents 0-100 and you want to represent 200 then your number format isn't imprecise, it's limited range.
- black-tea 8y agoThe "range" is merely established by convention. If your computer supports 100 distinct values then you could say those values represent the integers [0,100) or you could say they represent the even integers in [0,200). The range can be arbitrarily large, but the precision is fixed.