math

package
v2.0.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RadToDeg  = 180 / math.Pi
	DegToRad  = math.Pi / 180
	RadToGrad = 200 / math.Pi
	GradToDeg = math.Pi / 200
)

Variables

This section is empty.

Functions

func Abs

ABS returns the absolute value of a given number. @param {Int | Float} number - Input number. @return {Float} - The absolute value of a given number.

func Acos

func Acos(_ context.Context, arg runtime.Value) (runtime.Value, error)

ACOS returns the arccosine, in radians, of a given number. @param {Int | Float} number - Input number. @return {Float} - The arccosine, in radians, of a given number.

func Asin

func Asin(_ context.Context, arg runtime.Value) (runtime.Value, error)

ASIN returns the arcsine, in radians, of a given number. @param {Int | Float} number - Input number. @return {Float} - The arcsine, in radians, of a given number.

func Atan

func Atan(_ context.Context, arg runtime.Value) (runtime.Value, error)

ATAN returns the arctangent, in radians, of a given number. @param {Int | Float} number - Input number. @return {Float} - The arctangent, in radians, of a given number.

func Atan2

func Atan2(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)

ATAN2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value. @param {Int | Float} number1 - Input number. @param {Int | Float} number2 - 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

func Average(ctx context.Context, arg runtime.Value) (runtime.Value, error)

AVERAGE Returns the average (arithmetic mean) of the values in array. @param {Int[] | Float[]} array - arrayList of numbers. @return {Float} - The average of the values in array.

func Ceil

func Ceil(_ context.Context, arg runtime.Value) (runtime.Value, error)

CEIL returns the least integer value greater than or equal to a given value. @param {Int | Float} number - Input number. @return {Int} - The least integer value greater than or equal to a given value.

func Cos

COS returns the cosine of a given number. @param {Int | Float} number - Input number. @return {Float} - The cosine of a given number.

func Degrees

func Degrees(_ context.Context, arg runtime.Value) (runtime.Value, error)

DEGREES returns the angle converted from radians to degrees. @param {Int | Float} number - The input number. @return {Float} - The angle in degrees

func Exp

EXP returns Euler's constant (2.71828...) raised to the power of value. @param {Int | Float} number - Input number. @return {Float} - Euler's constant raised to the power of value.

func Exp2

func Exp2(_ context.Context, arg runtime.Value) (runtime.Value, error)

EXP2 returns 2 raised to the power of value. @param {Int | Float} number - Input number. @return {Float} - 2 raised to the power of value.

func Floor

func Floor(_ context.Context, arg runtime.Value) (runtime.Value, error)

FLOOR returns the greatest integer value less than or equal to a given value. @param {Int | Float} number - Input number. @return {Int} - The greatest integer value less than or equal to a given value.

func Log

LOG returns the natural logarithm of a given value. @param {Int | Float} number - Input number. @return {Float} - The natural logarithm of a given value.

func Log2

func Log2(_ context.Context, arg runtime.Value) (runtime.Value, error)

LOG2 returns the binary logarithm of a given value. @param {Int | Float} number - Input number. @return {Float} - The binary logarithm of a given value.

func Log10

func Log10(_ context.Context, arg runtime.Value) (runtime.Value, error)

LOG10 returns the decimal logarithm of a given value. @param {Int | Float} number - Input number. @return {Float} - The decimal logarithm of a given value.

func Max

func Max(ctx context.Context, arg runtime.Value) (runtime.Value, error)

MAX returns the greatest (arithmetic mean) of the values in array. @param {Int[] | Float[]} array - arrayList of numbers. @return {Float} - The greatest of the values in array.

func Median

func Median(ctx context.Context, arg runtime.Value) (runtime.Value, error)

MEDIAN returns the median of the values in array. @param {Int[] | Float[]} array - arrayList of numbers. @return {Float} - The median of the values in array.

func Min

func Min(ctx context.Context, arg runtime.Value) (runtime.Value, error)

