3 ms·
> at least the outcome of integer maths is always defined. Assuming you mean “integer arithmetic”, the answer is a resounding yes, it's well-defined. Of course
by catnaroek 9y ago
> at least the outcome of integer maths is always defined.
Assuming you mean “integer arithmetic”, the answer is a resounding yes, it's well-defined. Of course, so-called “machine integers” are not a faithful model of the integers, and, in particular, so-called “signed integers” in C aren't a faithful model of anything nice.
- fanf2 9y agoWhat is the result of INT_MIN / -1 ?
- catnaroek 9y agoThere was a point to using “so-called” and scare quotes around “signed integers”. Find it. Hint: There's no such thing as a “minimum integer”.
- mcphage 9y ago> Assuming you mean “integer arithmetic”, the answer is a resounding yes, it's well-defined. Given that the topic of this article was falsehoods about programming—no, the author did not mean "integer arithmetic". However, even in the case of mathematics, this isn't true—there are a lot of non-standard models of arithmetic, and which you choose depends on what you're trying to do with it: https://en.wikipedia.org/wiki/Non-standard_model_of_arithmetic https://en.wikipedia.org/wiki/Non-standard_model_of_arithmet...
- catnaroek 9y ago> However, even in the case of mathematics, this isn't true—there are a lot of non-standard models of arithmetic Believe it or not, there are people who use actual integers in computer programming. Not everyone is stuck with C and its ilk. > However, even in the case of mathematics, this isn't true—there are a lot of non-standard models of arithmetic Meaning is to be found in the axioms themselves, not in models.
- mcphage 9y ago> Meaning is to be found in the axioms themselves, not in models. Yep, and all of them are incomplete.
- catnaroek 9y agohttps://en.wikipedia.org/wiki/True_arithmetic https://en.wikipedia.org/wiki/True_arithmetic would like to have a word with you. (Of course, it's not recursively axiomatizable.)
- mcphage 9y ago> Of course, it's not recursively axiomatizable. Then again, who is these days?
- catnaroek 9y ago> Then again, who is these days? I have no idea what you mean by “who”. In any case, let's trace the conversation back to the original topic: (0) Integer arithmetic is well-defined. Nonstandard models of arithmetic are just that - models. The well-definedness of a theory doesn't depend on the existence of a unique model. (1) The fact you're programming a computer doesn't magically change the properties of the integers. It is even possible to have a data type for integers! (Not in C, though.)