This is potentially horrendous for performance, and even worse, unpredictably so. Instead of getting the incorrect answer (or NaN) with floating point if you have an unfortunate series of calculations, you get extreme memory blowup, where your numerator and denominator can explode in size, which in turn leads to runtime slowdown. In the worst case you can actually run out of memory (because certain fairly natural calculations can cause your numerators and denominators to very rapidly explode in size).
Committing to unbounded rationals basically opens your system up to DoS attacks.
You could decide to bound rationals in the numerator and denominator, but then you've more or less reinvented a form of floating point.
In order of preference for a high reliability production system I would use:
1. Integers
2. Fixed point
3. Floating point
4. Rationals [waaaayyyy down in fourth place]
Most systems don't have high enough reliability needs though that I would favor fixed point over floating point and so in practice I rarely use fixed point (simply because library and language support is far worse).
Most people versed in fixed point (microcontroller programmers, Forth programmers) will use rationals at decent speeds because they know all the tricks for performance, kinda like HAKMEM algos applied to Forth instead of a PDP10 (and OFC the Forth Scientific Library).
I don't see anywhere in HAKMEM where they advocate for the use of unbounded rational numbers.
Do you have any examples of unbounded rational numbers used in a microcontroller program, in a production Forth program, or really in any production user-facing codebase?
I ask specifically for unbounded rational numbers because again bounded rational numbers are effectively equivalent to floating point and fixed denominator rational numbers are equivalent to fixed point.
Committing to unbounded rationals basically opens your system up to DoS attacks.
You could decide to bound rationals in the numerator and denominator, but then you've more or less reinvented a form of floating point.
In order of preference for a high reliability production system I would use:
1. Integers
2. Fixed point
3. Floating point
4. Rationals [waaaayyyy down in fourth place]
Most systems don't have high enough reliability needs though that I would favor fixed point over floating point and so in practice I rarely use fixed point (simply because library and language support is far worse).