It would be an interesting exercise to have a number class that could store numerator and denominator. Just so
new MyNumber(1).over( new MyNumber(3) ).times( new MyNumber(3) ).equals( new MyNumber(1) )
or maybe
new MyNumber(1, 3).times( 3 ).equals( 1 );
What would you do about that 3.4 and 4.5 in the original post?
new MyNumber( new MyNumber(34, 10), new MyNumber(45, 10) )
Ok, it doesn't look like that much fun after all.
There are languages that maintain numbers like that. Anybody ever use one?