...Why fractions? Are there any practical applications where having fractions would outweigh the performance loss?
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot The height of cleverness is to be able to conceal it.
- Francois de La Rochefoucauld
maybe some sort of pathological "divergent" calculations where rounding errors accumulate... I'm not sure if there actually are such applications, this is "for fun only" doodle.
p.s.: I am going to add neat trick with primes that would make this class getting faster and faster at runtime..
the idea was this: if we keep static list of sequential primes, and divide by every number in the list (rather than every number i existance), and then by all numbers greater than the list's max, until some k divides our numerator/denominator without reminder, then this k must be a prime (since otherwise something less than k would do it)... so I thought I could add this k to primes list every time, and so this list would grow, leading to faster computations after some time; however, we cant add k to the list, because we don't know if there were primes less than k but greater than list's max so, no magic trick for you, sorry.