Math and Trigonometry

Classes

iso

Members

(static) ceilingMath

See
  • ceiling.math

(static) ceilingPrecise

See
  • ceiling.precise

Methods

(inner) abs(…value) → {number}

Returns the absolute (unsigned) value of one or more number(s).

Category: Math and trigonometry

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. The numbers whose absolute value is to be calculated. Any number whether positive or negative, whole or fractional, integer or real.

See
Returns:

Number or number list. The absolute values of value. and www.oasis-open.org

Type: 
number
Examples
rosetta.abs(-3); // returns 3
rosetta.abs(-3,-4,-5); // returns [3,4,5]

(inner) acos(…value) → {number}

Returns the arccosine (inverse cosine) of a number using the cosine of an angle.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. A cosine of an angle, from -1 through 1.

See
Returns:

Number or number list. The trigonometric arccosine of value. An angle, in radians, from 0 through pi. This represents an angle between 0 and 180 degrees. and www.oasis-open.org

Type: 
number
Examples
rosetta.acos(.5); // returns 1.0471975511965979
rosetta.acos(.5,.6,.7); // returns [1.0471975511965979, 0.9272952180016123, 0.7953988301841436]

(inner) acosh(number) → {number}

Returns the inverse hyperbolic cosine of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number equal to or greater than 1.

See
Returns:

Number that is the trigonometric inverse hyperbolic cosine of the number.

Type: 
number
Example
rosetta.acosh(1); // returns 0

(inner) acot(number) → {number}

Returns the inverse cotangent of a number.

Parameters:
NameTypeDescription
numbernumber

Number that is the cotangent of the angle you want. This must be a real number.

See
Returns:

Number that is the trigonometric inverse cotangent of the number.

Type: 
number
Example
rosetta.acot(1); // returns 0.7853981633974483

(inner) acoth(number) → {number}

Returns the inverse hyperbolic cotangent of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number equal to or greater than 1.

See
Returns:

Number that is the trigonometric inverse hyperbolic cotangent of the number.

Type: 
number
Example
rosetta.acoth(1); // returns Infinity

(inner) add(num1, num2) → {number}

Returns the sum of the two given numbers.

Parameters:
NameTypeDescription
num1number

Number that is the first addend.

num2number

Number that is the second addend.

See
Returns:

The sum of the addends.

Type: 
number
Example
rosetta.add(1.2, 4) // returns 5.2

(inner) aggregate(function_num, options, ref1, ref2opt) → {number}

Returns an aggregate in a list or database.

Parameters:
NameTypeAttributesDescription
function_numnumber

A number 1 to 19 that specifies which function to use.

optionsnumber

A numerical value that determines which values to ignore in the evaluation range for the function. Note: The function will not ignore hidden rows, nested subtotals or nested aggregates if the array argument includes a calculation, for example: =AGGREGATE(14,3,A1:A100*(A1:A100>0),1)

ref1number | Array.<number>

The first numeric argument for functions that take multiple numeric arguments for which you want the aggregate value.

ref2number<optional>

Optional. Numeric arguments 2 to 253 for which you want the aggregate value. For functions that take an array, ref1 is an array, an array formula, or a reference to a range of values for which you want the aggregate value. Ref2 is a second argument that is required for certain functions.

See
Returns:

Number that is the aggregate of the input in a list or database.

Type: 
number
Example
rosetta.aggregate(1, 4, [1, 2, 3]) // returns 2

(inner) arabic(text) → {number}

Converts a Roman number to Arabic, as a number.

Parameters:
NameTypeDescription
textstring

String enclosed in quotation marks, an empty string (""), or a reference to a value containing text.

See
Returns:

Number that is the Arabic form of the given Roman number

Type: 
number
Example
rosetta.arabic('X') // returns 10

(inner) asin(…value) → {number}

Returns the arcsine (inverse sine) of a number using the sine of an angle.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. A sine of an angle, from -1 through 1.

See
Returns:

Number or number list. The trigonometric arcsine of value. An angle, in radians, from -pi/2 through pi/2. This represents an angle between -90 and 90 degrees. and www.oasis-open.org

Type: 
number
Examples
rosetta.asin(.5); // returns 0.5235987755982989
rosetta.asin(.5,.6,.7); // returns [0.5235987755982989, 0.6435011087932844, 0.775397496610753]

(inner) asinh(number) → {number}

Returns the inverse hyperbolic sine of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number.

See
Returns:

Number that is the trigonometric hyperbolic arcsine of the number.

Type: 
number
Example
rosetta.asinh(0.5); // returns 0.48121182505960347

(inner) atan(…value) → {number}

Returns the arc (inverse) tangent using the tangent of an angle.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. A tangent of an angle, from -1 through 1.

