Mathematic Fundamental

Mathematic Fundamental

add

func add(arg1 interface{}, args ...interface{}) interface{}
Returns the result of the addition of all arguments.

Aliases

  • sum

cbrt

func cbrt(x interface{}) interface{}
Returns the cube root of x.
Special cases are:
    cbrt(±0) = ±0
    cbrt(±Inf) = ±Inf
    cbrt(NaN) = NaN

ceil

func ceil(x interface{}) interface{}
Returns the least integer value greater than or equal to x.
Special cases are:
    ceil(±0) = ±0
    ceil(±Inf) = ±Inf
    ceil(NaN) = NaN

Aliases

  • roundUp
  • roundup

dim

func dim(x interface{}, y interface{}) interface{}
Returns the maximum of x-y or 0.
Special cases are:
    dim(+Inf, +Inf) = NaN
    dim(-Inf, -Inf) = NaN
    dim(x, NaN) = dim(NaN, x) = NaN

div

func div(arg1 interface{}, arg2 interface{}) interface{}
Returns the result of the division of the two arguments.

Aliases

  • divide
  • quotient

exp

func exp(x interface{}) interface{}
Returns e**x, the base-e exponential of x.
Special cases are:
    exp(+Inf) = +Inf
    exp(NaN) = NaN
Very large values overflow to 0 or +Inf. Very small values underflow
to 1.

Aliases

  • exponent

exp2

func exp2(x interface{}) interface{}
Returns 2**x, the base-2 exponential of x.
Special cases are the same as exp.

Aliases

  • exponent2

expm1

func expm1(x interface{}) interface{}
Returns e**x - 1, the base-e exponential of x minus 1. It is more
accurate than exp(x) - 1 when x is near zero.
Special cases are:
    expm1(+Inf) = +Inf
    expm1(-Inf) = -1
    expm1(NaN) = NaN
Very large values overflow to -1 or +Inf

floor

func floor(x interface{}) interface{}
Returns the greatest integer value less than or equal to x.
Special cases are:
    floor(±0) = ±0
    floor(±Inf) = ±Inf
    floor(NaN) = NaN

Aliases

  • roundDown
  • rounddown
  • int64
  • integer64

int

func int(arg1 interface{}) int
Returns the integer value (type int).

Aliases

  • integer

mod

func mod(x interface{}, y interface{}) interface{}
Returns the floating-point remainder of x/y. The magnitude of the
result is less than y and its sign agrees with that of x.
Special cases are:
    mod(±Inf, y) = NaN
    mod(NaN, y) = NaN
    mod(x, 0) = NaN
    mod(x, ±Inf) = x
    mod(x, NaN) = NaN

Aliases

  • modulo

modf

func modf(f interface{}) interface{}
Returns integer and fractional floating-point numbers that sum to f.
Both values have the same sign as f.
Special cases are:
    modf(±Inf) = ±Inf, NaN
    modf(NaN) = NaN, NaN

mul

func mul(arg1 interface{}, args ...interface{}) interface{}
Returns the result of the multiplication of all arguments.

Aliases

  • multiply
  • prod
  • product

pow

func pow(x interface{}, y interface{}) interface{}
Returns x**y, the base-x exponential of y.
Special cases are (in order):
    pow(x, ±0) = 1 for any x
    pow(1, y) = 1 for any y
    pow(x, 1) = x for any x
    pow(NaN, y) = NaN
    pow(x, NaN) = NaN
    pow(±0, y) = ±Inf for y an odd integer < 0
    pow(±0, -Inf) = +Inf
    pow(±0, +Inf) = +0
    pow(±0, y) = +Inf for finite y < 0 and not an odd integer
    pow(±0, y) = ±0 for y an odd integer > 0
    pow(±0, y) = +0 for finite y > 0 and not an odd integer
    pow(-1, ±Inf) = 1
    pow(x, +Inf) = +Inf for |x| > 1
    pow(x, -Inf) = +0 for |x| > 1
    pow(x, +Inf) = +0 for |x| < 1
    pow(x, -Inf) = +Inf for |x| < 1
    pow(+Inf, y) = +Inf for y > 0
    pow(+Inf, y) = +0 for y < 0
    pow(-Inf, y) = Pow(-0, -y)
    pow(x, y) = NaN for finite x < 0 and finite non-integer y

Aliases

  • power

pow10

func pow10(n interface{}) interface{}
Returns 10**n, the base-10 exponential of n.
Special cases are:
    pow10(n) =0 for n < -323
    pow10(n) = +Inf for n > 308

Aliases

  • power10

rem

func rem(arg1 interface{}, arg2 interface{}) interface{}
Returns the IEEE 754 floating-point remainder of x/y.
Special cases are:
    rem(±Inf, y) = NaN
    rem(NaN, y) = NaN
    rem(x, 0) = NaN
    rem(x, ±Inf) = x
    rem(x, NaN) = NaN

Aliases

  • remainder

sub

func sub(arg1 interface{}, arg2 interface{}) interface{}
Returns the result of the substraction of the two arguments.

Aliases

  • subtract

trunc

func trunc(x interface{}) interface{}
Returns the integer value of x.
Special cases are:
    trunc(±0) = ±0
    trunc(±Inf) = ±Inf
    trunc(NaN) = NaN

Aliases

  • truncate