Open benruijl opened 5 years ago
After some thought on this, I consider the current implementation to be correct.
The most obvious reason is that x.is_zero()
should be true if and only if x == T::zero()
. The methods of the Zero
trait are reflexive.
Furthermore, for a multidimensional value such as with dual/hyperdual numbers, .is_zero()
could be interpreted to mean it has a total magnitude of zero, for which the current implementation should also be sufficient.
It's simple enough to do x.real().is_zero()
only when necessary.
I think
is_zero
should only check the real part instead of all the components: