Note: coming up with a good definition of what should happen on infinite values is not always easy. I note that lteq is not commutative, but add and mul are maybe that is relevant. There might or might not be a general pattern to whether or not it's beneficial to adopt a convention of handling left-hand-side infinities before right-hand-side infinities or vice versa I can't tell without trying it out, but for less-than-or-equal ( lteq) I think it's simpler to look at right-hand-side infinity first. It's probably simplest if you handle the infinite cases first, then reuse the existing operations on finite values of the original type.
If you want to add arithmetic operations, decide what they should do, then implement that. I'm using null to represent infinity here, since that seems the most straightforward in Java.
#Infinity number plus
The idea is to create a new type which has all the same values as some already existing type, plus one special value which-as far as you can tell through public methods-acts exactly the way you want infinity to act, e.g. I hope the ideas are clear but let me spell them out anyways. I'll leave it to you to translate this to exact Java syntax. Return this.getFinite().lteq(that.getFinite()) If T is a type for which lteq is defined, you can define InfiniteOr with lteq something like this: class InfiniteOr with type parameter T: It may be more involved, but it has the advantage of working for any type that doesn't define its own infinity. A generic solution is to introduce a new type.