Documentation
¶
Index ¶
- Constants
- func Abs(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Acos(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Asin(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Atan(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Atan2(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)
- func Average(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Cbrt(_ context.Context, value runtime.Value) (runtime.Value, error)
- func Ceil(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Clamp(ctx context.Context, value, min, max runtime.Value) (runtime.Value, error)
- func Cos(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Degrees(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func E(_ context.Context) (runtime.Value, error)
- func Exp(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Exp2(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Expm1(_ context.Context, value runtime.Value) (runtime.Value, error)
- func Floor(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Hypot(_ context.Context, x, y runtime.Value) (runtime.Value, error)
- func Log(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Log1p(_ context.Context, value runtime.Value) (runtime.Value, error)
- func Log2(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Log10(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Max(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Median(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Min(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Percentile(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func Pi(_ context.Context) (runtime.Value, error)
- func PopulationVariance(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Pow(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)
- func Radians(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Rand(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func Range(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func RegisterLib(ns runtime.Namespace)
- func Round(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func SampleVariance(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Sign(_ context.Context, value runtime.Value) (runtime.Value, error)
- func Sin(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Sqrt(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func StandardDeviationPopulation(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func StandardDeviationSample(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Sum(ctx context.Context, arg runtime.Value) (runtime.Value, error)
- func Tan(_ context.Context, arg runtime.Value) (runtime.Value, error)
- func Trunc(_ context.Context, value runtime.Value) (runtime.Value, error)
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
abs returns the absolute value of a given number. @param number {Int | Float} Input number. @return {Float} The absolute value of a given number.
func Acos ¶
acos returns the arccosine, in radians, of a given number. @param number {Int | Float} Input number. @return {Float} The arccosine, in radians, of a given number.
func Asin ¶
asin returns the arcsine, in radians, of a given number. @param number {Int | Float} Input number. @return {Float} The arcsine, in radians, of a given number.
func Atan ¶
atan returns the arctangent, in radians, of a given number. @param number {Int | Float} Input number. @return {Float} The arctangent, in radians, of a given number.
func Atan2 ¶
atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value. @param number1 {Int | Float} Input number. @param number2 {Int | Float} Input number. @return {Float} The arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.
func Average ¶
average returns the arithmetic mean of the numeric elements in a list. @param array {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float} The arithmetic mean, or zero when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::mean instead.
func Cbrt ¶
cbrt returns the real cube root of a number, including negative numbers. @param value {Int | Float} Input number. @return {Float} The cube root, preserving NaN, infinities, and signed zero. @throws {TypeError} The argument is not numeric.
func Ceil ¶
ceil returns the least integer value greater than or equal to a given value. @param number {Int | Float} Input number. @return {Int} The least integer value greater than or equal to a given value. @throws {RangeError} The rounded result is not a finite signed 64-bit integer.
func Clamp ¶
clamp limits a number to the inclusive interval from min to max. @param value {Int | Float} Input number. @param min {Int | Float} Lower bound; must not be NaN or greater than max. @param max {Int | Float} Upper bound; must not be NaN. Infinite bounds are allowed. @return {Int | Float} The original min if value is below it, max if above it, or value otherwise. Equality and NaN preserve value unchanged. @throws {TypeError} An argument is not numeric. @throws {InvalidArgument} A bound is NaN or min is greater than max.
func Cos ¶
cos returns the cosine of a given number. @param number {Int | Float} Input number. @return {Float} The cosine of a given number.
func Degrees ¶
degrees returns the angle converted from radians to degrees. @param number {Int | Float} The input number. @return {Float} The angle in degrees
func E ¶
e returns Euler's number, the base of the natural logarithm. @return {Float} Euler's number, approximately 2.718281828459045.
func Exp ¶
exp returns Euler's constant (2.71828...) raised to the power of value. @param number {Int | Float} Input number. @return {Float} Euler's constant raised to the power of value.
func Exp2 ¶
exp2 returns 2 raised to the power of value. @param number {Int | Float} Input number. @return {Float} 2 raised to the power of value.
func Expm1 ¶
expm1 computes exp(value)-1 with improved numerical accuracy for values near zero. @param value {Int | Float} Input number. @return {Float} The exponential minus one; negative infinity gives -1, while NaN, positive infinity, and signed zero are preserved. @throws {TypeError} The argument is not numeric.
func Floor ¶
floor returns the greatest integer value less than or equal to a given value. @param number {Int | Float} Input number. @return {Int} The greatest integer value less than or equal to a given value. @throws {RangeError} The rounded result is not a finite signed 64-bit integer.
func Hypot ¶
hypot computes sqrt(x*x + y*y), avoiding unnecessary overflow and underflow. @param x {Int | Float} First coordinate. @param y {Int | Float} Second coordinate. @return {Float} The nonnegative distance; infinity takes precedence over NaN. @throws {TypeError} An argument is not numeric.
func Log ¶
log returns the natural logarithm of a given value. @param number {Int | Float} Input number. @return {Float} The natural logarithm of a given value.
func Log1p ¶
log1p computes ln(1+value) with improved numerical accuracy for values near zero. @param value {Int | Float} Input number. @return {Float} The logarithm; -1 gives negative infinity, values below -1 give NaN, and signed zero is preserved. @throws {TypeError} The argument is not numeric.
func Log2 ¶
log2 returns the binary logarithm of a given value. @param number {Int | Float} Input number. @return {Float} The binary logarithm of a given value.
func Log10 ¶
log10 returns the decimal logarithm of a given value. @param number {Int | Float} Input number. @return {Float} The decimal logarithm of a given value.
func Max ¶
max returns the largest number among the numeric elements in a list. @param array {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float | None} The largest number as Float, or None when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::max instead.
func Median ¶
median returns the middle numeric value, averaging the two middle numbers for even numeric counts. @param array {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Int | Float | None} The selected middle value or their Float mean, or None when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::median instead.
func Min ¶
min returns the smallest number among the numeric elements in a list. @param array {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float | None} The smallest number as Float, or None when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::min instead.
func Percentile ¶
percentile returns the nth percentile of the values in a given array. @param array {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @param number {Int} A number which must be between 0 (excluded) and 100 (included). @param method {String} "interpolation" uses linear interpolation; all other strings select nearest rank. @return {Int | Float} The selected number or interpolated Float, or NaN when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::percentile instead.
func PopulationVariance ¶
variance_population returns the population variance, dividing squared deviations from the mean by the numeric count N. @param numbers {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float} The population variance, or NaN when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::variance instead.
func Pow ¶
pow returns the base to the exponent value. @param base {Int | Float} The base value. @param exp {Int | Float} The exponent value. @return {Float} The exponentiated value.
func Radians ¶
radians returns the angle converted from degrees to radians. @param number {Int | Float} The input number. @return {Float} The angle in radians.
func Rand ¶
Rand preserves the legacy zero-, one-, and two-argument random calculations using the Session source transported by ctx. Deprecated: Use random.Float, random.Int, or random.Bool with an execution context.
func Range ¶
range returns an array of numbers in the specified range, optionally with increments other than 1. @param start {Int | Float} The value to start the range at (inclusive). @param end {Int | Float} The value to end the range with (inclusive). @param step {Int | Float} How much to change the value in every step. Positive steps ascend, negative steps descend, and zero is invalid. @return {Float[]} Numbers in the inclusive range, using a default step of one. @deprecated Use arrays::range instead.
func RegisterLib ¶
RegisterLib registers canonical math functions and deprecated global compatibility functions. @namespace math
func Round ¶
round returns the nearest integer, rounding half away from zero. @param number {Int | Float} Input number. @return {Int} The nearest integer, rounding half away from zero. @throws {RangeError} The rounded result is not a finite signed 64-bit integer.
func SampleVariance ¶
variance_sample returns the sample variance, dividing squared deviations from the mean by the numeric count N minus one. @param numbers {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float} The sample variance, or NaN for fewer than two numbers. @throws {TypeError} An argument has an invalid type. @deprecated Use math::variance_sample instead.
func Sign ¶
sign returns the sign of a number, including positive and negative infinity. @param value {Int | Float} Input number; must not be NaN. @return {Int} Minus one for negative values, zero for either signed zero, or one for positive values. @throws {TypeError} The argument is not numeric. @throws {InvalidArgument} The argument is NaN and has no ordered sign.
func Sin ¶
sin returns the sine of the radian argument. @param number {Int | Float} Input number. @return {Float} The sin, in radians, of a given number.
func Sqrt ¶
sqrt returns the square root of a given number. @param value {Int | Float} A number. @return {Float} The square root.
func StandardDeviationPopulation ¶
stddev_population returns the square root of the population variance. @param numbers {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float} The population standard deviation, or NaN when no numbers remain. @throws {TypeError} An argument has an invalid type. @deprecated Use math::stddev instead.
func StandardDeviationSample ¶
stddev_sample returns the square root of the sample variance. @param numbers {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Float} The sample standard deviation, or NaN for fewer than two numbers. @throws {TypeError} An argument has an invalid type. @deprecated Use math::stddev_sample instead.
func Sum ¶
sum returns the sum of the numeric elements in a list. @param numbers {Any[]} A list whose Int and Float elements are used; other elements are ignored. It is not mutated. @return {Int | Float} The sum as Float, including zero when all elements are ignored; integer zero for an empty list. @throws {TypeError} An argument has an invalid type. @deprecated Use math::sum instead.
func Tan ¶
tan returns the tangent of a given number. @param number {Int | Float} A number. @return {Float} The tangent.
Types ¶
This section is empty.
Source Files
¶
- abs.go
- acos.go
- asin.go
- atan.go
- atan2.go
- average.go
- cbrt.go
- ceil.go
- clamp.go
- cos.go
- degrees.go
- e.go
- exp.go
- exp2.go
- expm1.go
- extrema.go
- floor.go
- hypot.go
- legacy.go
- lib.go
- log.go
- log10.go
- log1p.go
- log2.go
- max.go
- mean.go
- median.go
- min.go
- number_conversion.go
- numbers.go
- ordered_numbers.go
- percentile.go
- pi.go
- pow.go
- radians.go
- rand.go
- range.go
- round.go
- sign.go
- sin.go
- sqrt.go
- stddev_population.go
- stddev_sample.go
- sum.go
- tan.go
- trunc.go
- variance.go
- variance_population.go
- variance_sample.go