Codeunit Math
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Pi
Returns the value of pi.
procedure Pi(): Decimal
Returns
| Type | Description |
|---|---|
| Decimal |
Value of pi. |
E
Returns the value of E.
procedure E(): Decimal
Returns
| Type | Description |
|---|---|
| Decimal |
Value of E. |
Abs
Returns the absolute value of a Decimal number.
procedure Abs(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A decimal. |
Returns
| Type | Description |
|---|---|
| Decimal |
A decimal number, x, such that 0 ≤ x ≤MaxValue |
Acos
Returns the angle whose cosine is the specified number.
procedure Acos(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number representing a cosine. |
Returns
| Type | Description |
|---|---|
| Decimal |
An angle, θ, measured in radians, such that 0 ≤θ≤π |
Asin
Returns the angle whose sine is the specified number.
procedure Asin(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number representing a sine, where decimalValue must be greater than or equal to -1, but less than or equal to 1. |
Returns
| Type | Description |
|---|---|
| Decimal |
An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2 |
Atan
Returns the angle whose tangent is the specified number.
procedure Atan(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number representing a tangent. |
Returns
| Type | Description |
|---|---|
| Decimal |
An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2. |
Atan2
Returns the angle whose tangent is the quotient of two specified numbers.
procedure Atan2(y: Decimal, x: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| y | Decimal |
The y coordinate of a point. |
| x | Decimal |
The x coordinate of a point. |
Returns
| Type | Description |
|---|---|
| Decimal |
An angle, θ, measured in radians, such that -π≤θ≤π, and tan(θ) = y / x, where (x, y) is a point in the Cartesian plane. |
BigMul
Produces the full product of two 32-bit numbers.
procedure BigMul(a: Integer, b: Integer): BigInteger
Parameters
| Name | Type | Description |
|---|---|---|
| a | Integer |
The first number to multiply. |
| b | Integer |
The second number to multiply. |
Returns
| Type | Description |
|---|---|
| BigInteger |
The number containing the product of the specified numbers. |
Ceiling
Returns the smallest integral value that is greater than or equal to the specified decimal number.
procedure Ceiling(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A decimal number. |
Returns
| Type | Description |
|---|---|
| Decimal |
The smallest integral value that is greater than or equal to decimalValue. |
Cos
Returns the cosine of the specified angle.
procedure Cos(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The cosine of decimalValue. |
Cosh
Returns the hyperbolic cosine of the specified angle.
procedure Cosh(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The hyperbolic cosine of value. |
Exp
Returns e raised to the specified power.
procedure Exp(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number specifying a power. |
Returns
| Type | Description |
|---|---|
| Decimal |
The number e raised to the power decimalValue. |
Floor
Returns the largest integral value less than or equal to the specified decimal number.
procedure Floor(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A decimal number. |
Returns
| Type | Description |
|---|---|
| Decimal |
The largest integral value less than or equal to decimalValue. |
IEEERemainder
Returns the remainder resulting from the division of a specified number by another specified number.
procedure IEEERemainder(x: Decimal, y: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| x | Decimal |
A dividend. |
| y | Decimal |
A divisor. |
Returns
| Type | Description |
|---|---|
| Decimal |
A number equal to x - (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is returned). |
Log
Returns the natural (base e) logarithm of a specified number.
procedure Log(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
The number whose logarithm is to be found. |
Returns
| Type | Description |
|---|---|
| Decimal |
The natural logarithm of decimalValue; that is, ln decimalValue, or log e decimalValue |
Log
Returns the logarithm of a specified number in a specified base.
procedure Log(a: Decimal, newBase: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| a | Decimal |
The number whose logarithm is to be found. |
| newBase | Decimal |
The base of the logarithm. |
Returns
| Type | Description |
|---|---|
| Decimal |
The logarithm of a specified number in a specified base. |
Log10
Returns the base 10 logarithm of a specified number.
procedure Log10(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number whose logarithm is to be found. |
Returns
| Type | Description |
|---|---|
| Decimal |
The base 10 logarithm of the specified number |
Max
Returns the larger of two decimal numbers.
procedure Max(decimalValue1: Decimal, decimalValue2: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue1 | Decimal |
The first of two decimal numbers to compare. |
| decimalValue2 | Decimal |
The second of two decimal numbers to compare. |
Returns
| Type | Description |
|---|---|
| Decimal |
Parameter decimalValue1 or decimalValue2, whichever is larger. |
Min
Returns the smaller of two decimal numbers.
procedure Min(decimalValue1: Decimal, decimalValue2: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue1 | Decimal |
The first of two decimal numbers to compare. |
| decimalValue2 | Decimal |
The second of two decimal numbers to compare. |
Returns
| Type | Description |
|---|---|
| Decimal |
Parameter decimalValue1 or decimalValue2, whichever is smaller. |
Pow
Returns a specified number raised to the specified power.
procedure Pow(x: Decimal, y: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| x | Decimal |
A double-precision floating-point number to be raised to a power. |
| y | Decimal |
A double-precision floating-point number that specifies a power. |
Returns
| Type | Description |
|---|---|
| Decimal |
The number x raised to the power y. |
Sign
Returns an integer that indicates the sign of a decimal number.
procedure Sign(decimalValue: Decimal): Integer
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A signed decimal number. |
Returns
| Type | Description |
|---|---|
| Integer |
A number that indicates the sign of value. |
Sinh
Returns the hyperbolic sine of the specified angle.
procedure Sinh(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The hyperbolic sine of value. |
Sin
Returns the sine of the specified angle.
procedure Sin(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The sine of a. |
Sqrt
Returns the square root of a specified number.
procedure Sqrt(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
The number whose square root is to be found. |
Returns
| Type | Description |
|---|---|
| Decimal |
The positive square root of decimalValue. |
Tan
Returns the tangent of the specified angle.
procedure Tan(a: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| a | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The tangent of a. |
Tanh
Returns the hyperbolic tangent of the specified angle.
procedure Tanh(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
An angle, measured in radians. |
Returns
| Type | Description |
|---|---|
| Decimal |
The hyperbolic tangent of value. |
Truncate
Calculates the integral part of a specified decimal number.
procedure Truncate(decimalValue: Decimal): Decimal
Parameters
| Name | Type | Description |
|---|---|---|
| decimalValue | Decimal |
A number to truncate. |
Returns
| Type | Description |
|---|---|
| Decimal |
The integral part of decimalValue. |