|
|
|
|
|
by JonChesterfield
1048 days ago
|
|
It's a slight tangent, but in the general realm of division being complicated, divide by zero is a longstanding annoyance. Does anyone know (or can refer to) a reasonable definition of +,-,*,/,% (in their usual meanings) on rational numbers such that A op B always evaluates to a rational? A/1 divide 0/1 being stored as 1/0 and then propagated around seems reasonable but I keep putting off the bookwork of finding out what arithmetic relations still hold at that point. I think one loses multiply by zero folding to zero, for example A * 0 is now only 0 for A known to have non-zero denominator. Context is a language with arbitrary precision rationals as the number type, and all I'm really looking for is a way to declare that the type of division is a rational for any rational arguments. Searching for this mostly turns up results on the naturals or integers which I'm not particularly interested in. Long shot but worth asking. Thanks |
|
Given the usual definition of multiplication (and division as its inverse), this is not possible:
Assume some multiplicative inverse 0⁻¹ of 0 exists. Then, writing · for multiplication, since
a·0 = b·0
for all rational a and b, we have
a·0·0⁻¹ = b·0·0⁻¹
and therefore
a = b
for all rational a and b, which is absurd.