## Libraries.Compute.Math Documentation

The Math class has a number of math actions you might find on a scientific calculator. For example, this class has Sine, Tangent, and Cosine actions, as well as a few different round actions. Authors: Most math functions call down to Java's java.lang.math class. The plugin calls and custom methods were written by Elliot Motl and Melissa Stefik.

Example Code

``````use Libraries.Compute.Math

class Main
action main
Math math
number result = math:Power(2, 4)
end
e``````

Inherits from: Libraries.Language.Object

## Summary

### Variable Summary Table

VariablesDescription
number log10OfEBase 10 logarithm of
number eulerThe euler constan
number naturalLog10Natural Log of 1
number naturalLog2Natural logarithm of
number oneOverPiThe value of 1.0 / p
number logTwoOfEBase 2 logarithm of
number eThe value of
number squareRoot2The Square Root of
number squareRoot1Over2The value of 1 / Square Root of
number piThe value of p
number twoOverPiThe value of 2.0 / p
number piOver2The value of pi /
number piOver4The value of pi /

### Actions Summary Table

ActionsDescription
AbsoluteValue(number value)This action calculates the absolute value of a number and returns the result.
AbsoluteValue(integer value)This action calculates the absolute value of an integer and returns the result.
Ceiling(number value)This action calculates the ceiling of a number (it rounds it up).
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Cosine(number value)This action calculates the cosine of a number in radians and returns the result.
DegreesToRadians(number degrees)This action converts a number from a value in degrees to a value in radians.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
Equals(number x, number y, number epsilon)This action returns true if the values x and y are within epsilon of each other.
Floor(number value)This action calculates the floor of a number (it rounds it down).
GetHashCode()This action gets the hash code for an object.
HyperbolicCosine(number value)This action calculates the hyperbolic cosine of a number value in radians.
HyperbolicSine(number value)This action calculates the hyperbolic sine of a number value in radians.
HyperbolicTangent(number value)This action calculates the hyperbolic tangent of a number value in radians.
InverseCosine(number value)This action calculates the inverse cosine of a number value in radians.
InverseHyperbolicCosine(number value)This action calculates the inverse hyperbolic cosine of a number value in radians.
InverseHyperbolicSine(number value)This action calculates the inverse hyperbolic sine of a number value in radians.
InverseHyperbolicTangent(number value)This action calculates the inverse hyperbolic tangent of a number value in radians.
InverseSine(number value)This action calculates the inverse sine of a number value in radians.
InverseTangent(number x, number y)This action calculates the inverse tangent of a cartesian point, where its coordinates are of the form (x, y).
InverseTangent(number value)This action calculates the inverse tangent of a number value in radians.
InverseTangent2(number x, number y)return result in radia
Logarithm(number value)This action calculates the logarithm with base 10 of a number value.
MaximumOf(number a, number b)This action calculates the maximum between two number
MinimumOf(number a, number b)This action calculates the minimum between two number
NaturalLogarithm(number value)This action calculates the natural logarithm with base ''e'' of a number value.
RaiseNaturalNumberToPower(number power)This action raises the natural number 'e' to the power of x.
RaiseToPower(number value, number power)This action raises a value to the power of some number(for example "value^power").
Remainder(number a, number b)This action calculates the remainder between two number
Round(number value)This action rounds a number to the closest integer value.
Round(number value, boolean roundUp)This action rounds a number to the nearest integer and will either round up or down when at a midpoint.
Round(number value, integer decimalPlace)This action rounds a number to the given number of decimal places.
Round(number value, integer decimalPlace, boolean roundUp)This action rounds a number to the given number of decimal places and will either round up or down when at a midpoint.
RoundToNearestInteger(number value)This action rounds a number to the closest integer value.
Sine(number value)This action calculates the sine of a number in radians and returns the result.
SquareRoot(number value)This action calculates the square root of a number value.
Tangent(number value)This action calculates the tangent of a number in radians and returns the result.

## Actions Documentation

### AbsoluteValue(number value)

This action calculates the absolute value of a number and returns the result.

Example Code

