-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
mathsMathematical functionsMathematical functions
Description
Based on the discussion in #37931, I have found that pi == one(pi)*pi is broken. However, it should hold according to the documentation of one() function:
one(x)
one(T::type)
Return a multiplicative identity for `x`: a value such that
`one(x)*x == x*one(x) == x`. Alternatively `one(T)` can
take a type `T`, in which case `one` returns a multiplicative
identity for any `x` of type `T`.
If possible, `one(x)` returns a value of the same type as `x`,
and `one(T)` returns a value of type `T`. However, this may
not be the case for types representing dimensionful quantities
(e.g. time in days), since the multiplicative
identity must be dimensionless. In that case, `one(x)`
should return an identity value of the same precision
(and shape, for matrices) as `x`.
...Don't know if you prefer fixing the implementation or just updating the documentation to make it consistent. Notice that since one(pi) already returns true, it would be possible to make true * pi === pi.
Metadata
Metadata
Assignees
Labels
mathsMathematical functionsMathematical functions