What do you think about extracting math functions from Float into a different traits. Currently Float is pretty big and most of functions implemented there is just implementation of cmath. Also, according to doc, some of them has different meaning than “pure math” equivalents (signum or is_positive/negative).
Also it will provide way to utilize some of functions between Int and Float (i. e. there is no max/min implementation for Int).
As addition I would think about using Float as base for trigonometric functions. IMHO all languages do this that way and all of them do it wrong. There should be Angle enum that looks like:
enum Angle<T> {
Rad(T),
Deg(T),
Grad(T)
}
With respectful method implemented on them. This will remove ambiguity on measurement units.
Also we should think about adding Num trait that will implement shared methods between Float and Int like:
-
min/max
zero
one
-
min/max_value
signum
-
is_positive/negative
It could be helpful (especially when we rethink some other traits relations) when implementing, i.e. interval arithmetic, complex numbers and other algebraic oddities that has similar properties as numbers.