Pyro

A scripting language for people who enjoy the simpler things in life.

Version 0.9.35

std::math


This module provides a Pyro interface to the C standard library's mathematical functions.

Constants

E: f64

Euler's constant.

I64_MAX: i64

The maximum allowable value of an i64, i.e. (2^63) - 1.

I64_MIN: i64

The minimum allowable value of an i64, i.e. -(2^63).

INF: f64

Floating-point positive infinity.

NAN: f64

Floating-point NaN (Not-A-Number).

PI: f64

The constant π.

Functions

abs(x: i64|f64) -> i64|f64
abs(x: i64|f64, i64_min: any) -> any

Returns the absolute value of x. The output type is the same as the input type.

Note that the absolute value of I64_MIN (i.e. the most negative integer) is undefined as the result cannot be represented as an i64. If you provide an optional i64_min argument, its value will be returned as a fallback in this case. Otherwise, the return value will be whatever integer is returned by the underlying C implementation — typically a negative value.

acos(x: i64|f64) -> f64

Returns the arc cosine of x in radians.

asin(x: i64|f64) -> f64

Returns the arc sine of x in radians.

atan(x: i64|f64) -> f64

Returns the arc tangent of x in radians.

atan2(y: i64|f64, x: i64|f64) -> f64

Returns the arc tangent of y/x in radians as an f64 using the signs of the arguments to determine the correct quadrant.

cbrt(x: i64|f64) -> f64

Returns the cubic root of x.

ceil(x: i64|f64) -> f64

Returns the lowest integer value greater than or equal to x as a float.

cos(x: i64|f64) -> f64

Returns the cosine of x, where x is in radians.

exp(x: i64|f64) -> f64

Returns e to the power of x.

floor(x: i64|f64) -> f64

Returns the highest integer value less than or equal to x as a float.

ln(x: i64|f64) -> f64

Returns the natural logarithm (i.e. the base-e logarithm) of x.

log(b: i64|f64, x: i64|f64) -> f64

Returns the base b logarithm of x.

log2(x: i64|f64) -> f64

Returns the base-2 logarithm of x.

log10(x: i64|f64) -> f64

Returns the base-10 logarithm of x.

sin(x: i64|f64) -> f64

Returns the sine of x, where x is in radians.

sqrt(x: i64|f64) -> f64

Returns the square root of x.

tan(x: i64|f64) -> f64

Returns the tangent of x, where x is in radians.