Numbers.Helper (numbers v5.2.4)

Helper functions that might make the implementation of Numbers for your own numberlike types easier.

Link to this section Summary

Functions

Performs 'Exponentiation by Squaring', which is a reasonably fast algorithm to compute integer powers, by performing log(n) multiplication steps.

Link to this section Functions

Link to this function

pow_by_sq(num, integer_power)

Performs 'Exponentiation by Squaring', which is a reasonably fast algorithm to compute integer powers, by performing log(n) multiplication steps.

Depends on an implementation existing of Numbers.Protocols.Multiplication, as well as (to support negative powers) an implementation of Numbers.Protocols.Division.