"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ln10 = exports.lcm = exports.iso = exports.int = exports.gcd = exports.floor = exports.factDouble = exports.fact = exports.even = exports.degrees = exports.decimal = exports.csch = exports.csc = exports.coth = exports.cot = exports.cosh = exports.combina = exports.combin = exports.ceilingPrecise = exports.ceilingMath = exports.ceiling = exports.base = exports.atanh = exports.asinh = exports.arabic = exports.aggregate = exports.acoth = exports.acot = exports.acosh = exports.tan = exports.sum = exports.sqrt = exports.sin = exports.sign = exports.round = exports.power = exports.pi = exports.min = exports.max = exports.log = exports.ln = exports.exp = exports.cos = exports.atan2 = exports.atan = exports.asin = exports.acos = exports.abs = exports._notes = exports._openFormula = void 0;
exports.random = exports.modulo = exports.integer = exports.floatEq = exports.trunc = exports.tanh = exports.sumxmy2 = exports.sumx2Py2 = exports.sumx2My2 = exports.sumSq = exports.sumProduct = exports.sumIfs = exports.sumIf = exports.pow = exports.ne = exports.eq = exports.lte = exports.lt = exports.gte = exports.gt = exports.multiply = exports.divide = exports.minus = exports.add = exports.subTotal = exports.sqrtPi = exports.sinh = exports.seriesSum = exports.sech = exports.sec = exports.roundUp = exports.roundDown = exports.roman = exports.randBetween = exports.rand = exports.radians = exports.quotient = exports.product = exports.e = exports.odd = exports.multinomial = exports.mRound = exports.mod = exports.log10 = exports.log2E = exports.log10E = exports.ln2 = void 0;
const tslib_1 = require("tslib");
/**
* @file Math and Trigonometry
* @module math-trig
* @category Math & Trigonometry
*/
const openf = tslib_1.__importStar(require("../openformula/math-trig"));
exports._openFormula = openf;
const notesf = tslib_1.__importStar(require("../notes/math-trig"));
exports._notes = notesf;
const API = tslib_1.__importStar(require("../rosetta/API"));
const error = tslib_1.__importStar(require("../utils/error"));
//-----------------------------
// Rosetta math-trig - common functions (exist in both OpenFormula and Notes Formula)
/**
* Returns the absolute (unsigned) value of one or more number(s).
*
* Category: Math and trigonometry
*
* @param {number} value 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.
* @returns {number} Number or number list. The absolute values of value.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ABS|www.oasis-open.org}
* @example rosetta.abs(-3); // returns 3
* @example rosetta.abs(-3,-4,-5); // returns [3,4,5]
*/
function abs(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.ABS(n) : notesf.Abs(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.abs = abs;
/**
* Returns the arccosine (inverse cosine) of a number using the cosine of an angle.
*
* @param {number} value Number or number list. A cosine of an angle, from -1 through 1.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ACOS|www.oasis-open.org}
* @example rosetta.acos(.5); // returns 1.0471975511965979
* @example rosetta.acos(.5,.6,.7); // returns [1.0471975511965979, 0.9272952180016123, 0.7953988301841436]
*/
function acos(...value) {
if (!value.length) {
return API.isCurrentAPIOpenFormula() ? openf.ACOS(0) : notesf.ACos(0);
}
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.ACOS(n) : notesf.ACos(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.acos = acos;
/**
* Returns the arcsine (inverse sine) of a number using the sine of an angle.
* @param {number} value Number or number list. A sine of an angle, from -1 through 1.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ASIN|www.oasis-open.org}
* @example rosetta.asin(.5); // returns 0.5235987755982989
* @example rosetta.asin(.5,.6,.7); // returns [0.5235987755982989, 0.6435011087932844, 0.775397496610753]
*/
function asin(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.ASIN(n) : notesf.ASin(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.asin = asin;
/**
* Returns the arc (inverse) tangent using the tangent of an angle.
* @param {number} value Number or number list. A tangent of an angle, from -1 through 1.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ATAN|www.oasis-open.org}
* @example rosetta.atan(.5); // returns 0.4636476090008061
* @example rosetta.atan(.5,.6,.7); // returns [0.4636476090008061, 0.5404195002705842, 0.6107259643892086]
*/
function atan(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.ATAN(n) : notesf.ATan(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.atan = atan;
/**
* Returns the arc (inverse) tangent using the tangent x- and y-coordinates.
* @param {number} x Number or number list. The denominator of the tangent value y / x.
* @param {number} y Number or number list. The numerator of the tangent value y / x.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ATAN2|www.oasis-open.org}
* @example rosetta.atan2(1,1); // returns 0.7853981633974483
* @example rosetta.atan2([1,2,3],[1,2,3]); // returns [0.7853981633974483, 0.7853981633974483, 0.7853981633974483]
*/
function atan2(x, y) {
let list = [];
let xx = Array.isArray(x) ? x : [x];
let yy = Array.isArray(y) ? y : [y];
if (xx.length >= yy.length) {
list = xx.map((num, index) => index < yy.length ?
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.ATAN2(xx[index], yy[index]) : notesf.ATan2(xx[index], yy[index]) :
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.ATAN2(xx[index], yy[yy.length - 1]) : notesf.ATan2(xx[index], yy[yy.length - 1]));
}
else {
list = yy.map((num, index) => index < xx.length ?
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.ATAN2(xx[index], yy[index]) : notesf.ATan2(xx[index], yy[index]) :
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.ATAN2(xx[xx.length - 1], yy[index]) : notesf.ATan2(xx[xx.length - 1], yy[index]));
}
return list.length === 1 ? list[0] : list;
}
exports.atan2 = atan2;
/**
* 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.
* @param {number} angle Number or number list. An angle measured in radians for which you want the cosine.
* @returns {number} Number or number list. The cosine of angle, from -1 to 1. Rounded to 15 decimal places.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#COS|www.oasis-open.org}
* @example rosetta.cos(.5); // returns 0.8775825618903728
* @example rosetta.cos(.5,.6,.7); // returns [0.8775825618903728, 0.8253356149096783, 0.7648421872844885]
*/
function cos(...angle) {
const list = angle.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.COS(n) : notesf.Cos(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.cos = cos;
/**
* Returns e (approximately 2.718282) raised to the power of a given number.
* @param {number} power Number or number list. The power to which you want to raise e.
* @returns {number} Number or number list. The number e raised to the power of the parameter. (this value can contain up to 14 decimal places).
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#EXP|www.oasis-open.org}
* @example rosetta.exp(1); // returns 2.718281828459045
* @example rosetta.exp(1,1); // returns [2.718281828459045, 2.718281828459045]
*/
function exp(...power) {
if (API.isCurrentAPIOpenFormula()) {
if (arguments.length < 1) {
return error.na;
}
if (arguments.length > 1) {
return error.error;
}
const list = power.map(n => n instanceof Error ? n : openf.EXP(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
else {
return notesf.Exp(...power);
}
}
exports.exp = exp;
/**
* Returns the natural log of a number. Natural logs use e (approximately 2.718282) as their base.
*
* @param {number} value Number or number list. May be any value greater than 0, and can contain up to 15 decimal places.
* @returns {number} Number or number list. The natural log of number.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#LN|www.oasis-open.org}
* @example rosetta.ln(5); // returns 1.6094379124341003
* @example rosetta.ln(5,6,7); // returns [1.6094379124341003, 1.791759469228055, 1.9459101490553132]
*/
function ln(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.LN(n) : notesf.Ln(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.ln = ln;
/**
* Returns the common logarithm (base 10) of any number greater than zero.
*
* @param {number} value Number or number list. Number who's common logarithm will be returned. Must be larger than zero.
* @param {number} [base] Number, optional. The base of the logarithm. If base is omitted, it is assumed to be 10.
* @returns {number} Number or number list. The log of number.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#LOG|www.oasis-open.org}
* @example rosetta.log(4); // returns 0.602059991327962
* @example rosetta.log(5,6,7); // returns [0.6989700043360187, 0.7781512503836435, 0.8450980400142567]
*/
function log(value, base = 10) {
let list = [];
let num = Array.isArray(value) ? value : [value];
list = num.map(n => API.isCurrentAPIOpenFormula() ? openf.LOG(n, base) : notesf.Log(n));
return list.length === 1 ? list[0] : list;
}
exports.log = log;
/**
* Returns the largest number in a single list, or the larger of two numbers or number lists.
*
* @param {number} values Number or number list.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#MAX|www.oasis-open.org}
* @example rosetta.max(4,5,6); // returns 6
* @example rosetta.max([5,8,6,7],[2,9,3]); // returns [5, 9, 6, 7] or 9
*/
function max(...values) {
return API.isCurrentAPIOpenFormula() ? openf.MAX(...values) : notesf.Max(...values);
}
exports.max = max;
/**
* Returns the smallest number in a single list, or the smaller of two numbers or
* number lists.
*
* @param {number} values Number or number list.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#MIN|www.oasis-open.org}
* @example rosetta.min(4,5,6); // returns 4
* @example rosetta.min([5,8,6,7],[2,9,3]); // returns [2, 8, 3, 7] or 2
*/
function min(...values) {
return API.isCurrentAPIOpenFormula() ? openf.MIN(...values) : notesf.Min(...values);
}
exports.min = min;
/**
* 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.
*
* @returns {number} Returns the constant value pi, accurate to fifteen decimal places. 3.141592653589793
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#PI|www.oasis-open.org}
*/
function pi() {
return API.isCurrentAPIOpenFormula() ? openf.PI() : notesf.Pi();
}
exports.pi = pi;
/**
* Returns the result of a number raised to a power.
*
* @param {number} base Number or number list. The value that you want raised to exponent. May be
* positive or negative.
* @param {number} exponent Number or number list. The power to which the base number is raised.
* @returns {number} Number or number list. The value of base raised to the power of exponent.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#POWER|www.oasis-open.org}
* @example rosetta.power(4,2); // returns 16
* @example rosetta.power([5,6],[2,2]); // returns [25, 36]
*/
function power(base, exponent) {
let list = [];
let bs = Array.isArray(base) ? base : [base];
let exp = Array.isArray(exponent) ? exponent : [exponent];
if (bs.length >= exp.length) {
list = bs.map((num, index) => index < exp.length ?
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.POWER(bs[index], exp[index]) : notesf.Power(bs[index], exp[index]) :
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.POWER(bs[index], exp[exp.length - 1]) : notesf.Power(bs[index], exp[exp.length - 1]));
}
else {
list = exp.map((num, index) => index < bs.length ?
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.POWER(bs[index], exp[index]) : notesf.Power(bs[index], exp[index]) :
num instanceof Error ? num : API.isCurrentAPIOpenFormula() ? openf.POWER(bs[bs.length - 1], exp[index]) : notesf.Power(bs[bs.length - 1], exp[index]));
}
return list.length === 1 ? list[0] : list;
}
exports.power = power;
/**
* 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.
*
* @param {number} number Number or number list. Numbers to be rounded.
* @param {number} factor Number. Optional. The rounding factor to use. If you don't specify
* a factor, the number is rounded to the nearest whole number. Notes
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#ROUND|www.oasis-open.org}
* @example rosetta.round(2.15, 1); // returns 2.2 (openf)
* @example rosetta.round([2.15,626.31], 1); // returns [2.2, 626.3] (openf)
* @example rosetta.round(12338, 10); // returns 12340 (notesf)
*/
function round(number, factor) {
let list = [];
let num = Array.isArray(number) ? number : [number];
// digits is optional but cannot be an array
if (Array.isArray(factor)) {
return new Error('#VALUE!');
}
// round to nearest whole number if no digits provided (digits = 0)
list = num.map(n => factor === undefined ?
API.isCurrentAPIOpenFormula() ? openf.ROUND(n, 0) : notesf.Round(n) :
API.isCurrentAPIOpenFormula() ? openf.ROUND(n, factor) : notesf.Round(n, factor));
return list.length === 1 ? list[0] : list;
}
exports.round = round;
/**
* Indicates whether a number is positive, negative, or zero.
* @param {number} value Number or number list. The number whose sign you want to determine.
* @returns {number} 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 {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#SIGN|www.oasis-open.org}
* @example rosetta.sign(5); // returns 1
* @example rosetta.sign(5,-6,7); // returns [1, -1, 1]
*/
function sign(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.SIGN(n) : notesf.Sign(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.sign = sign;
/**
* 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.
* @param {number} angle Number or number list. An angle expressed in radians for which you want the sine.
* @returns {number} Number or number list. The sine of angle, from -1 to 1. Rounded to 15 decimal places.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#SIN|www.oasis-open.org}
* @example rosetta.sin(.5); // returns 0.479425538604203
* @example rosetta.sin(.5,.6,.7); // returns [0.479425538604203, 0.5646424733950354, 0.644217687237691]
*/
function sin(...angle) {
const list = angle.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.SIN(n) : notesf.Sin(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.sin = sin;
/**
* Given a number, returns its positive square root.
* @param {number} value Number or number list. The number whose square root you want to find.
* The number must be positive, otherwise sqrt returns an error.
* @returns {number} Number or number list. The square root of the number.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#SQRT|www.oasis-open.org}
* @example rosetta.sqrt(25); // returns 5
* @example rosetta.sqrt(16,64,25); // returns [4, 8, 5]
*/
function sqrt(...value) {
const list = value.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.SQRT(n) : notesf.Sqrt(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.sqrt = sqrt;
/**
* Adds a set of numbers or number lists.
* @param {number} value Number or number list. The numbers used to calculate the sum.
* @returns {number} Number that is the sum of the value numbers.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#SUM|www.oasis-open.org}
* @example rosetta.sum(1, 2, 3); // returns 6
* @example rosetta.sum([1, 2, 3], [1, 4]); // returns 11
*/
function sum(...value) {
return API.isCurrentAPIOpenFormula() ? openf.SUM(...value) : notesf.Sum(...value);
}
exports.sum = sum;
/**
* 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.
* @param {number} angle Number or number list. An angle expressed in radians for which you want the tangent.
* @returns {number} Number or number list. The tangent of angle, rounded to 15 decimal places.
* and {@link https://www.oasis-open.org/committees/download.php/16826/openformula-spec-20060221.html#TAN|www.oasis-open.org}
* @example rosetta.tan(.5); // returns 0.5463024898437905
* @example rosetta.tan(.5,.6,.7); // returns [0.5463024898437905, 0.6841368083416923, 0.8422883804630794]
*/
function tan(...angle) {
const list = angle.map(n => n instanceof Error ? n : API.isCurrentAPIOpenFormula() ? openf.TAN(n) : notesf.Tan(n));
return list.length ? (list.length === 1 ? list[0] : list) : 0;
}
exports.tan = tan;
//-----------------------------
// Open Formula math-trig
/**
* Returns the inverse hyperbolic cosine of a number.
*
* @param {number} number Any real number equal to or greater than 1.
* @returns {number} Number that is the trigonometric inverse hyperbolic cosine of the number.
* @example rosetta.acosh(1); // returns 0
*/
function acosh(number) {
return openf.ACOSH(number);
}
exports.acosh = acosh;
/**
* Returns the inverse cotangent of a number.
*
* @param {number} number Number that is the cotangent of the angle you want. This must be a real number.
* @returns {number} Number that is the trigonometric inverse cotangent of the number.
* @example rosetta.acot(1); // returns 0.7853981633974483
*/
function acot(number) {
return openf.ACOT(number);
}
exports.acot = acot;
/**
* Returns the inverse hyperbolic cotangent of a number.
*
* @param {number} number Any real number equal to or greater than 1.
* @returns {number} Number that is the trigonometric inverse hyperbolic cotangent of the number.
* @example rosetta.acoth(1); // returns Infinity
*/
function acoth(number) {
return openf.ACOTH(number);
}
exports.acoth = acoth;
/**
* Returns an aggregate in a list or database.
* @param {number} function_num A number 1 to 19 that specifies which function to use.
* @param {number} options 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)
* @param {number | number[]} ref1 The first numeric argument for functions that take multiple
* numeric arguments for which you want the aggregate value.
* @param {number} [ref2] 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.
* @returns {number} Number that is the aggregate of the input in a list or database.
* @example rosetta.aggregate(1, 4, [1, 2, 3]) // returns 2
*/
function aggregate(function_num, options, ref1, ref2) {
return openf.AGGREGATE(function_num, options, ref1, ref2);
}
exports.aggregate = aggregate;
/**
* Converts a Roman number to Arabic, as a number.
* @param {string} text String enclosed in quotation marks, an empty string (""), or a reference to a value containing text.
* @returns {number} Number that is the Arabic form of the given Roman number
* @example rosetta.arabic('X') // returns 10
*/
function arabic(text) {
return openf.ARABIC(text);
}
exports.arabic = arabic;
/**
* Returns the inverse hyperbolic sine of a number.
* @param {number} number Any real number.
* @returns {number} Number that is the trigonometric hyperbolic arcsine of the number.
* @example rosetta.asinh(0.5); // returns 0.48121182505960347
*/
function asinh(number) {
return openf.ASINH(number);
}
exports.asinh = asinh;
/**
* Returns the inverse hyperbolic tangent of a number.
* @param {number} number Any real number between 1 and -1.
* @returns {number} Number that is the trigonometric hyperbolic arctangent of the number.
* @example rosetta.atanh(1); // returns Infinity
*/
function atanh(number) {
return openf.ATANH(number);
}
exports.atanh = atanh;
/**
* Converts a number into a text representation with the given radix (base).
* @param {number} number The number that you want to convert. Must be an integer greater than or equal to 0 and less than 2^53.
* @param {number} radix 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.
* @param {number} [min_length] The minimum length of the returned string. Must be an integer greater than or equal to 0.
* @returns {string} Number that is the text representation with the given radix (base).
* @example rosetta.base(7, 2); // returns '111'
* @example rosetta.base(15,2,10); // returns '0000001111'
*/
function base(number, radix, min_length) {
return openf.BASE(number, radix, min_length);
}
exports.base = base;
/**
* Rounds a number to the nearest integer or to the nearest multiple of significance.
* @param {number} number The value you want to round.
* @param {number} significance The multiple to which you want to round.
* @param {number} [mode] Optional. For negative numbers, controls whether number is rounded toward or away from zero.
* @returns {number} Number that is the result of rounding the provided number
*/
function ceiling(number, significance, mode) {
return openf.CEILING.MATH(number, significance, mode);
}
exports.ceiling = ceiling;
ceiling.math = ceiling;
/** @see ceiling.math */
exports.ceilingMath = ceiling.math;
ceiling.precise = ceiling;
/** @see ceiling.precise */
exports.ceilingPrecise = ceiling.precise;
/**
* Returns the number of combinations for a given number of objects.
* @param {number} number The number of items.
* @param {number} number_chosen The number of items in each combination.
* @returns {number} Number of combinations for the given number of items.
* @example rosetta.combin(3, 2) // returns 3
*/
function combin(number, number_chosen) {
return openf.COMBIN(number, number_chosen);
}
exports.combin = combin;
/**
* Returns the number of combinations with repetitions for a given number of items.
* @param {number} number 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.
* @param {number} number_chosen The number of items in each combination. Must be greater than or equal to 0.
* Non-integer values are truncated.
* @returns {number} Number of combinations (with repititions) for the given number of items.
* @example rosetta.combina(3, 2) // returns 6
*/
function combina(number, number_chosen) {
return openf.COMBINA(number, number_chosen);
}
exports.combina = combina;
/**
* Returns the hyperbolic cosine of the angle.
* @param {number} number Any real number, angle measured in radians for which you want the hyperbolic cosine.
* @returns {number} Number that is the trigonometric hyperbolic cosine of angle
* @example rosetta.cosh(0); // returns 1
*/
function cosh(number) {
return openf.COSH(number);
}
exports.cosh = cosh;
/**
* Returns the cotangent of a number.
* @param {number} number Any real number, angle measured in radians for which you want the cotangent.
* @returns {number} Number that is the trigonometric cotangent of the number.
* @example rosetta.cot(1); // returns 0.6420926159343306
*/
function cot(number) {
return openf.COT(number);
}
exports.cot = cot;
/**
* Returns the hyperbolic cotangent of a number.
*
* @param {number} number Any real number, angle measured in radians for which you want the hyperbolic cotangent.
* @returns {number} Number that is the trigonometric hyperbolic cotangent of the number.
* @example rosetta.coth(1); // returns 1.3130352854993312
*/
function coth(number) {
return openf.COTH(number);
}
exports.coth = coth;
/**
* Returns the cosecant of an angle.
*
* @param {number} number Any real number, angle measured in radians for which you want the cosecant.
* @returns {number} Number that is the trigonometric cosecant of the number.
* @example rosetta.csc(1); // returns 1.1883951057781212
*/
function csc(number) {
return openf.CSC(number);
}
exports.csc = csc;
/**
* Returns the hyperbolic cosecant of an angle.
* @param {number} number Any real number, angle measured in radians for which you want the hyperbolic cosecant.
* @returns {number} Number that is the trigonometric hyperbolic cosecant of the number.
* @example rosetta.csch(1); // returns 0.8509181282393216
*/
function csch(number) {
return openf.CSCH(number);
}
exports.csch = csch;
/**
* Converts a text representation of a number in a given base into a decimal number.
* @param {string} text The number as text
* @param {number} radix The number as the base. Radix must be an integer.
* @returns {number} The converted number as a decimal.
* @example rosetta.decimal('10', 2) // returns 2
*/
function decimal(text, radix) {
if (arguments.length < 1) {
return error.value;
}
return openf.DECIMAL(text, radix);
}
exports.decimal = decimal;
/**
* Converts radians to degrees.
* @param {number} angle The angle in radians that you want to convert.
* @returns {number} The converted angle in degrees.
* @example rosetta.degrees(Math.PI) // returns 180
*/
function degrees(angle) {
return openf.DEGREES(angle);
}
exports.degrees = degrees;
/**
* Rounds a number up to the nearest even integer.
* @param {number} number The value to round.
* @returns {number} The number rounded up to the nearest even integer.
* @example rosetta.even(3) // returns 4
*/
function even(number) {
return openf.EVEN(number);
}
exports.even = even;
/**
* Returns the factorial of a number.
* @param {number} number The nonnegative number for which you want the factorial. If number is not an integer, it is truncated.
* @returns {number} The factorial of the given number.
* @example rosetta.fact(6) // returns 720
*/
function fact(number) {
return openf.FACT(number);
}
exports.fact = fact;
/**
* Returns the double factorial of a number.
* @param {number} number The nonnegative number for which you want the double factorial. If number is not an integer, it is truncated.
* @returns {number} The double factorial of the given number.
* @example rosetta.factDouble(10) // returns 3840
*/
function factDouble(number) {
return openf.FACTDOUBLE(number);
}
exports.factDouble = factDouble;
/**
* Rounds a number down, toward zero.
* @param {number} number The numeric value you want to round.
* @param {number} significance The multiple to which you want to round.
* @returns {number} The number rounded down to the nearest multiple given.
* @example rosetta.floor(3.7, 2) // returns 2
*/
function floor(number, significance) {
return openf.FLOOR(number, significance);
}
exports.floor = floor;
/** @see floor */
floor.math = function (number, significance, mode) {
return openf.FLOOR.MATH(number, significance, mode);
};
/** @see floor.math */
floor.precise = floor.math;
/**
* Returns the greatest common divisor.
* @param {number} numbers 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.
* @returns {number} Number that is the greatest common divisor.
* @example rosetta.gcd(24, 36) // returns 12
*/
function gcd(...numbers) {
return openf.GCD(...numbers);
}
exports.gcd = gcd;
/**
* Truncates the values in a number or number list at the whole number, leaving off
* any decimals.
*
* @param {number} number Number that is the value you want to truncate.
* @returns {number} Number that is the truncated value.
* @example rosetta.int(5.5); // returns 5
*/
function int(number) {
return openf.INT(number);
}
exports.int = int;
/** @class */
exports.iso = {
ceiling: ceiling
};
/**
* Returns the least common multiple.
* @param {number} numbers 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.
* @returns {number} Number that is the least common multiple.
* @example rosetta.lcm(5, 1, 2) // returns 10
*/
function lcm(...numbers) {
return openf.LCM(...numbers);
}
exports.lcm = lcm;
/**
* Returns the natural logarithm of 10.
*
* @returns {number} Number, the natural log of 10.
* @example rosetta.ln10(); // returns 2.302585092994046
*/
function ln10() {
return openf.LN10();
}
exports.ln10 = ln10;
/**
* Returns the natural logarithm of 2.
*
* @returns {number} Number, the natural log of 2.
* @example rosetta.ln2(); // returns 0.6931471805599453
*/
function ln2() {
return openf.LN2();
}
exports.ln2 = ln2;
/**
* Returns the base-10 logarithm of e.
*
* @returns {number} Number, the base-10 logarithm of e.
* @example rosetta.log10E(); // returns 0.4342944819032518
*/
function log10E() {
return openf.LOG10E();
}
exports.log10E = log10E;
/**
* Returns the base-2 logarithm of e.
*
* @returns {number} Number, the base-2 logarithm of e.
* @example rosetta.log2E(); // returns 1.4426950408889634
*/
function log2E() {
return openf.LOG2E();
}
exports.log2E = log2E;
/**
* Returns the base-10 logarithm of a number.
* @param {number} number The positive real number for which you want the base-10 logarithm.
* @returns {number} Number that is the base-10 logarithm of the given number.
* @example rosetta.log10(10) // returns 1
*/
function log10(number) {
return openf.LOG10(number);
}
exports.log10 = log10;
/**
* Returns the remainder of a division operation.
*
* @param {number} number Number that is the dividend (numerator) to be divided.
* @param {number} divisor Number that is the divisor (denominator) to be divide dividend by.
* @returns {number} 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.
* @example rosetta.mod(7,4); // returns 3
*/
function mod(number, divisor) {
return openf.MOD(number, divisor);
}
exports.mod = mod;
/**
* Returns a number rounded to the desired multiple.
* @param {number} number Number that is the value to round.
* @param {number} multiple Number that is the multiple to which you want to round the number.
* @returns {number} Number that is rounded to the desired multiple.
* @example rosetta.mRound(10, 3) // returns 9
*/
function mRound(number, multiple) {
return openf.MROUND(number, multiple);
}
exports.mRound = mRound;
/**
* Returns the multinomial of a set of numbers.
* @param {number} numbers Number or number list, one is required, subsequent numbers are optional. 1 to 255 values for which you want the multinomial.
* @returns {number} Number that is the multinomial of the set of given numbers.
* @example rosetta.multinomial(2, 3, 4) // 1260
*/
function multinomial(...numbers) {
return openf.MULTINOMIAL(...numbers);
}
exports.multinomial = multinomial;
/**
* Rounds a number up to the nearest odd integer.
* @param {number} number The value to round.
* @returns {number} The number rounded up to the nearest odd integer.
* @example rosetta.odd(4) // returns 5
*/
function odd(number) {
return openf.ODD(number);
}
exports.odd = odd;
/**
* Returns the mathematical constant e (approximately 2.718282).
* @returns {number} Number that is the mathematical constant e
* @example rosetta.e() // returns 2.718282
*/
function e() {
return openf.E();
}
exports.e = e;
/**
* Multiplies the arguments.
* @param {number} numbers Number or number list that you want to multiply, up to a maximum of 255 arguments.
* @returns {number} Number that is the product of the arguments.
* @example rosetta.product([5, 15, 30]) // returns 2250
*/
function product(...numbers) {
return openf.PRODUCT(...numbers);
}
exports.product = product;
/**
* Returns the integer portion of a division.
* @param {number} numerator Number that is the dividend.
* @param {number} denominator Number that is the divisor.
* @returns {number} The quotient of the two arguments (integer portion).
* @example rosetta.quotient(4.5, 3.1) // returns 1
*/
function quotient(numerator, denominator) {
return openf.QUOTIENT(numerator, denominator);
}
exports.quotient = quotient;
/**
* Converts degrees to radians.
* @param {number} angle An angle in degrees that you want to convert.
* @returns {number} The converted angle in radians.
* @example rosetta.radians(180) // returns Math.PI
*/
function radians(angle) {
return openf.RADIANS(angle);
}
exports.radians = radians;
/**
* Generates a random number between 0 and 1, inclusive.
*
* @returns {number} Random number between 0 and 1, inclusive.
*/
function rand() {
return openf.RAND();
}
exports.rand = rand;
/**
* Returns a random number between the numbers you specify.
* @param {number} bottom The smallest integer RANDBETWEEN will return.
* @param {number} top The largest integer RANDBETWEEN will return.
* @returns {number} A random number between the numbers you specify.
* @example rosetta.randBetween(1, 10) // returns a number between 1 and 10 (inclusive)
*/
function randBetween(bottom, top) {
return openf.RANDBETWEEN(bottom, top);
}
exports.randBetween = randBetween;
/**
* Converts an arabic numeral to roman, as text.
* @param {number} arabic_numeral Number that is the Arabic numeral you want converted.
* @returns {string} String that is the Roman numeral form of the given Arabic number
* @example rosetta.roman(10) // returns 'X'
*/
function roman(arabic_numeral) {
return openf.ROMAN(arabic_numeral);
}
exports.roman = roman;
/**
* Rounds a number down, toward zero.
* @param {number} number Any real number that you want rounded down.
* @param {number} digits The number of digits to which you want to round number.
* @returns {number} The number rounded down
* @example rosetta.roundDown(3.14159, 3) // returns 3.141
* @example rosetta.roundDown(-3.14159, 1) // returns -3.1
*/
function roundDown(number, digits) {
return openf.ROUNDDOWN(number, digits);
}
exports.roundDown = roundDown;
/**
* Rounds a number up, away from zero.
* @param {number} number Any real number that you want rounded up.
* @param {number} digits The number of digits to which you want to round number.
* @returns {number} The number rounded up
* @example rosetta.roundUp(3.14159, 3) // returns 3.142
* @example rosetta.roundUp(-3.14159, 1) // returns -3.2
*/
function roundUp(number, digits) {
return openf.ROUNDUP(number, digits);
}
exports.roundUp = roundUp;
/**
* Returns the secant of an angle.
* @param {number} number Any real number, angle measured in radians for which you want the secant.
* @returns {number} Number that is the trigonometric secant of the number.
* @example rosetta.sec(1); // returns 1.1883951057781212
*/
function sec(number) {
return openf.SEC(number);
}
exports.sec = sec;
/**
* Returns the hyperbolic secant of an angle.
* @param {number} number Any real number, angle measured in radians for which you want the hyperbolic secant.
* @returns {number} Number that is the trigonometric hyberbolic secant of the number.
* @example rosetta.sech(1); // returns 0.6480542736638855
*/
function sech(number) {
return openf.SECH(number);
}
exports.sech = sech;
/**
* Returns the sum of a power series based on the formula.
* @param {number} x The input value to the power series.
* @param {number} power The initial power to which you want to raise x.
* @param {number} step The step by which to increase n for each term in the series.
* @param {number[]} coefficients 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.
* @returns {number} Number that is the sum of the given power series
* @example rosetta.seriesSum( rosetta.pi() / 4, 0, 2,
* [ 1, -1 / rosetta.fact(2), 1 / rosetta.fact(4), -1 / rosetta.fact(6) ] )
* // returns 0.7071032148228457
*/
function seriesSum(x, power, step, coefficients) {
return openf.SERIESSUM(x, power, step, coefficients);
}
exports.seriesSum = seriesSum;
/**
* Returns the hyperbolic sine of a number.
* @param {number} number Any real number, angle measured in radians for which you want the hyperbolic sine.
* @returns {number} Number that is the trigonometric hyberbolic sine of the number.
* @example rosetta.sinh(1); // returns 1.1752011936438014
*/
function sinh(number) {
return openf.SINH(number);
}
exports.sinh = sinh;
/**
* Returns the square root of (number * pi).
* @param {number} number The number by which pi is multiplied.
* @returns {number} Number that is the square root of (number * pi)
* @example rosetta.sqrtPi(3) // returns 3.0699801238394655
*/
function sqrtPi(number) {
return openf.SQRTPI(number);
}
exports.sqrtPi = sqrtPi;
/**
* Returns a subtotal in a list or database.
* @param {number} function_num 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.
* @param {number[]} ref1 Number or number list. The first named range or reference for which you want the subtotal.
* @returns {number} The subtotal of the of a list or database
* @example rosetta.subTotal(4, [1, 2, 3]) // returns 3 (max)
*/
function subTotal(function_num, ref1) {
return openf.SUBTOTAL(function_num, ref1);
}
exports.subTotal = subTotal;
/**
* Returns the sum of the two given numbers.
*
* @param {number} num1 Number that is the first addend.
* @param {number} num2 Number that is the second addend.
* @returns {number} The sum of the addends.
* @example rosetta.add(1.2, 4) // returns 5.2
*/
function add(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.ADD(num1, num2);
}
exports.add = add;
/**
* Returns the difference between the two given numbers.
*
* @param {number} num1 Number that is being subtracted from.
* @param {number} num2 Number that is being subtracted.
* @returns {number} The difference between the two numbers.
* @example rosetta.minus(10, 4) // returns 6
*/
function minus(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.MINUS(num1, num2);
}
exports.minus = minus;
/**
* Returns the quotient of the two given numbers.
* @param {number} dividend Number that is the dividend (numerator).
* @param {number} divisor Number that is the divisor (denominator).
* @returns {number} The quotient of the two numbers.
* @example rosetta.divide(10, 4) // returns 2.5
*/
function divide(dividend, divisor) {
if (arguments.length !== 2) {
return error.na;
}
return openf.DIVIDE(dividend, divisor);
}
exports.divide = divide;
/**
* Returns the product of the two given numbers.
* @param {number} factor1 Number that is the first factor being multiplied.
* @param {number} factor2 Number that is the second factor being multiplied.
* @returns {number} The product of the two numbers.
* @example rosetta.multiply(10, 4) // returns 40
*/
function multiply(factor1, factor2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.MULTIPLY(factor1, factor2);
}
exports.multiply = multiply;
/**
* Returns whether the first number is greater than the second number.
* @param {number|string} num1 The first number to compare.
* @param {number|string} num2 The second number to compare.
* @returns {boolean} True if num1 is greater than num2
* @example rosetta.gt(10, 4) // returns true
*/
function gt(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.GT(num1, num2);
}
exports.gt = gt;
/**
* Returns whether the first number is greater than or equal to the second number.
* @param {number|string} num1 The first number to compare.
* @param {number|string} num2 The second number to compare.
* @returns {boolean} True if num1 is greater than or equal to num2
* @example rosetta.gte(10, 10) // returns true
*/
function gte(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.GTE(num1, num2);
}
exports.gte = gte;
/**
* Returns whether the first number is less than the second number.
* @param {number|string} num1 The first number to compare.
* @param {number|string} num2 The second number to compare.
* @returns {boolean} True if num1 is less than num2
* @example rosetta.lt(10, 4) // returns false
*/
function lt(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.LT(num1, num2);
}
exports.lt = lt;
/**
* Returns whether the first number is less than or equal to the second number.
* @param {number|string} num1 The first number to compare.
* @param {number|string} num2 The second number to compare.
* @returns {boolean} True if num1 is less than or equal to num2
* @example rosetta.lte(10, 10) // returns true
*/
function lte(num1, num2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.LTE(num1, num2);
}
exports.lte = lte;
/**
* Returns whether the first number is equal to the second number.
* @param {number|string} value1 The first value to compare.
* @param {number|string} value2 The second value to compare.
* @returns {boolean} True if num1 is equal to num2
* @example rosetta.eq(10, 10) // returns true
*/
function eq(value1, value2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.EQ(value1, value2);
}
exports.eq = eq;
/**
* Returns whether the first number is not equal to the second number.
* @param {number|string} value1 The first value to compare.
* @param {number|string} value2 The second value to compare.
* @returns {true} True if num1 is not equal to num2
* @example rosetta.ne(10, 10) // returns true
*/
function ne(value1, value2) {
if (arguments.length !== 2) {
return error.na;
}
return openf.NE(value1, value2);
}
exports.ne = ne;
/**
* Returns the result of a number raised to a power.
*
* @param {number} base The value that you want raised to exponent. May be positive or negative.
* @param {number} exponent The power to which the base number is raised.
* @returns {number} The value of base raised to the power of exponent.
* @example rosetta.pow(4,2); // returns 16
*/
function pow(base, exponent) {
if (arguments.length !== 2) {
return error.na;
}
return openf.POW(base, exponent);
}
exports.pow = pow;
/**
* Adds the values specified by a given criteria.
* @param {Array} range 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.
* @param {*} criteria The criteria in the form of a number, expression, a value reference, text,
* or a function that defines which values will be added.
* @param {number[]} [sum_range] 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.
* @returns {number} The sum of the values specified by the given criteria.
* @example rosetta.sumIf([1, 2, 3], '>1') // returns 5
*/
function sumIf(range, criteria, sum_range) {
return openf.SUMIF(range, criteria, sum_range);
}
exports.sumIf = sumIf;
/**
* Adds the values in a range that meet multiple criteria.
* @param {Array} values The range of values that you want evaluated.
* @returns {number} The sum of the values that meet the given criteria.
* @example rosetta.sumIfs([1, 2, 3], [4, 5, 6], '>4', [7, 8, 9], '<9') // returns 2
*/
function sumIfs(...values) {
return openf.SUMIFS(...values);
}
exports.sumIfs = sumIfs;
/**
* Returns the sum of the products of corresponding array components.
* @param {Array} args The range of values that you want evaluated.
* @returns {number} The sum of the products of corresponding array components.
* @example rosetta.sumProduct([1, 4, 10], [0.55, 0.3, 0.1]) // returns 2.75
*/
function sumProduct(...args) {
if (!args || args.length === 0) {
return error.value;
}
return openf.SUMPRODUCT(...args);
}
exports.sumProduct = sumProduct;
/**
* Returns the sum of the squares of the arguments.
* @param {number} args 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.
* @returns {number} The sum of the squares of the arguments.
* @example rosetta.sumSq([1, 2, 3]) // returns 14
*/
function sumSq(...args) {
return openf.SUMSQ(...args);
}
exports.sumSq = sumSq;
/**
* Returns the sum of the difference of squares of corresponding values in two arrays.
* @param {number[]} array_x The first array or range of values.
* @param {number[]} array_y The second array or range of values.
* @returns {number} The sum of the difference of squares of corresponding values in two arrays.
* @example rosetta.sumx2My2([1, 2, 3], [4, 5, 6]) // returns -63
*/
function sumx2My2(array_x, array_y) {
return openf.SUMX2MY2(array_x, array_y);
}
exports.sumx2My2 = sumx2My2;
/**
* Returns the sum of the sum of squares of corresponding values in two arrays.
* @param {number[]} array_x The first array or range of values.
* @param {number[]} array_y The second array or range of values.
* @returns {number} The sum of the difference of squares of corresponding values in two arrays.
* @example rosetta.sumx2Py2([1, 2, 3], [4, 5, 6]) // returns 91
*/
function sumx2Py2(array_x, array_y) {
return openf.SUMX2PY2(array_x, array_y);
}
exports.sumx2Py2 = sumx2Py2;
/**
* Returns the sum of squares of differences of corresponding values in two arrays.
* @param {number[]} array_x The first array or range of values.
* @param {number[]} array_y The second array or range of values.
* @returns {number} The sum of squares of differences of corresponding values in two arrays.
* @example rosetta.sumxmy2([1, 2, 3], [4, 5, 6]) // returns 27
*/
function sumxmy2(array_x, array_y) {
return openf.SUMXMY2(array_x, array_y);
}
exports.sumxmy2 = sumxmy2;
/**
* Returns the hyperbolic tangent of a number.
* @param {number} number Any real number.
* @returns {number} The hyperbolic tangent of the number.
* @example rosetta.tanh(0.5) // returns 0.46211715726000974
*/
function tanh(number) {
return openf.TANH(number);
}
exports.tanh = tanh;
/**
* Truncates a number to an integer or a specified precision.
* @param {number} number The number you want to truncate.
* @param {number} [digits] Optional. A number specifying the precision of the truncation. The default value for num_digits is 0 (zero).
* @returns {number} The truncated for of the number with the given precision.
* @example rosetta.trunc(0.45) // returns 0
* @example rosetta.trunc(12.3456, 2) // returns 12.34
*/
function trunc(number, digits) {
return openf.TRUNC(number, digits);
}
exports.trunc = trunc;
//-----------------------------
// Notes @functions math-trig
/**
* Compares two numbers for equality within a confidence range.
*
* @param {number} number1 Number or number list. Any numeric value.
* @param {number} number2 Number or number list. Any numeric value.
* @param {number} confidence Number or number list. Optional (default is 0.0001).
* @returns {number} 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.
* @example rosetta.floatEq(2.22, 2.24, 0.01); // returns false
* @example rosetta.floatEq(2.22, 2.24, 0.03); // returns true
* @example rosetta.floatEq([2.22, 2.24], [2.25, 2.26], 0.04); // returns true
*/
function floatEq(number1, number2, confidence) {
return notesf.FloatEq(number1, number2, confidence);
}
exports.floatEq = floatEq;
/**
* Truncates the values in a number or number list at the whole number, leaving off
* any decimals.
*
* @param {number} value Number or number list. The value(s) that is the value you want to truncate.
* @returns {number} Number or number list. The value(s) that is the truncated value.
* @example rosetta.integer(5.5); // returns 5
* @example rosetta.integer(5.5,6.6,7.7); // returns [5, 6, 7]
*/
function integer(...value) {
return notesf.Integer(...value);
}
exports.integer = integer;
/**
* Returns the remainder of a division operation.
*
* @param {number} dividend Number or number list. The dividend (numerator) to be divided.
* @param {number} divisor Number or number list. The divisor (denominator) to be divide dividend by.
* @returns {number} 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.
* @example rosetta.modulo(7,4); // returns 3
* @example rosetta.modulo([7,5],[4,3]); // returns [3,2]);
*/
function modulo(dividend, divisor) {
return notesf.Modulo(dividend, divisor);
}
exports.modulo = modulo;
/**
* Generates a random number between 0 and 1, inclusive by calling open formula RAND
*
* @returns {number} Random number between 0 and 1, inclusive.
* @TODO this needs to be implemented for NotesFormula with parameters
*/
function random() {
return notesf.Random();
}
exports.random = random;
//-----------------------------
// Notes @Commands math-trig
//# sourceMappingURL=math-trig.js.map