Built-In Math and Trigonometric Functions

The assembler supports built-in functions for conversions and various math computations. Table 4-7 describes the built-in functions. The expr must be a constant value.

Table 4-7 Built-In Mathematical Functions

Function Description
$$acos(expr) Returns the arccosine of expr as a floating-point value
$$asin(expr) Returns the arcsine of expr as a floating-point value
$$atan(expr) Returns the arctangent of expr as a floating-point value
$$atan2(expr, y) Returns the arctangent of expr as a floating-point value in range [-π, π]
$$ceil(expr) Returns the smallest integer not less than expr
$$cos(expr) Returns the cosine of expr as a floating-point value
$$cosh(expr) Returns the hyperbolic cosine of expr as a floating-point value
$$cvf(expr) Converts expr to a floating-point value
$$cvi(expr) converts expr to integer value
$$exp(expr) Returns the exponential function eexpr
$$fabs(expr) Returns the absolute value of expr as a floating-point value
$$floor(expr) Returns the largest integer not greater than expr
$$fmod(expr, y) Returns the remainder of expr1 ÷ expr2
$$int(expr) Returns 1 if expr has an integer value; else returns 0. Returns an integer.
$$ldexp(expr, expr2) Multiplies expr by an integer power of 2. That is, expr1 × 2expr2
$$log(expr) Returns the natural logarithm of expr, where expr>0
$$log10(expr) Returns the base 10 logarithm of expr, where expr>0
$$max(expr1, expr2) Returns the maximum of two values
$$min(expr1, expr2) Returns the minimum of two values
$$pow(expr1, expr2) Returns expr1raised to the power of expr2
$$round(expr) Returns expr rounded to the nearest integer
$$sgn(expr) Returns the sign of expr.
$$sin(expr) Returns the sine of expr
$$sinh(expr) Returns the hyperbolic sine of expr as a floating-point value
$$sqrt(expr) Returns the square root of expr, expr≥0, as a floating-point value
$$strtod(str) Converts a character string to a double precision floating-point value. The string contains a properly-formatted C99-style floating-point literal.
$$tan(expr) Returns the tangent of expr as a floating-point value
$$tanh(expr) Returns the hyperbolic tangent of expr as a floating-point value
$$trunc(expr) Returns expr rounded toward 0