measuremancer/math_utils

Search:
Group by:
Source   Edit  

Procs

proc power[T](x: T; num: SomeInteger): T
Source   Edit  

Macros

macro power(x: typed; num: static int): untyped

general purpose power using ^ for integers, which works for any type by rewriting to a product of *.

For the special cases of -1, 0, 1 we simply rewrite to the correct result. Negative powers are written as 1 / x^p

Source   Edit