See
Returns:

Number or number list. The trigonometric arctan of value. An angle, in radians, from -pi/2 through pi/2. This represents an angle between -90 and 90 degrees. and www.oasis-open.org

Type: 
number
Examples
rosetta.atan(.5); // returns 0.4636476090008061
rosetta.atan(.5,.6,.7); // returns [0.4636476090008061, 0.5404195002705842, 0.6107259643892086]

(inner) atan2(x, y) → {number}

Returns the arc (inverse) tangent using the tangent x- and y-coordinates.

Parameters:
NameTypeDescription
xnumber

Number or number list. The denominator of the tangent value y / x.

ynumber

Number or number list. The numerator of the tangent value y / x.

See
Returns:

Number or number list. The trigonometric arctangent of y / x. An angle, in radians, from -pi through pi. This represents an angle between -180 and 180 degrees, depending on the sign of x and y. and www.oasis-open.org

Type: 
number
Examples
rosetta.atan2(1,1); // returns 0.7853981633974483
rosetta.atan2([1,2,3],[1,2,3]); // returns [0.7853981633974483, 0.7853981633974483, 0.7853981633974483]

(inner) atanh(number) → {number}

Returns the inverse hyperbolic tangent of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number between 1 and -1.

See
Returns:

Number that is the trigonometric hyperbolic arctangent of the number.

Type: 
number
Example
rosetta.atanh(1); // returns Infinity

(inner) base(number, radix, min_lengthopt) → {string}

Converts a number into a text representation with the given radix (base).

Parameters:
NameTypeAttributesDescription
numbernumber

The number that you want to convert. Must be an integer greater than or equal to 0 and less than 2^53.

radixnumber

The base radix that you want to convert the number into. Must be an integer greater than or equal to 2 and less than or equal to 36.

min_lengthnumber<optional>

The minimum length of the returned string. Must be an integer greater than or equal to 0.

See
Returns:

Number that is the text representation with the given radix (base).

Type: 
string
Examples
rosetta.base(7, 2); // returns '111'
rosetta.base(15,2,10); // returns '0000001111'

(inner) ceiling(number, significance, modeopt) → {number}

Rounds a number to the nearest integer or to the nearest multiple of significance.

Parameters:
NameTypeAttributesDescription
numbernumber

The value you want to round.

significancenumber

The multiple to which you want to round.

modenumber<optional>

Optional. For negative numbers, controls whether number is rounded toward or away from zero.

Returns:

Number that is the result of rounding the provided number

Type: 
number

(inner) combin(number, number_chosen) → {number}

Returns the number of combinations for a given number of objects.

Parameters:
NameTypeDescription
numbernumber

The number of items.

number_chosennumber

The number of items in each combination.

See
Returns:

Number of combinations for the given number of items.

Type: 
number
Example
rosetta.combin(3, 2) // returns 3

(inner) combina(number, number_chosen) → {number}

Returns the number of combinations with repetitions for a given number of items.

Parameters:
NameTypeDescription
numbernumber

The number of items. Must be greater than or equal to 0, and greater than or equal to Number_chosen. Non-integer values are truncated.

number_chosennumber

The number of items in each combination. Must be greater than or equal to 0. Non-integer values are truncated.

See
Returns:

Number of combinations (with repititions) for the given number of items.

Type: 
number
Example
rosetta.combina(3, 2) // returns 6

(inner) cos(…angle) → {number}

Given an angle in radians, returns the cosine of the angle. In a right triangle, the cosine of an acute angle is the ratio of the length of its adjacent side to the length of the hypotenuse.

Parameters:
NameTypeAttributesDescription
anglenumber<repeatable>

Number or number list. An angle measured in radians for which you want the cosine.

See
Returns:

Number or number list. The cosine of angle, from -1 to 1. Rounded to 15 decimal places. and www.oasis-open.org

Type: 
number
Examples
rosetta.cos(.5); // returns 0.8775825618903728
rosetta.cos(.5,.6,.7); // returns [0.8775825618903728, 0.8253356149096783, 0.7648421872844885]

(inner) cosh(number) → {number}

Returns the hyperbolic cosine of the angle.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the hyperbolic cosine.

See
Returns:

Number that is the trigonometric hyperbolic cosine of angle

Type: 
number
Example
rosetta.cosh(0); // returns 1

(inner) cot(number) → {number}

Returns the cotangent of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the cotangent.

See
Returns:

Number that is the trigonometric cotangent of the number.

Type: 
number
Example
rosetta.cot(1); // returns 0.6420926159343306

(inner) coth(number) → {number}

Returns the hyperbolic cotangent of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the hyperbolic cotangent.

See
Returns:

Number that is the trigonometric hyperbolic cotangent of the number.

