3 ms·
> I haven't yet encountered a language which solves this issue: Well, Python supports arbitrary precision integers. And some other niche languages (Sail is one
by IshKebab 2y ago
> I haven't yet encountered a language which solves this issue:
Well, Python supports arbitrary precision integers. And some other niche languages (Sail is one I know).
I don't think "running out of memory" counts as a caveat because it still won't give the wrong answer.
For floats, I don't think it's actually unreasonable to use different operators there. I vaguely recall some languages use +. or .+ or something for float addition.
Fair point about wrapping.
- tmtvl 2y ago> Well, Python supports arbitrary precision integers. And some other niche languages (Sail is one I know). As a Lisper, I very carefully chose an example to account for arbitrary-precision integers (so X + X where X is, say, 8^8^8^8 (remember, exponentiation is right-associative, 8^8^8^8 = 8^(8^(8^8)))). > I don't think "running out of memory" counts as a caveat because it still won't give the wrong answer. Being pedantic, it doesn't give the _correct_ answer either, because in mathematics 'ran out of memory' is not the correct answer for any addition.
- IshKebab 2y agoRight, but you can never guarantee giving the correct answer. What if someone unplugs the power mid-computation? That's basically where running out of memory is (for a modern desktop system anyway). The best you do is "not the wrong answer".