peon/src/peon/stdlib/math.pn

16 lines
292 B
Plaintext

## Peon's math module
import std;
const pi* = 3.141592653589793;
const e* = 2.718281828459045;
const tau* = 6.283185307179586;
fn abs*[T: int64 | int32 | int16 | int8](n: T): T {
## Returns the absolute value of the given number
if n < 0 {
return -n;
}
return n;
}