4 ms·
division is not defined on the set of integers, you only have modular arithmetic.
by Avshalom 9y ago
division is not defined on the set of integers, you only have modular arithmetic.
- instruction-ptr 9y agoSee section 7 of http://www.cs.cmu.edu/~15122/handouts/02-ints.pdf http://www.cs.cmu.edu/~15122/handouts/02-ints.pdf (As an aside nearly every language defines division on the set of integers this way so it’s not even like we’re making this up)
- jameshart 9y agodivision is also not defined on the set of IEEE binary floating point numbers, you only have (well-defined) rounding. For that matter, addition and subtraction aren't defined on the range of fixed-bit-width integers.
- recursive 9y agoIt is defined and you can do it in C without using floats. On the other hand, even if you do use floats, arbitrary arithmetic is not invertible. In other words a / b * b isn't necessarily a, regardless of what types they are.
- baby 9y agoWhat do you mean division is not defined on the set of integers? Mathematically or programmatically? Because yes you have euclidean divisions which are divisions for the integers.