Skip to content

stdmath

Anssi Halmeaho edited this page May 3, 2020 · 1 revision

stdmath

Provides basic mathematical functions.

pi

Contains value for Pi constant (float) stdmath.pi -> 3.141592653589793.

Functions

is-nan

Returns whether argument (float) is an IEEE 754 “not-a-number” value.

type: function

Format:

call(stdmath.is-nan <float>) -> <bool>

Return value: bool

is-inf

Returns whether 1st argument (float) is an infinity, according to sign (if defined by 2nd argument).

If one argument is given is-inf returns if 1st argument is either positive or negative infinity. If two arguments are given, if 2nd argument specifies which infinity is checked:

2nd argument meaning
'+' positive infinity is checked
'-' negative infinity is checked

type: function

Format:

call(stdmath.is-inf <float>) -> <bool>
call(stdmath.is-inf <float> <sign-string>) -> <bool>

Return value: bool

abs

Returns the absolute value of argument (float).

type: function

Format:

call(stdmath.abs <float>) -> <float>

Return value: float

acos

Returns the arccosine, in radians, of argument (float).

type: function

Format:

call(stdmath.acos <float>) -> <float>

Return value: float

acosh

Returns the inverse hyperbolic cosine of argument (float).

type: function

Format:

call(stdmath.acosh <float>) -> <float>

Return value: float

asin

Returns the arcsine, in radians, of argument (float).

type: function

Format:

call(stdmath.asin <float>) -> <float>

Return value: float

asinh

Returns the inverse hyperbolic sine of argument (float).

type: function

Format:

call(stdmath.asinh <float>) -> <float>

Return value: float

atan

Returns the arctangent, in radians, of argument (float).

type: function

Format:

call(stdmath.atan <float>) -> <float>

Return value: float

atanh

Returns the inverse hyperbolic tangent of argument (float).

type: function

Format:

call(stdmath.atanh <float>) -> <float>

Return value: float

cos

Returns the cosine of the radian argument argument (float).

type: function

Format:

call(stdmath.cos <float>) -> <float>

Return value: float

cosh

Returns the hyperbolic cosine of argument (float).

type: function

Format:

call(stdmath.cosh <float>) -> <float>

Return value: float

sin

Returns the sine of the radian argument (float).

type: function

Format:

call(stdmath.sin <float>) -> <float>

Return value: float

sinh

Returns the hyperbolic sine of argument (float).

type: function

Format:

call(stdmath.sinh <float>) -> <float>

Return value: float

tan

Returns the tangent of the radian argument (float).

type: function

Format:

call(stdmath.tan <float>) -> <float>

Return value: float

tanh

Returns the hyperbolic tangent of argument (float).

type: function

Format:

call(stdmath.tanh <float>) -> <float>

Return value: float

ceil

Returns the least integer value greater than or equal to argument (float).

type: function

Format:

call(stdmath.ceil <float>) -> <float>

Return value: float

floor

Returns the greatest integer value less than or equal to argument (float).

type: function

Format:

call(stdmath.floor <float>) -> <float>

Return value: float

trunc

Returns the integer value of argument (float).

type: function

Format:

call(stdmath.trunc <float>) -> <float>

Return value: float

frexp

Breaks argument (float) into a normalized fraction and an integral power of two. It returns frac and exp satisfying argument == frac × 2**exp, with the absolute value of frac in the interval (0.5, 1).

type: function

Format:

call(stdmath.frexp <float>) -> <list>

Return value: list

List contains 2 items:

  • normalized fraction (float)
  • integral power of two (int)

ldexp

Is the inverse of frexp. It returns frac × 2**exp.

type: function

Format:

call(stdmath.ldexp <frac-float> <exp-int>) -> <float>

Return value: float

modf

Returns integer and fractional floating-point numbers that sum to argument (float). Both values have the same sign as argument.

type: function

Format:

call(stdmath.modf <float>) -> <list>

Return value: list

List contains 2 items:

  • integer part (float)
  • fractional (float)

remainder

Returns the IEEE 754 floating-point remainder of 1st argument/2nd argument (both arguments are float type).

type: function

Format:

call(stdmath.remainder <float> <float>) -> <float>

Return value: float

exp

Returns e**x, the base-e exponential of argument (float).

type: function

Format:

call(stdmath.exp <float>) -> <float>

Return value: float

exp2

Returns 2**x, the base-2 exponential of argument (float).

type: function

Format:

call(stdmath.exp2 <float>) -> <float>

Return value: float

expm1

Returns 2x, the base-2 exponential of argument (float). Returns ex - 1, the base-e exponential of argument (float) minus 1. It is more accurate than minus(call(stdmath.exp x) 1) when x is near zero.

type: function

Format:

call(stdmath.expm1 <float>) -> <float>

Return value: float

log

Returns the natural logarithm of argument (float).

type: function

Format:

call(stdmath.log <float>) -> <float>

Return value: float

log10

Returns the decimal logarithm of argument (float).

type: function

Format:

call(stdmath.log10 <float>) -> <float>

Return value: float

log1p

Returns the natural logarithm of 1 plus its argument (float).

type: function

Format:

call(stdmath.log1p <float>) -> <float>

Return value: float

log2

Returns the binary logarithm of argument (float).

type: function

Format:

call(stdmath.log2 <float>) -> <float>

Return value: float

logb

Returns the binary exponent of argument (float).

type: function

Format:

call(stdmath.logb <float>) -> <float>

Return value: float

pow

Returns x**y, the base-x exponential of y, where x is 1st argument (float) and y is 2nd argument (float).

type: function

Format:

call(stdmath.pow <x-float> <y-float>) -> <float>

Return value: float

sqrt

Returns the square root of argument (float).

type: function

Format:

call(stdmath.sqrt <float>) -> <float>

Return value: float

cbrt

Returns the cube root of argument (float).

type: function

Format:

call(stdmath.sqrt <float>) -> <float>

Return value: float