math

Mathematical operations and functions

Import

_ <- fat.math

Constants

  • e, natural logarithm constant 2.71...
  • maxInt, 9007199254740992
  • minInt, -9007199254740992
  • pi, ratio of circle to its diameter 3.14...

read more about number precision in FatScript

Methods

Name Signature Brief
abs (x: Number): Number Return absolute value of x
ceil (x: Number): Number Return smallest integer >= x
floor (x: Number): Number Return largest integer <= x
isInf (x: Number): Boolean Return true if x is infinity
isNan (x: Any): Boolean Return true if x is not a number
ln (x: Number): Number Return natural logarithm of x
random (): Number Return pseudo-random, where 0 <= n < 1
sqrt (x: Number): Number Return the square root of x
sin (x: Number): Number Return the sine of x
cos (x: Number): Number Return the cosine of x
asin (x: Number): Number Return the arc sine of x
acos (x: Number): Number Return the arc cosine of x
atan (x: Number, y = 1): Number Return the arc tangent of x, y
max (v: List/Number): Number Return maximum value in vector
min (v: List/Number): Number Return the minimum value in vector
sum (v: List/Number): Number Return the sum of vector

Example

math <- fat.math  # named import
math.abs(-52)     # yields 52

See also

results matching ""

    No results matching ""