Type: 
number
Example
rosetta.coth(1); // returns 1.3130352854993312

(inner) csc(number) → {number}

Returns the cosecant of an angle.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the cosecant.

See
Returns:

Number that is the trigonometric cosecant of the number.

Type: 
number
Example
rosetta.csc(1); // returns 1.1883951057781212

(inner) csch(number) → {number}

Returns the hyperbolic cosecant of an angle.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the hyperbolic cosecant.

See
Returns:

Number that is the trigonometric hyperbolic cosecant of the number.

Type: 
number
Example
rosetta.csch(1); // returns 0.8509181282393216

(inner) decimal(text, radix) → {number}

Converts a text representation of a number in a given base into a decimal number.

Parameters:
NameTypeDescription
textstring

The number as text

radixnumber

The number as the base. Radix must be an integer.

See
Returns:

The converted number as a decimal.

Type: 
number
Example
rosetta.decimal('10', 2) // returns 2

(inner) degrees(angle) → {number}

Converts radians to degrees.

Parameters:
NameTypeDescription
anglenumber

The angle in radians that you want to convert.

See
Returns:

The converted angle in degrees.

Type: 
number
Example
rosetta.degrees(Math.PI) // returns 180

(inner) divide(dividend, divisor) → {number}

Returns the quotient of the two given numbers.

Parameters:
NameTypeDescription
dividendnumber

Number that is the dividend (numerator).

divisornumber

Number that is the divisor (denominator).

See
Returns:

The quotient of the two numbers.

Type: 
number
Example
rosetta.divide(10, 4) // returns 2.5

(inner) e() → {number}

Returns the mathematical constant e (approximately 2.718282).

Returns:

Number that is the mathematical constant e

Type: 
number
Example
rosetta.e() // returns 2.718282

(inner) eq(value1, value2) → {boolean}

Returns whether the first number is equal to the second number.

Parameters:
NameTypeDescription
value1number | string

The first value to compare.

value2number | string

The second value to compare.

See
Returns:

True if num1 is equal to num2

Type: 
boolean
Example
rosetta.eq(10, 10) // returns true

(inner) even(number) → {number}

Rounds a number up to the nearest even integer.

Parameters:
NameTypeDescription
numbernumber

The value to round.

See
Returns:

The number rounded up to the nearest even integer.

Type: 
number
Example
rosetta.even(3) // returns 4

(inner) exp(…power) → {number}

Returns e (approximately 2.718282) raised to the power of a given number.

Parameters:
NameTypeAttributesDescription
powernumber<repeatable>

Number or number list. The power to which you want to raise e.

See
Returns:

Number or number list. The number e raised to the power of the parameter. (this value can contain up to 14 decimal places). and www.oasis-open.org

Type: 
number
Examples
rosetta.exp(1); // returns 2.718281828459045
rosetta.exp(1,1); // returns [2.718281828459045, 2.718281828459045]

(inner) fact(number) → {number}

Returns the factorial of a number.

Parameters:
NameTypeDescription
numbernumber

The nonnegative number for which you want the factorial. If number is not an integer, it is truncated.

See
Returns:

The factorial of the given number.

Type: 
number
Example
rosetta.fact(6) // returns 720

(inner) factDouble(number) → {number}

Returns the double factorial of a number.

Parameters:
NameTypeDescription
numbernumber

The nonnegative number for which you want the double factorial. If number is not an integer, it is truncated.

See
Returns:

The double factorial of the given number.

Type: 
number
Example
rosetta.factDouble(10) // returns 3840

(inner) floatEq(number1, number2, confidence) → {number}

Compares two numbers for equality within a confidence range.

Parameters:
NameTypeDescription
number1number

Number or number list. Any numeric value.

number2number

Number or number list. Any numeric value.

confidencenumber

Number or number list. Optional (default is 0.0001).

See
Returns:

Returns 1 (true) if the difference of the numbers is less than the confidence range. Returns 0 (false) if the difference of the numbers exceeds or is equal to the confidence range.

Type: 
number
Examples
rosetta.floatEq(2.22, 2.24, 0.01); // returns false
rosetta.floatEq(2.22, 2.24, 0.03); // returns true
rosetta.floatEq([2.22, 2.24], [2.25, 2.26], 0.04); // returns true

(inner) floor(number, significance) → {number}

Rounds a number down, toward zero.

Parameters:
NameTypeDescription
numbernumber

The numeric value you want to round.

significancenumber

The multiple to which you want to round.

Returns:

The number rounded down to the nearest multiple given.

Type: 
number
Example
rosetta.floor(3.7, 2) // returns 2

(inner) gcd(…numbers) → {number}

Returns the greatest common divisor.

