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
    end

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
number pi
number e

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 a CompareResult.
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.
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.
Logarithm(number value)This action calculates the logarithm with base 10 of a number value.
NaturalLogarithm(number value)This action calculates the natural logarithm with base ''e'' of a number value.
RadiansToDegrees(number radians)This action converts a number from a value in radians to a value in degrees.
RaiseToPower(number value, number power)This action raises a value to the power of some number(for example "value^power").
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.
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.4)

Parameters

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(-2443)

Parameters

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 result

Parameters

Return

number: Returns the ceiling of a number.

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: 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.32)

Parameters

Return

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

DegreesToRadians(number degrees)

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

Example Code

use Libraries.Compute.Math
    Math math
    number radians = math:DegreesToRadians(75.4)

Parameters

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(t)

Parameters

Return

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

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 result

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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.3)

Parameters

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, 2)

Parameters

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.3)

Parameters

Return

number: Returns the number result.

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.2)

Parameters

Return

number: Returns the number result.

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.2)

Parameters

Return

number: Returns the number result.

RadiansToDegrees(number radians)

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

Example Code

use Libraries.Compute.Math
    Math math
    number degrees = math:RadiansToDegrees(2.8)

Parameters

Return

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

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,2)

Parameters

Return

number: Returns the number result.

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.932356)

Parameters

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, true)

Parameters

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, 3)

Parameters

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, 3)

Parameters

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.9)

Parameters

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(6)

Parameters

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.9)

Parameters

Return

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