Skip to main content

Module num

Module num 

Source
Expand description

Traits for abstracting over numeric types.

These traits describe various numeric properties and operations. They are similar in purpose to the immensely helpful traits in num-traits, but the structure is different. The philosophy behind this module is to focus on capabilities, rather than categories, and to assume as little as possible. Within reason.

Instead of having large traits with a lot of methods and dependencies, each operation (or group of operations), are separated into their own traits. This allows number types to have partial compatibility by only implementing some of the traits, and new methods can be added as new traits without affecting old functionality.

Traitsยง

One
Methods for the value 1.
Powf
Method for raising a number by a real number exponent.
Powi
Method for raising a number by a signed integer exponent.
Powu
Method for raising a number by a n unsigned integer exponent.
Recip
Method for calculating 1 / x.