TeSSLa Standard Library for TeSSLa 1.2.1

module PrimitiveFunctions

Functions for primitive types

ANCHOR atan

liftable atan(x: strict Float): Float

Returns the arc tangent of a value; the returned angle is in the range -π/2 through π/2.

Special cases:

  • If the argument is NaN, then the result is NaN.
  • If the argument is zero, then the result is a zero with the same sign as the argument.
liftable def atan(x: strict Float): Float = extern("atan")

ANCHOR cos

liftable cos(x: strict Float): Float

Returns the trigonometric cosine of an angle in radians.

Special cases:

  • If the argument is NaN or an infinity, then the result is NaN.
liftable def cos(x: strict Float): Float = extern("cos")

ANCHOR floatToInt

liftable floatToInt(x: strict Float): Int

Converts the given float to an integer removing the decimal part

liftable def floatToInt(x: strict Float): Int = extern("floatToInt")

ANCHOR intToFloat

liftable intToFloat(x: strict Int): Float

Converts the given integer to a float.

liftable def intToFloat(x: strict Int): Float = extern("intToFloat")

ANCHOR log

liftable log(x: strict Float, base: strict Float): Float

Returns the logarithm to base base of x

liftable def log(x: strict Float, base: strict Float): Float = extern("log")

ANCHOR max

liftable max(a: Int, b: Int): Int

Compute the maximum of two integer values.

liftable def max(a: Int, b: Int): Int = if a > b then a else b

ANCHOR min

liftable min(a: Int, b: Int): Int

Compute the minimum of two integer values.

liftable def min(a: Int, b: Int): Int = if a < b then a else b

ANCHOR pow

liftable pow(base: strict Float, exponent: strict Float): Float

Returns the value of the first argument raised to the power of the second argument.

liftable def pow(base: strict Float, exponent: strict Float): Float = extern("pow")

ANCHOR sin

liftable sin(x: strict Float): Float

Returns the trigonometric sine of an angle x in radians.

Special cases:

  • If the argument is NaN or an infinity, then the result is NaN.
  • If the argument is zero, then the result is a zero with the same sign as the argument.
liftable def sin(x: strict Float): Float = extern("sin")

ANCHOR tan

liftable tan(x: strict Float): Float

Returns the trigonometric tangent of an angle in radians.

Special cases:

  • If the argument is NaN or an infinity, then the result is NaN.
  • If the argument is zero, then the result is a zero with the same sign as the argument.
liftable def tan(x: strict Float): Float = extern("tan")

ANCHOR toString

liftable toString[T](arg: strict T): String

Converts any type into its typical string representation

liftable def toString[T](arg: strict T): String = extern("toString")