Parameters:
NameTypeAttributesDescription
numbersnumber<repeatable>

Number or number list. One is required, subsequent numbers are optional. 1 to 255 values for which you want the greatest common divisor. If any value is not an integer, it is truncated.

See
Returns:

Number that is the greatest common divisor.

Type: 
number
Example
rosetta.gcd(24, 36) // returns 12

(inner) gt(num1, num2) → {boolean}

Returns whether the first number is greater than the second number.

Parameters:
NameTypeDescription
num1number | string

The first number to compare.

num2number | string

The second number to compare.

See
Returns:

True if num1 is greater than num2

Type: 
boolean
Example
rosetta.gt(10, 4) // returns true

(inner) gte(num1, num2) → {boolean}

Returns whether the first number is greater than or equal to the second number.

Parameters:
NameTypeDescription
num1number | string

The first number to compare.

num2number | string

The second number to compare.

See
Returns:

True if num1 is greater than or equal to num2

Type: 
boolean
Example
rosetta.gte(10, 10) // returns true

(inner) int(number) → {number}

Truncates the values in a number or number list at the whole number, leaving off any decimals.

Parameters:
NameTypeDescription
numbernumber

Number that is the value you want to truncate.

See
Returns:

Number that is the truncated value.

Type: 
number
Example
rosetta.int(5.5); // returns 5

(inner) integer(…value) → {number}

Truncates the values in a number or number list at the whole number, leaving off any decimals.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. The value(s) that is the value you want to truncate.

See
Returns:

Number or number list. The value(s) that is the truncated value.

Type: 
number
Examples
rosetta.integer(5.5); // returns 5
rosetta.integer(5.5,6.6,7.7); // returns [5, 6, 7]

(inner) lcm(…numbers) → {number}

Returns the least common multiple.

Parameters:
NameTypeAttributesDescription
numbersnumber<repeatable>

Number or number list. One is required, subsequent numbers are optional. 1 to 255 values for which you want the least common multiple. If value is not an integer, it is truncated.

See
Returns:

Number that is the least common multiple.

Type: 
number
Example
rosetta.lcm(5, 1, 2) // returns 10

(inner) ln(…value) → {number}

Returns the natural log of a number. Natural logs use e (approximately 2.718282) as their base.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. May be any value greater than 0, and can contain up to 15 decimal places.

See
Returns:

Number or number list. The natural log of number. and www.oasis-open.org

Type: 
number
Examples
rosetta.ln(5); // returns 1.6094379124341003
rosetta.ln(5,6,7); // returns [1.6094379124341003, 1.791759469228055, 1.9459101490553132]

(inner) ln2() → {number}

Returns the natural logarithm of 2.

Returns:

Number, the natural log of 2.

Type: 
number
Example
rosetta.ln2(); // returns 0.6931471805599453

(inner) ln10() → {number}

Returns the natural logarithm of 10.

Returns:

Number, the natural log of 10.

Type: 
number
Example
rosetta.ln10(); // returns 2.302585092994046

(inner) log(value, baseopt) → {number}

Returns the common logarithm (base 10) of any number greater than zero.

Parameters:
NameTypeAttributesDefaultDescription
valuenumber

Number or number list. Number who's common logarithm will be returned. Must be larger than zero.

basenumber<optional>
10

Number, optional. The base of the logarithm. If base is omitted, it is assumed to be 10.

See
Returns:

Number or number list. The log of number. and www.oasis-open.org

Type: 
number
Examples
rosetta.log(4); // returns 0.602059991327962
rosetta.log(5,6,7); // returns [0.6989700043360187, 0.7781512503836435, 0.8450980400142567]

(inner) log2E() → {number}

Returns the base-2 logarithm of e.

Returns:

Number, the base-2 logarithm of e.

Type: 
number
Example
rosetta.log2E(); // returns 1.4426950408889634

(inner) log10(number) → {number}

Returns the base-10 logarithm of a number.

Parameters:
NameTypeDescription
numbernumber

The positive real number for which you want the base-10 logarithm.

See
Returns:

Number that is the base-10 logarithm of the given number.

Type: 
number
Example
rosetta.log10(10) // returns 1

(inner) log10E() → {number}

Returns the base-10 logarithm of e.

Returns:

Number, the base-10 logarithm of e.

Type: 
number
Example
rosetta.log10E(); // returns 0.4342944819032518

(inner) lt(num1, num2) → {boolean}

Returns whether the first number is less than the second number.

Parameters:
NameTypeDescription
num1number | string

The first number to compare.

num2number | string

The second number to compare.

See
Returns:

True if num1 is less than num2

Type: 
boolean
Example
rosetta.lt(10, 4) // returns false

(inner) lte(num1, num2) → {boolean}

Returns whether the first number is less than or equal to the second number.

Parameters:
NameTypeDescription
num1number | string

The first number to compare.

num2number | string

The second number to compare.

See
Returns:

True if num1 is less than or equal to num2

Type: 
boolean
Example
rosetta.lte(10, 10) // returns true

(inner) max(…values) → {number}

Returns the largest number in a single list, or the larger of two numbers or number lists.

Parameters:
NameTypeAttributesDescription
valuesnumber<repeatable>

Number or number list.

See
Returns:

Number or number list. The larger of the values provided. If the parameters are number lists, NotesFormula Max returns a list that is the result of pair-wise computation on the list values and OpenFormula Max concats the lists and returns the number result. and www.oasis-open.org

Type: 
number
Examples
rosetta.max(4,5,6); // returns 6
rosetta.max([5,8,6,7],[2,9,3]); // returns [5, 9, 6, 7] or 9

(inner) min(…values) → {number}

Returns the smallest number in a single list, or the smaller of two numbers or number lists.

Parameters:
NameTypeAttributesDescription
valuesnumber<repeatable>

Number or number list.

See
Returns:

Number or number list. NotesFormula Max returns a list that is the result of pair-wise computation on the list values and OpenFormula Max concats the lists and returns the number result. and www.oasis-open.org

Type: 
number
Examples
rosetta.min(4,5,6); // returns 4
rosetta.min([5,8,6,7],[2,9,3]); // returns [2, 8, 3, 7] or 2

(inner) minus(num1, num2) → {number}

Returns the difference between the two given numbers.

Parameters:
NameTypeDescription
num1number

Number that is being subtracted from.

num2number

Number that is being subtracted.

See
Returns:

The difference between the two numbers.

Type: 
number
Example
rosetta.minus(10, 4) // returns 6

(inner) mod(number, divisor) → {number}

Returns the remainder of a division operation.

Parameters:
NameTypeDescription
numbernumber

Number that is the dividend (numerator) to be divided.

divisornumber

Number that is the divisor (denominator) to be divide dividend by.

See
Returns:

Number that is the remainder of dividend divided by divisor. If the parameters are number lists, mod returns a list that is the result of pair-wise computation on the list values.

Type: 
number
Example
rosetta.mod(7,4); // returns 3

(inner) modulo(dividend, divisor) → {number}

Returns the remainder of a division operation.

Parameters:
NameTypeDescription
dividendnumber

Number or number list. The dividend (numerator) to be divided.

divisornumber

Number or number list. The divisor (denominator) to be divide dividend by.

See
Returns:

Number or number list. The remainder of dividend divided by divisor. If the parameters are number lists, mod returns a list that is the result of pair-wise computation on the list values.

Type: 
number
Examples
rosetta.modulo(7,4); // returns 3
rosetta.modulo([7,5],[4,3]); // returns [3,2]);

(inner) mRound(number, multiple) → {number}

Returns a number rounded to the desired multiple.

Parameters:
NameTypeDescription
numbernumber

Number that is the value to round.

multiplenumber

Number that is the multiple to which you want to round the number.

See
Returns:

Number that is rounded to the desired multiple.

Type: 
number
Example
rosetta.mRound(10, 3) // returns 9

(inner) multinomial(…numbers) → {number}

Returns the multinomial of a set of numbers.

Parameters:
NameTypeAttributesDescription
numbersnumber<repeatable>

Number or number list, one is required, subsequent numbers are optional. 1 to 255 values for which you want the multinomial.

See
Returns:

Number that is the multinomial of the set of given numbers.

Type: 
number
Example
rosetta.multinomial(2, 3, 4) // 1260

(inner) multiply(factor1, factor2) → {number}

Returns the product of the two given numbers.

Parameters:
NameTypeDescription
factor1number

Number that is the first factor being multiplied.

factor2number

Number that is the second factor being multiplied.

See
Returns:

The product of the two numbers.

Type: 
number
Example
rosetta.multiply(10, 4) // returns 40

(inner) ne(value1, value2) → {true}

Returns whether the first number is not equal to the second number.

Parameters:
NameTypeDescription
value1number | string

The first value to compare.

value2number | string

The second value to compare.

See
Returns:

True if num1 is not equal to num2

Type: 
true
Example
rosetta.ne(10, 10) // returns true

(inner) odd(number) → {number}

Rounds a number up to the nearest odd integer.

Parameters:
NameTypeDescription
numbernumber

The value to round.

See
Returns:

The number rounded up to the nearest odd integer.

Type: 
number
Example
rosetta.odd(4) // returns 5

(inner) pi() → {number}

Returns the constant value pi, accurate to fifteen decimal places. The value pi is the ratio of the circumference of a circle to its diameter.

See
Returns:

Returns the constant value pi, accurate to fifteen decimal places. 3.141592653589793 and www.oasis-open.org

Type: 
number

(inner) pow(base, exponent) → {number}

Returns the result of a number raised to a power.

Parameters:
NameTypeDescription
basenumber

The value that you want raised to exponent. May be positive or negative.

exponentnumber

The power to which the base number is raised.

See
Returns:

The value of base raised to the power of exponent.

Type: 
number
Example
rosetta.pow(4,2); // returns 16

(inner) power(base, exponent) → {number}

Returns the result of a number raised to a power.

Parameters:
NameTypeDescription
basenumber

Number or number list. The value that you want raised to exponent. May be positive or negative.

exponentnumber

Number or number list. The power to which the base number is raised.

See
Returns:

Number or number list. The value of base raised to the power of exponent. and www.oasis-open.org

Type: 
number
Examples
rosetta.power(4,2); // returns 16
rosetta.power([5,6],[2,2]); // returns [25, 36]

(inner) product(…numbers) → {number}

Multiplies the arguments.

Parameters:
NameTypeAttributesDescription
numbersnumber<repeatable>

Number or number list that you want to multiply, up to a maximum of 255 arguments.

See
Returns:

Number that is the product of the arguments.

Type: 
number
Example
rosetta.product([5, 15, 30]) // returns 2250

(inner) quotient(numerator, denominator) → {number}

Returns the integer portion of a division.

Parameters:
NameTypeDescription
numeratornumber

Number that is the dividend.

denominatornumber

Number that is the divisor.

See
Returns:

The quotient of the two arguments (integer portion).

Type: 
number
Example
rosetta.quotient(4.5, 3.1) // returns 1

(inner) radians(angle) → {number}

Converts degrees to radians.

Parameters:
NameTypeDescription
anglenumber

An angle in degrees that you want to convert.

See
Returns:

The converted angle in radians.

Type: 
number
Example
rosetta.radians(180) // returns Math.PI

(inner) rand() → {number}

Generates a random number between 0 and 1, inclusive.

See
Returns:

Random number between 0 and 1, inclusive.

Type: 
number

(inner) randBetween(bottom, top) → {number}

Returns a random number between the numbers you specify.

Parameters:
NameTypeDescription
bottomnumber

The smallest integer RANDBETWEEN will return.

topnumber

The largest integer RANDBETWEEN will return.

See
Returns:

A random number between the numbers you specify.

Type: 
number
Example
rosetta.randBetween(1, 10) // returns a number between 1 and 10 (inclusive)

(inner) random() → {number}

Generates a random number between 0 and 1, inclusive by calling open formula RAND

See
To Do
  • this needs to be implemented for NotesFormula with parameters
Returns:

Random number between 0 and 1, inclusive.

Type: 
number

(inner) roman(arabic_numeral) → {string}

Converts an arabic numeral to roman, as text.

Parameters:
NameTypeDescription
arabic_numeralnumber

Number that is the Arabic numeral you want converted.

See
Returns:

String that is the Roman numeral form of the given Arabic number

Type: 
string
Example
rosetta.roman(10) // returns 'X'

(inner) round(number, factor) → {number}

Rounds the designated number to the nearest whole number; if an additional number is specified, it is used as the rounding factor for notes or number of digits after the decimal to round to for Open Formula.

Parameters:
NameTypeDescription
numbernumber

Number or number list. Numbers to be rounded.

factornumber

Number. Optional. The rounding factor to use. If you don't specify a factor, the number is rounded to the nearest whole number. Notes

See
Returns:

Number or number list. The value of number, rounded to the specified factor or to the nearest whole number. If number is a list, each number in the list is rounded to the specified factor or to the nearest whole number. and www.oasis-open.org

Type: 
number
Examples
rosetta.round(2.15, 1); // returns 2.2 (openf)
rosetta.round([2.15,626.31], 1); // returns [2.2, 626.3] (openf)
rosetta.round(12338, 10); // returns 12340 (notesf)

(inner) roundDown(number, digits) → {number}

Rounds a number down, toward zero.

Parameters:
NameTypeDescription
numbernumber

Any real number that you want rounded down.

digitsnumber

The number of digits to which you want to round number.

See
Returns:

The number rounded down

Type: 
number
Examples
rosetta.roundDown(3.14159, 3) // returns 3.141
rosetta.roundDown(-3.14159, 1) // returns -3.1

(inner) roundUp(number, digits) → {number}

Rounds a number up, away from zero.

Parameters:
NameTypeDescription
numbernumber

Any real number that you want rounded up.

digitsnumber

The number of digits to which you want to round number.

See
Returns:

The number rounded up