MIN returns the smallest (arithmetic mean) of the values in array. @param {Int[] | Float[]} array - arrayList of numbers. @return {Float} - The smallest of the values in array.

func Percentile

func Percentile(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

PERCENTILE returns the nth percentile of the values in a given array. @param {Int[] | Float[]} array - arrayList of numbers. @param {Int} number - A number which must be between 0 (excluded) and 100 (included). @param {String} [method="rank"] - "rank" or "interpolation". @return {Float} - The nth percentile, or null if the array is empty or only null values are contained in it or the percentile cannot be calculated.

func Pi

PI returns Pi value. @return {Float} - Pi value.

func PopulationVariance

func PopulationVariance(ctx context.Context, arg runtime.Value) (runtime.Value, error)

VARIANCE_POPULATION returns the population variance of the values in a given array. @param {Int[] | Float[]} numbers - arrayList of numbers. @return {Float} - The population variance.

func Pow

func Pow(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)

POW returns the base to the exponent value. @param {Int | Float} base - The base value. @param {Int | Float} exp - The exponent value. @return {Float} - The exponentiated value.

func Radians

func Radians(_ context.Context, arg runtime.Value) (runtime.Value, error)

RADIANS returns the angle converted from degrees to radians. @param {Int | Float} number - The input number. @return {Float} - The angle in radians.

func Rand

func Rand(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

RAND return a pseudo-random number between 0 and 1. @param {Int | Float} [max] - Upper limit. @param {Int | Float} [min] - Lower limit. @return {Float} - A number greater than 0 and less than 1.

func Range

func Range(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

RANGE returns an array of numbers in the specified range, optionally with increments other than 1. @param {Int | Float} start - The value to start the range at (inclusive). @param {Int | Float} end - The value to end the range with (inclusive). @param {Int | Float} [step=1.0] - How much to increment in every step. @return {Int[] | Float[]} - arrayList of numbers in the specified range, optionally with increments other than 1.

func RegisterLib

func RegisterLib(ns runtime.Namespace)

func Round

func Round(_ context.Context, arg runtime.Value) (runtime.Value, error)

ROUND returns the nearest integer, rounding half away from zero. @param {Int | Float} number - Input number. @return {Int} - The nearest integer, rounding half away from zero.

func SampleVariance

func SampleVariance(ctx context.Context, arg runtime.Value) (runtime.Value, error)

VARIANCE_SAMPLE returns the sample variance of the values in a given array. @param {Int[] | Float[]} numbers - arrayList of numbers. @return {Float} - The sample variance.

func Sin

SIN returns the sine of the radian argument. @param {Int | Float} number - Input number. @return {Float} - The sin, in radians, of a given number.

func Sqrt

func Sqrt(_ context.Context, arg runtime.Value) (runtime.Value, error)

SQRT returns the square root of a given number. @param {Int | Float} value - A number. @return {Float} - The square root.

func StandardDeviationPopulation

func StandardDeviationPopulation(ctx context.Context, arg runtime.Value) (runtime.Value, error)

STDDEV_POPULATION returns the population standard deviation of the values in a given array. @param {Int[] | Float[]} numbers - arrayList of numbers. @return {Float} - The population standard deviation.

func StandardDeviationSample

func StandardDeviationSample(ctx context.Context, arg runtime.Value) (runtime.Value, error)

STDDEV_SAMPLE returns the sample standard deviation of the values in a given array. @param {Int[] | Float[]} numbers - arrayList of numbers. @return {Float} - The sample standard deviation.

func Sum

func Sum(ctx context.Context, arg runtime.Value) (runtime.Value, error)

SUM returns the sum of the values in a given array. @param {Int[] | Float[]} numbers - arrayList of numbers. @return {Float} - The sum of the values.

func Tan

TAN returns the tangent of a given number. @param {Int | Float} number - A number. @return {Float} - The tangent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL