mozilla/rust — pull request #11664 by bjz (2014-01-19 09:14:49+00:00)
Title: Make std::num::{Zero, One} more restrictive and clean up std::num::pow implementation

`Zero` and `One` have precise definitions in mathematics as the identities of the `Add` and `Mul` operations respectively. As such, types that implement these identities are now also required to implement their respective operator traits. Usages of `#[deriving(Zero)]` could break under these new rules, but this is probably a sign that they should have been using `#[deriving(Default)]` in the first place.

For more information regarding the mathematical definitions of the additive and multiplicative identities, see the following Wikipedia articles:

- http://wikipedia.org/wiki/Additive_identity
- http://wikipedia.org/wiki/Multiplicative_identity

The `Zero::is_zero` predicate has been removed. This seemed to be of little utility and was only rarely used throughout the repository. `Float::is_zero` was then added to allow for testing for ±0.0 floating point values.

The implementation of `std::num::pow` has also been made more succinct and no longer requires `Clone`. The coverage of associated unit test has also been widened to test more combinations of bases, exponents and expected results.