Type: 
number
Examples
rosetta.roundUp(3.14159, 3) // returns 3.142
rosetta.roundUp(-3.14159, 1) // returns -3.2

(inner) sec(number) → {number}

Returns the secant of an angle.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the secant.

See
Returns:

Number that is the trigonometric secant of the number.

Type: 
number
Example
rosetta.sec(1); // returns 1.1883951057781212

(inner) sech(number) → {number}

Returns the hyperbolic secant of an angle.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the hyperbolic secant.

See
Returns:

Number that is the trigonometric hyberbolic secant of the number.

Type: 
number
Example
rosetta.sech(1); // returns 0.6480542736638855

(inner) seriesSum(x, power, step, coefficients) → {number}

Returns the sum of a power series based on the formula.

Parameters:
NameTypeDescription
xnumber

The input value to the power series.

powernumber

The initial power to which you want to raise x.

stepnumber

The step by which to increase n for each term in the series.

coefficientsArray.<number>

A set of coefficients by which each successive power of x is multiplied. The number of values in coefficients determines the number of terms in the power series. For example, if there are three values in coefficients, then there will be three terms in the power series.

See
Returns:

Number that is the sum of the given power series

Type: 
number
Example
rosetta.seriesSum( rosetta.pi() / 4, 0, 2,
           [ 1, -1 / rosetta.fact(2), 1 / rosetta.fact(4), -1 / rosetta.fact(6) ] )
           // returns 0.7071032148228457

(inner) sign(…value) → {number}

Indicates whether a number is positive, negative, or zero.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. The number whose sign you want to determine.

See
Returns:

Number or number list. May be any of the following values: signed number is negative, - 1, signed number is zero, 0, signed number is positive, 1 and www.oasis-open.org

Type: 
number
Examples
rosetta.sign(5); // returns 1
rosetta.sign(5,-6,7); // returns [1, -1, 1]

(inner) sin(…angle) → {number}

Given an angle in radians, returns the sine of the angle. In a right triangle, the sine of an acute angle is the ratio of the length of its opposite side to the length of the hypotenuse.

Parameters:
NameTypeAttributesDescription
anglenumber<repeatable>

Number or number list. An angle expressed in radians for which you want the sine.

See
Returns:

Number or number list. The sine of angle, from -1 to 1. Rounded to 15 decimal places. and www.oasis-open.org

Type: 
number
Examples
rosetta.sin(.5); // returns 0.479425538604203
rosetta.sin(.5,.6,.7); // returns [0.479425538604203, 0.5646424733950354, 0.644217687237691]

(inner) sinh(number) → {number}

Returns the hyperbolic sine of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number, angle measured in radians for which you want the hyperbolic sine.

See
Returns:

Number that is the trigonometric hyberbolic sine of the number.

Type: 
number
Example
rosetta.sinh(1); // returns 1.1752011936438014

(inner) sqrt(…value) → {number}

Given a number, returns its positive square root.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. The number whose square root you want to find. The number must be positive, otherwise sqrt returns an error.

See
Returns:

Number or number list. The square root of the number. and www.oasis-open.org

Type: 
number
Examples
rosetta.sqrt(25); // returns 5
rosetta.sqrt(16,64,25); // returns [4, 8, 5]

(inner) sqrtPi(number) → {number}

Returns the square root of (number * pi).

Parameters:
NameTypeDescription
numbernumber

The number by which pi is multiplied.

See
Returns:

Number that is the square root of (number * pi)

Type: 
number
Example
rosetta.sqrtPi(3) // returns 3.0699801238394655

(inner) subTotal(function_num, ref1) → {number}

Returns a subtotal in a list or database.

Parameters:
NameTypeDescription
function_numnumber

Number 1-11 or 101-111 that specifies the function to use for the subtotal. 1-11 includes manually-hidden rows, while 101-111 excludes them; filtered-out values are always excluded.

ref1Array.<number>

Number or number list. The first named range or reference for which you want the subtotal.

See
Returns:

The subtotal of the of a list or database

Type: 
number
Example
rosetta.subTotal(4, [1, 2, 3]) // returns 3 (max)

(inner) sum(…value) → {number}

Adds a set of numbers or number lists.

Parameters:
NameTypeAttributesDescription
valuenumber<repeatable>

Number or number list. The numbers used to calculate the sum.

See
Returns:

Number that is the sum of the value numbers. and www.oasis-open.org

Type: 
number
Examples
rosetta.sum(1, 2, 3); // returns 6
rosetta.sum([1, 2, 3], [1, 4]); // returns 11

(inner) sumIf(range, criteria, sum_rangeopt) → {number}

Adds the values specified by a given criteria.

Parameters:
NameTypeAttributesDescription
rangeArray

The range of values that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.

criteria*

