3 ms·
Another language that supports this is Julia: In Julia, `/` is division, but `//` creates a rational number. Thus, in Julia, `1//10 + 2//10 - 3//10 == 0//1`, an
by Derbasti 12y ago
Another language that supports this is Julia: In Julia, `/` is division, but `//` creates a rational number. Thus, in Julia, `1//10 + 2//10 - 3//10 == 0//1`, and `1 / (1//10 + 2//10 - 3//10) == 1//0`, where `isinf(1//0) == true` and `0//1 == 0`.
But the best thing is that because of Julia's type system, every subsequent operation on rationals will happen rationally as well, including (fast) linear algebra. Obviously this excludes things like `sqrt` or `fft`.
(http://docs.julialang.org/en/release-0.3/manual/complex-and-rational-numbers/#rational-numbers http://docs.julialang.org/en/release-0.3/manual/complex-and-...)
- cnvogel 12y ago> Another language that supports this is Julia: As does, for example, scheme (tests done in racket). > (- (+ (/ 1 10) (/ 2 10)) (/ 3 10)) 0 > (= (- (+ (/ 1 10) (/ 2 10)) (/ 3 10)) 0) #t