``````use Libraries.Compute.Math
Math math
number absValue = math:AbsoluteValue(-2443.``````

#### Parameters

• number value: The value that the absolute value will be calculated from.

#### Return

number: Returns the absolute value of the parameter value. The type returned is number.

### AbsoluteValue(integer value)

This action calculates the absolute value of an integer and returns the result.

Example Code

``````use Libraries.Compute.Math
Math math
integer absValue = math:AbsoluteValue(-244``````

#### Parameters

• integer value: The value that the absolute value will be calculated from.

#### Return

integer: Returns the absolute value of the parameter value. The type returned is integer.

### Ceiling(number value)

This action calculates the ceiling of a number (it rounds it up).

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Ceiling(11.9)
output resu``````

#### Parameters

• number value: The number to take the ceiling of.

#### Return

number: Returns the ceiling of a number.

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

``````Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle``````

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### Cosine(number value)

This action calculates the cosine of a number in radians and returns the result.

Example Code

``````use Libraries.Compute.Math
Math math
number cosine = math:Cosine(4.3``````

#### Parameters

• number value: The value that the cosine will be calculated from.

#### Return

number: Returns the cosine of the parameter value. The type returned is number.

This action converts a number from a value in degrees to a value in radians.

Example Code

``````use Libraries.Compute.Math
Math math

#### Parameters

• number degrees: The number of degrees to convert to radians.

#### Return

number: Returns the value of the given number as radians.

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

``````use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(``````

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### Equals(number x, number y, number epsilon)

This action returns true if the values x and y are within epsilon of each other. If epsilon is greater than 1, it is set to 1.

Example Code

``````use Libraries.Compute.Math
Math math
boolean value = math:Equals(11.9, 11.901, 0.00``````

#### Parameters

• number x: The first number
• number y: The second number
• number epsilon: The max distance between the values

#### Return

boolean: true if the values are equal within epison

### Floor(number value)

This action calculates the floor of a number (it rounds it down).

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Floor(11.9)
output resu``````

#### Parameters

• number value: The number to take the floor of.

#### Return

number: Returns the floor of a number.

### GetHashCode()

This action gets the hash code for an object.

Example Code

``````Object o
integer hash = o:GetHashCode``````

#### Return

integer: The integer hash code of the object.

### HyperbolicCosine(number value)

This action calculates the hyperbolic cosine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:HyperbolicCosine(1.``````

#### Parameters

• number value: The value to take the hyperbolic cosine of.

#### Return

number: Returns the number result.

### HyperbolicSine(number value)

This action calculates the hyperbolic sine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:HyperbolicSine(1.``````

#### Parameters

• number value: The value to take the hyperbolic sine of.

#### Return

number: Returns the number result.

### HyperbolicTangent(number value)

This action calculates the hyperbolic tangent of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:HyperbolicTangent(1.``````

#### Parameters

• number value: The value to take the hyperbolic tangent of.

#### Return

number: Returns the number result.

### InverseCosine(number value)

This action calculates the inverse cosine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseCosine(1.``````

#### Parameters

• number value: The value to take the inverse cosine of.

#### Return

number: Returns the number result.

### InverseHyperbolicCosine(number value)

This action calculates the inverse hyperbolic cosine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseHyperbolicCosine(1.``````

#### Parameters

• number value: The value to take the inverse hyperbolic cosine of.

#### Return

number: Returns the number result.

### InverseHyperbolicSine(number value)

This action calculates the inverse hyperbolic sine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseHyperbolicSine(1.``````

#### Parameters

• number value: The value to take the inverse hyperbolic sine of.

#### Return

number: Returns the number result.

### InverseHyperbolicTangent(number value)

This action calculates the inverse hyperbolic tangent of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseHyperbolicCosine(1.``````

#### Parameters

• number value: The value to take the inverse hyperbolic tangent of.

#### Return

number: Returns the number result.

### InverseSine(number value)

This action calculates the inverse sine of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseSine(1.``````

#### Parameters

• number value: The value to take the inverse sine of.

#### Return

number: Returns the number result.

### InverseTangent(number x, number y)

This action calculates the inverse tangent of a cartesian point, where its coordinates are of the form (x, y).

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseTangent(0.8,``````

#### Parameters

• number x: The x value of the cartesian point.
• number y: The y value of the cartesian point.

#### Return

number: Returns the inverse tangent of the point as a number in radians.

### InverseTangent(number value)

This action calculates the inverse tangent of a number value in radians.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:InverseTangent(1.``````

#### Parameters

• number value: The value to take the inverse tangent of.

#### Return

number: Returns the number result.

number:

### Logarithm(number value)

This action calculates the logarithm with base 10 of a number value.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Logarithm(17.``````

#### Parameters

• number value: The value to take the logarithm of.

#### Return

number: Returns the number result.

### MaximumOf(number a, number b)

This action calculates the maximum between two number

number:

### MinimumOf(number a, number b)

This action calculates the minimum between two number

number:

### NaturalLogarithm(number value)

This action calculates the natural logarithm with base ''e'' of a number value.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:NaturalLogarithm(17.``````

#### Parameters

• number value: The value to take the natural logarithm of.

#### Return

number: Returns the number result.

This action converts a number from a value in radians to a value in degrees.

Example Code

``````use Libraries.Compute.Math
Math math

#### Return

number: Returns the value of the given number as degrees.

### RaiseNaturalNumberToPower(number power)

This action raises the natural number 'e' to the power of x.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:RaiseNaturalNumberToPower(``````

#### Parameters

• number power: the power to raise e to.

#### Return

number: Returns the number result.

### RaiseToPower(number value, number power)

This action raises a value to the power of some number(for example "value^power").

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:RaiseToPower(13,``````

#### Parameters

• number value: The value to raise.
• number power: The power.

#### Return

number: Returns the number result.

### Remainder(number a, number b)

This action calculates the remainder between two number

#### Return

number:

### Round(number value)

This action rounds a number to the closest integer value. A midpoint value (5) will round up.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Round(11.93235``````

#### Parameters

• number value: The value to round.

#### Return

number: the number result.

### Round(number value, boolean roundUp)

This action rounds a number to the nearest integer and will either round up or down when at a midpoint.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Round(11.532356, tru``````

#### Parameters

• number value: The value to round.
• boolean roundUp: When roundUp is true rounding from a midpoint will round up. When it is false the number will be round down.

#### Return

number: the number result.

### Round(number value, integer decimalPlace)

This action rounds a number to the given number of decimal places.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Round(11.932356,``````

#### Parameters

• number value: The value to round.
• integer decimalPlace: The number of decimal places to round to.

#### Return

number: the number result.

### Round(number value, integer decimalPlace, boolean roundUp)

This action rounds a number to the given number of decimal places and will either round up or down when at a midpoint.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Round(11.932356,``````

#### Parameters

• number value: The value to round.
• integer decimalPlace: The number of decimal places to round to.
• boolean roundUp: When roundUp is true rounding from a midpoint will round up. When it is false the number will be round down.

#### Return

number: the number result.

### RoundToNearestInteger(number value)

This action rounds a number to the closest integer value. A midpoint value (5) will round up.

Example Code

``````use Libraries.Compute.Math

Math math
number result = math:RoundToNearestInteger(11.93235``````

#### Parameters

• number value: The value to round.

#### Return

number: the number result.

### Sine(number value)

This action calculates the sine of a number in radians and returns the result.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:Sine(11.``````

#### Parameters

• number value: The value that the sine will be calculated from.

#### Return

number: Returns the sine of the parameter value. The type returned is number.

### SquareRoot(number value)

This action calculates the square root of a number value.

Example Code

``````use Libraries.Compute.Math
Math math
number result = math:SquareRoot(``````

#### Parameters

• number value: The value to take the square root of.

#### Return

number: Returns the number result.

### Tangent(number value)

This action calculates the tangent of a number in radians and returns the result.

Example Code

``````use Libraries.Compute.Math
Math math
number cosine = math:Tangent(11.``````

#### Parameters

• number value: The value that the tangent will be calculated from.

#### Return

number: Returns the tangent of the parameter value. The type returned is number.