﻿ Arithmetic Functions Arithmetic Functions
Macro Scheduler 15

# Arithmetic Functions

function Trunc(X: Extended):Integer

The Trunc function truncates a float-type value to an integer-type value. X is a float-type expression. Trunc returns an Integer value that is the value of X rounded toward zero.

function Round(X: Extended): Integer

The Round function rounds a float-type value to an integer-type value. X is a float-type expression. Round returns a Longint value that is the value of X rounded to the nearest whole number using "bankers rules" where exact halfs are rounded to the nearest even number.

function Abs(X): Float

The Abs function returns the absolute value of the argument. X is an integer-type or float-type expression.

function ArcTan(X: Float): Float

ArcTan calculates the arctangent of the given number. Calculate other trigonometric functions using Sin, Cos, and ArcTan in the following expressions

Tan(x) = Sin(x) / Cos(x)

ArcSin(x) = ArcTan (x/sqrt (1-sqr (x)))

ArcCos(x) = ArcTan (sqrt (1-sqr (x)) /x)

function Cos(X: Float): Float

The Cos function returns the cosine of the angle X, in radians.

function Exp(X: Float): Float

Exp returns the value of e raised to the power of X, where e is the base of the natural logarithms.

function Frac(X: Float): Float

The Frac function returns the fractional part of the argument X. X is a float-type expression. The result is the fractional part of X; that is: Frac(X) = X - Int(X).

function Int(X: Float): Float

X is a float-type expression. The result is the integer part of X; that is, X rounded toward zero.

function Ln(X: Float): Float

The Ln function returns the natural logarithm (Ln(e) = 1) of the float-type expression X.

function Pi: Float

Use Pi in mathematical calculations that require pi, the ratio of a circle's circumference to its diameter. Pi is approximated as 3.1415926535897932385.

function Sin(X: Float): Float

The Sin function returns the sine of the argument. X is a float-type expression. Sin returns the sine of the angle X in radians.

function Sqr(X: Float): Float

The Sqr function returns the square of the argument. X is a floating-point expression. The result, of the same type as X, is the square of X, or X*X.

function Sqrt(X: Float): Float

X is a floating-point expression. The result is the square root of X.

function Power(Base, Exponent: Float): Float

The Power function raises Base to any power. For fractional exponents or exponents greater than MaxInt, Base must be greater than 0.