The criteria in the form of a number, expression, a value reference, text, or a function that defines which values will be added.

sum_rangeArray.<number><optional>

Optional. The actual values to add, if you want to add values other than those specified in the range argument. If the sum_range argument is omitted, Excel adds the values that are specified in the range argument (the same values to which the criteria is applied). Sum_range should be the same size and shape as range. If it isn't, performance may suffer, and the formula will sum a range of values that starts with the first value in sum_range but has the same dimensions as range.

See
Returns:

The sum of the values specified by the given criteria.

Type: 
number
Example
rosetta.sumIf([1, 2, 3], '>1') // returns 5

(inner) sumIfs(…values) → {number}

Adds the values in a range that meet multiple criteria.

Parameters:
NameTypeAttributesDescription
valuesArray<repeatable>

The range of values that you want evaluated.

See
Returns:

The sum of the values that meet the given criteria.

Type: 
number
Example
rosetta.sumIfs([1, 2, 3], [4, 5, 6], '>4', [7, 8, 9], '<9') // returns 2

(inner) sumProduct(…args) → {number}

Returns the sum of the products of corresponding array components.

Parameters:
NameTypeAttributesDescription
argsArray<repeatable>

The range of values that you want evaluated.

See
Returns:

The sum of the products of corresponding array components.

Type: 
number
Example
rosetta.sumProduct([1, 4, 10], [0.55, 0.3, 0.1]) // returns 2.75

(inner) sumSq(…args) → {number}

Returns the sum of the squares of the arguments.

Parameters:
NameTypeAttributesDescription
argsnumber<repeatable>

Number or number list. One number is required, subsequent numbers are optional. 1 to 255 arguments for which you want the sum of the squares. You can also use a single array or a reference to an array instead of arguments separated by commas.

See
Returns:

The sum of the squares of the arguments.

Type: 
number
Example
rosetta.sumSq([1, 2, 3]) // returns 14

(inner) sumx2My2(array_x, array_y) → {number}

Returns the sum of the difference of squares of corresponding values in two arrays.

Parameters:
NameTypeDescription
array_xArray.<number>

The first array or range of values.

array_yArray.<number>

The second array or range of values.

See
Returns:

The sum of the difference of squares of corresponding values in two arrays.

Type: 
number
Example
rosetta.sumx2My2([1, 2, 3], [4, 5, 6]) // returns -63

(inner) sumx2Py2(array_x, array_y) → {number}

Returns the sum of the sum of squares of corresponding values in two arrays.

Parameters:
NameTypeDescription
array_xArray.<number>

The first array or range of values.

array_yArray.<number>

The second array or range of values.

See
Returns:

The sum of the difference of squares of corresponding values in two arrays.

Type: 
number
Example
rosetta.sumx2Py2([1, 2, 3], [4, 5, 6]) // returns 91

(inner) sumxmy2(array_x, array_y) → {number}

Returns the sum of squares of differences of corresponding values in two arrays.

Parameters:
NameTypeDescription
array_xArray.<number>

The first array or range of values.

array_yArray.<number>

The second array or range of values.

See
Returns:

The sum of squares of differences of corresponding values in two arrays.

Type: 
number
Example
rosetta.sumxmy2([1, 2, 3], [4, 5, 6]) // returns 27

(inner) tan(…angle) → {number}

Given an angle in radians, returns the tangent of the angle. In a right triangle the tangent of an acute angle is the ratio of the length of the opposite side to the length of the adjacent side.

Parameters:
NameTypeAttributesDescription
anglenumber<repeatable>

Number or number list. An angle expressed in radians for which you want the tangent.

See
Returns:

Number or number list. The tangent of angle, rounded to 15 decimal places. and www.oasis-open.org

Type: 
number
Examples
rosetta.tan(.5); // returns 0.5463024898437905
rosetta.tan(.5,.6,.7); // returns [0.5463024898437905, 0.6841368083416923, 0.8422883804630794]

(inner) tanh(number) → {number}

Returns the hyperbolic tangent of a number.

Parameters:
NameTypeDescription
numbernumber

Any real number.

See
Returns:

The hyperbolic tangent of the number.

Type: 
number
Example
rosetta.tanh(0.5) // returns 0.46211715726000974

(inner) trunc(number, digitsopt) → {number}

Truncates a number to an integer or a specified precision.

Parameters:
NameTypeAttributesDescription
numbernumber

The number you want to truncate.

digitsnumber<optional>

Optional. A number specifying the precision of the truncation. The default value for num_digits is 0 (zero).

See
Returns:

The truncated for of the number with the given precision.

Type: 
number
Examples
rosetta.trunc(0.45) // returns 0
rosetta.trunc(12.3456, 2) // returns 12.34