implementation of scala Rationals