Java generic arithmetic
问题 I'm trying to create some Java classes, that should work with either float or double numbers (for simulation purposes I am required to support both). The classes need to do some basic arithmetic and also require use of trigonometric functions (sin, cos, atan2). I tried to do a generic approach. As Java does not allow primitive types in generics and MyClass<T extends Number> does indeed allow Double and Float, but makes basic arithmetic impossible, I build a wrapper class around Double and