A systematic implementation of different kinds of numbers with a consistent interface