Add rational typecaster

fixes #3