From dc516005ce8824ebdfd3cf184c7aa7aaafa236e8 Mon Sep 17 00:00:00 2001 From: Jakub Kowalski Date: Fri, 2 Oct 2020 10:36:36 +0200 Subject: [PATCH 01/40] Function SUBTOTAL init --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/enGB.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + .../plugin/NumericAggregationPlugin.ts | 16 +++++++++++++++- test/interpreter/function-subtotal.spec.ts | 5 +++++ 18 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/interpreter/function-subtotal.spec.ts diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 1350e64435..396dbff4b2 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'ODPIS.LIN', SPLIT: 'SPLIT', SQRT: 'ODMOCNINA', + SUBTOTAL: 'SUBTOTAL', SUM: 'SUMA', SUMIF: 'SUMIF', SUMIFS: 'SUMIFS', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 947966bae6..5d5b555779 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LA', SPLIT: 'SPLIT', SQRT: 'KVROD', + SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', SUMIF: 'SUM.HVIS', SUMIFS: 'SUM.HVISER', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 52af4481ae..1b6199b38b 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIA', SPLIT: 'SPLIT', SQRT: 'WURZEL', + SUBTOTAL: 'TEILERGEBNIS', SUM: 'SUMME', SUMIF: 'SUMMEWENN', SUMIFS: 'SUMMEWENNS', diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index b62793b005..7c23c731d9 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'SQRT', + SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', SUMIF: 'SUMIF', SUMIFS: 'SUMIFS', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 986c0f6421..3c301e49d9 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -177,6 +177,7 @@ export const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'RAIZ', + SUBTOTAL: 'SUBTOTALES', SUM: 'SUMA', SUMIF: 'SUMAR.SI', SUMIFS: 'SUMAR.SI.CONJUNTO', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index a52aa9cfe5..81a25a0164 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'STP', SPLIT: 'SPLIT', SQRT: 'NELIÖJUURI', + SUBTOTAL: 'VÄLISUMMA', SUM: 'SUMMA', SUMIF: 'SUMMA.JOS', SUMIFS: 'SUMMA.JOS.JOUKKO', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 5e1748a0be..8225e8c248 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMORLIN', SPLIT: 'SPLIT', SQRT: 'RACINE', + SUBTOTAL: 'SOUS.TOTAL', SUM: 'SOMME', SUMIF: 'SOMME.SI', SUMIFS: 'SOMME.SI.ENS', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 7a0a3734bb..37f5db6343 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LCSA', SPLIT: 'SPLIT', SQRT: 'GYÖK', + SUBTOTAL: 'RÉSZÖSSZEG', SUM: 'SZUM', SUMIF: 'SZUMHA', SUMIFS: 'SZUMHATÖBB', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index cf6c62f905..82f7bdc3e0 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMMORT.COST', SPLIT: 'SPLIT', SQRT: 'RADQ', + SUBTOTAL: 'SUBTOTALE', SUM: 'SOMMA', SUMIF: 'SOMMA.SE', SUMIFS: 'SOMMA.PIÙ.SE', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index edc2e92cb7..02257251ba 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVS', SPLIT: 'SPLIT', SQRT: 'ROT', + SUBTOTAL: 'DELSUM', SUM: 'SUMMER', SUMIF: 'SUMMERHVIS', SUMIFS: 'SUMMER.HVIS.SETT', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 19077185c6..4ffacaaae1 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIN.AFSCHR', SPLIT: 'SPLIT', SQRT: 'WORTEL', + SUBTOTAL: 'SUBTOTAAL', SUM: 'SOM', SUMIF: 'SOM.ALS', SUMIFS: 'SOMMEN.ALS', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 39f48c455e..8fb904899f 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', + SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', SUMIF: 'SUMA.JEŻELI', SUMIFS: 'SUMY.JEŻELI', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 4f665730cd..f84a654861 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DPD', SPLIT: 'SPLIT', SQRT: 'RAIZ', + SUBTOTAL: 'SUBTOTAL', SUM: 'SOMA', SUMIF: 'SOMASE', SUMIFS: 'SOMASES', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 06d526917e..1efb68a990 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'АПЛ', SPLIT: 'SPLIT', SQRT: 'КОРЕНЬ', + SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ', SUM: 'СУММ', SUMIF: 'СУММЕСЛИ', SUMIFS: 'СУММЕСЛИМН', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index d965184992..1e4944275e 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVSKR', SPLIT: 'SPLIT', SQRT: 'ROT', + SUBTOTAL: 'DELSUMMA', SUM: 'SUMMA', SUMIF: 'SUMMA.OM', SUMIFS: 'SUMMA.OMF', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 4940b55360..2fbd737131 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DA', SPLIT: 'SPLIT', SQRT: 'KAREKÖK', + SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE', SUM: 'TOPLA', SUMIF: 'ETOPLA', SUMIFS: 'ÇOKETOPLA', diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index 20e6e36abf..70489cbba1 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -11,7 +11,7 @@ import {Maybe} from '../../Maybe' import {AstNodeType, CellRangeAst, ProcedureAst} from '../../parser' import {coerceBooleanToNumber} from '../ArithmeticHelper' import {SimpleRangeValue} from '../InterpreterValue' -import {FunctionPlugin} from './FunctionPlugin' +import {ArgumentTypes, FunctionPlugin} from './FunctionPlugin' import {ColumnRangeAst, RowRangeAst} from '../../parser/Ast' export type BinaryOperation = (left: T, right: T) => T @@ -91,6 +91,14 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'AVERAGEA': { method: 'averagea', }, + 'SUBTOTAL': { + method: 'subtotal', + parameters: [ + { argumentType: ArgumentTypes.NUMBER }, + { argumentType: ArgumentTypes.RANGE } + ], + repeatLastArgs: 1 + } } /** @@ -236,6 +244,12 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } + public subtotal(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.runFunction(ast.args, formulaAddress, this.metadata('SUBTOTAL'), (type: number, ...args: SimpleRangeValue[]) => { + return 0 + }) + } + private addWithEpsilon = (left: number, right: number): number => this.interpreter.arithmeticHelper.addWithEpsilon(left, right) /** diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts new file mode 100644 index 0000000000..a5ddc44de6 --- /dev/null +++ b/test/interpreter/function-subtotal.spec.ts @@ -0,0 +1,5 @@ +import {HyperFormula} from '../../src' + +describe('Function SUBTOTAL', () => { + +}) From 9dd7ab65808b3048ea14ba934f3b1d57ecd989ed Mon Sep 17 00:00:00 2001 From: Jakub Kowalski Date: Fri, 2 Oct 2020 13:08:52 +0200 Subject: [PATCH 02/40] Simply use implementations of AVERAGE, SUM, COUNT, COUNTA, MAX, MIN --- .../plugin/NumericAggregationPlugin.ts | 169 ++++++++++-------- test/interpreter/function-subtotal.spec.ts | 78 ++++++++ 2 files changed, 174 insertions(+), 73 deletions(-) diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index 70489cbba1..79968fc8a9 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -8,7 +8,7 @@ import {AbsoluteCellRange, DIFFERENT_SHEETS_ERROR} from '../../AbsoluteCellRange import {CellError, EmptyValue, ErrorType, InternalScalarValue, SimpleCellAddress} from '../../Cell' import {ErrorMessage} from '../../error-message' import {Maybe} from '../../Maybe' -import {AstNodeType, CellRangeAst, ProcedureAst} from '../../parser' +import {Ast, AstNodeType, CellRangeAst, ProcedureAst} from '../../parser' import {coerceBooleanToNumber} from '../ArithmeticHelper' import {SimpleRangeValue} from '../InterpreterValue' import {ArgumentTypes, FunctionPlugin} from './FunctionPlugin' @@ -94,8 +94,8 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'SUBTOTAL': { method: 'subtotal', parameters: [ - { argumentType: ArgumentTypes.NUMBER }, - { argumentType: ArgumentTypes.RANGE } + {argumentType: ArgumentTypes.NUMBER}, + {argumentType: ArgumentTypes.RANGE} ], repeatLastArgs: 1 } @@ -110,20 +110,13 @@ export class NumericAggregationPlugin extends FunctionPlugin { * @param formulaAddress */ public sum(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - return this.reduce(ast, formulaAddress, 0, 'SUM', this.addWithEpsilon, identityMap, strictlyNumbers) + return this.doSum(ast.args, formulaAddress) } public sumsq(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - return this.reduce(ast, formulaAddress, 0, 'SUMSQ', this.addWithEpsilon, (arg) => arg * arg, strictlyNumbers) + return this.reduce(ast.args, formulaAddress, 0, 'SUMSQ', this.addWithEpsilon, (arg) => arg * arg, strictlyNumbers) } - /** * Corresponds to MAX(Number1, Number2, ...). * @@ -133,21 +126,11 @@ export class NumericAggregationPlugin extends FunctionPlugin { * @param formulaAddress */ public max(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, Number.NEGATIVE_INFINITY, 'MAX', - (left, right) => Math.max(left, right), - identityMap, strictlyNumbers) - - return zeroForInfinite(value) + return this.doMax(ast.args, formulaAddress) } public maxa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, Number.NEGATIVE_INFINITY, 'MAXA', + const value = this.reduce(ast.args, formulaAddress, Number.NEGATIVE_INFINITY, 'MAXA', (left, right) => Math.max(left, right), identityMap, numbersBooleans) @@ -163,21 +146,11 @@ export class NumericAggregationPlugin extends FunctionPlugin { * @param formulaAddress */ public min(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, Number.POSITIVE_INFINITY, 'MIN', - (left, right) => Math.min(left, right), - identityMap, strictlyNumbers) - - return zeroForInfinite(value) + return this.doMin(ast.args, formulaAddress) } public mina(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, Number.POSITIVE_INFINITY, 'MINA', + const value = this.reduce(ast.args, formulaAddress, Number.POSITIVE_INFINITY, 'MINA', (left, right) => Math.min(left, right), identityMap, numbersBooleans) @@ -185,34 +158,64 @@ export class NumericAggregationPlugin extends FunctionPlugin { } public count(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, 0, 'COUNT', - (left, right) => left + right, identityMap, - (arg) => (typeof arg === 'number') ? 1 : 0 - ) - - return value + return this.doCount(ast.args, formulaAddress) } public counta(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const value = this.reduce(ast, formulaAddress, 0, 'COUNTA', (left, right) => left + right, - identityMap, - (arg) => (arg === EmptyValue) ? 0 : 1 + return this.doCounta(ast.args, formulaAddress) + } + + public average(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doAverage(ast.args, formulaAddress) + } + + public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(ast.args, formulaAddress, AverageResult.empty, 'AVERAGE', + (left, right) => left.compose(right), + (arg): AverageResult => AverageResult.single(arg), + numbersBooleans ) - return value + if (result instanceof CellError) { + return result + } else { + return result.averageValue() ?? new CellError(ErrorType.DIV_BY_ZERO) + } } - public average(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + public subtotal(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { if (ast.args.length < 1) { return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) } - const result = this.reduce(ast, formulaAddress, AverageResult.empty, 'AVERAGE', (left, right) => { + /* TODO use runFunction and pass tail? */ + const functionType = this.coerceToType(this.evaluateAst(ast.args[0], formulaAddress), {argumentType: ArgumentTypes.NUMBER}) + const args = ast.args.slice(1) + switch (functionType) { + case 1: + case 101: + return this.doAverage(args, formulaAddress) + case 2: + case 102: + return this.doCount(args, formulaAddress) + case 3: + case 103: + return this.doCounta(args, formulaAddress) + case 4: + case 104: + return this.doMax(args, formulaAddress) + case 5: + case 105: + return this.doMin(args, formulaAddress) + case 9: + case 109: + return this.doSum(args, formulaAddress) + default: + throw new Error('TODO') + } + } + + private doAverage(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(args, formulaAddress, AverageResult.empty, 'AVERAGE', (left, right) => { return left.compose(right) }, (arg): AverageResult => { return AverageResult.single(arg) @@ -227,27 +230,44 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } - public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - if (ast.args.length < 1) { - return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) - } - const result = this.reduce(ast, formulaAddress, AverageResult.empty, 'AVERAGE', - (left, right) => left.compose(right), - (arg): AverageResult => AverageResult.single(arg), - numbersBooleans + private doCount(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const value = this.reduce(args, formulaAddress, 0, 'COUNT', + (left, right) => left + right, identityMap, + (arg) => (typeof arg === 'number') ? 1 : 0 ) - if (result instanceof CellError) { - return result - } else { - return result.averageValue() ?? new CellError(ErrorType.DIV_BY_ZERO) - } + return value } - public subtotal(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - return this.runFunction(ast.args, formulaAddress, this.metadata('SUBTOTAL'), (type: number, ...args: SimpleRangeValue[]) => { - return 0 - }) + private doCounta(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const value = this.reduce(args, formulaAddress, 0, 'COUNTA', (left, right) => left + right, + identityMap, + (arg) => (arg === EmptyValue) ? 0 : 1 + ) + + return value + } + + private doMax(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const value = this.reduce(args, formulaAddress, Number.NEGATIVE_INFINITY, 'MAX', + (left, right) => Math.max(left, right), + identityMap, strictlyNumbers + ) + + return zeroForInfinite(value) + } + + private doMin(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const value = this.reduce(args, formulaAddress, Number.POSITIVE_INFINITY, 'MIN', + (left, right) => Math.min(left, right), + identityMap, strictlyNumbers + ) + + return zeroForInfinite(value) + } + + private doSum(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.reduce(args, formulaAddress, 0, 'SUM', this.addWithEpsilon, identityMap, strictlyNumbers) } private addWithEpsilon = (left: number, right: number): number => this.interpreter.arithmeticHelper.addWithEpsilon(left, right) @@ -263,8 +283,11 @@ export class NumericAggregationPlugin extends FunctionPlugin { * @param mapFunction * @param coerceFunction * */ - private reduce(ast: ProcedureAst, formulaAddress: SimpleCellAddress, initialAccValue: T, functionName: string, reducingFunction: BinaryOperation, mapFunction: MapOperation, coercionFunction: coercionOperation): CellError | T { - return ast.args.reduce((acc: T | CellError, arg) => { + private reduce(args: Ast[], formulaAddress: SimpleCellAddress, initialAccValue: T, functionName: string, reducingFunction: BinaryOperation, mapFunction: MapOperation, coercionFunction: coercionOperation): CellError | T { + if (args.length < 1) { + return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) + } + return args.reduce((acc: T | CellError, arg) => { if (acc instanceof CellError) { return acc } diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index a5ddc44de6..1215357d4a 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -1,5 +1,83 @@ import {HyperFormula} from '../../src' +import {adr} from '../testUtils' describe('Function SUBTOTAL', () => { + it('should calculate AVERAGE', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(1, A2:A4, A5)', '=SUBTOTAL(101, A2:A4, A5)'], + [2], + [3], + [4], + [5] + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(3.5) + expect(engine.getCellValue(adr('B1'))).toEqual(3.5) + }) + + it('should calculate COUNT', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(2, A2:A4, A5)', '=SUBTOTAL(102, A2:A4, A5)'], + [2], + ['foo'], + [4], + [5] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(3) + expect(engine.getCellValue(adr('B1'))).toEqual(3) + }) + + + it('should calculate COUNTA', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(3, A2:A4, A5)', '=SUBTOTAL(103, A2:A4, A5)'], + [2], + ['foo'], + [4], + [5] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(4) + expect(engine.getCellValue(adr('B1'))).toEqual(4) + }) + + it('should calcuate MAX', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(4, A2:A4, A5)', '=SUBTOTAL(104, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(5) + expect(engine.getCellValue(adr('B1'))).toEqual(5) + }) + + it('should calculate MIN', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(5, A2:A4, A5)', '=SUBTOTAL(105, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(2) + expect(engine.getCellValue(adr('B1'))).toEqual(2) + }) + + it('should calculate SUM', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(9, A2:A4, A5)', '=SUBTOTAL(109, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(14) + expect(engine.getCellValue(adr('B1'))).toEqual(14) + }) }) From abdfd0cf119fe8c447f3135b29c296aa278b2f42 Mon Sep 17 00:00:00 2001 From: Jakub Kowalski Date: Fri, 2 Oct 2020 13:41:51 +0200 Subject: [PATCH 03/40] Sort translations --- src/i18n/languages/csCZ.ts | 4 ++-- src/i18n/languages/daDK.ts | 4 ++-- src/i18n/languages/deDE.ts | 4 ++-- src/i18n/languages/enGB.ts | 4 ++-- src/i18n/languages/esES.ts | 4 ++-- src/i18n/languages/fiFI.ts | 4 ++-- src/i18n/languages/frFR.ts | 4 ++-- src/i18n/languages/huHU.ts | 4 ++-- src/i18n/languages/itIT.ts | 4 ++-- src/i18n/languages/nbNO.ts | 4 ++-- src/i18n/languages/nlNL.ts | 4 ++-- src/i18n/languages/plPL.ts | 4 ++-- src/i18n/languages/ptPT.ts | 4 ++-- src/i18n/languages/ruRU.ts | 4 ++-- src/i18n/languages/svSE.ts | 4 ++-- src/i18n/languages/trTR.ts | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 396dbff4b2..ae8e985eb8 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'NEBO', PI: 'PI', PMT: 'PLATBA', - SUBSTITUTE: 'DOSADIT', POWER: 'POWER', PPMT: 'PLATBA.ZÁKLAD', PROPER: 'VELKÁ2', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANS', RAND: 'NÁHČÍSLO', RATE: 'ÚROKOVÁ.MÍRA', + REPLACE: 'NAHRADIT', REPT: 'OPAKOVAT', RIGHT: 'ZPRAVA', ROUND: 'ZAOKROUHLIT', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'ODPIS.LIN', SPLIT: 'SPLIT', SQRT: 'ODMOCNINA', + SUBSTITUTE: 'DOSADIT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUMA', SUMIF: 'SUMIF', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'ROK', YEARFRAC: 'YEARFRAC', - REPLACE: 'NAHRADIT', }, langCode: 'csCZ', ui: { diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 5d5b555779..651040ae1c 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'YDELSE', - SUBSTITUTE: 'UDSKIFT', POWER: 'POTENS', PPMT: 'H.YDELSE', PROPER: 'STORT.FORBOGSTAV', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANER', RAND: 'SLUMP', RATE: 'RENTE', + REPLACE: 'ERSTAT', REPT: 'GENTAG', RIGHT: 'HØJRE', ROUND: 'AFRUND', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LA', SPLIT: 'SPLIT', SQRT: 'KVROD', + SUBSTITUTE: 'UDSKIFT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', SUMIF: 'SUM.HVIS', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XELLER', YEAR: 'ÅR', YEARFRAC: 'ÅR.BRØK', - REPLACE: 'ERSTAT', }, langCode: 'daDK', ui: { diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 1b6199b38b..cffb5e20a1 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'ODER', PI: 'PI', PMT: 'RMZ', - SUBSTITUTE: 'WECHSELN', POWER: 'POTENZ', PPMT: 'KAPZ', PROPER: 'GROSS2', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'BOGENMASS', RAND: 'ZUFALLSZAHL', RATE: 'ZINS', + REPLACE: 'ERSETZEN', REPT: 'WIEDERHOLEN', RIGHT: 'RECHTS', ROUND: 'RUNDEN', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIA', SPLIT: 'SPLIT', SQRT: 'WURZEL', + SUBSTITUTE: 'WECHSELN', SUBTOTAL: 'TEILERGEBNIS', SUM: 'SUMME', SUMIF: 'SUMMEWENN', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XODER', YEAR: 'JAHR', YEARFRAC: 'BRTEILJAHRE', - REPLACE: 'ERSETZEN', }, langCode: 'deDE', ui: { diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index 7c23c731d9..55ea276990 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'OR', PI: 'PI', PMT: 'PMT', - SUBSTITUTE: 'SUBSTITUTE', POWER: 'POWER', PPMT: 'PPMT', PROPER: 'PROPER', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANS', RAND: 'RAND', RATE: 'RATE', + REPLACE: 'REPLACE', REPT: 'REPT', RIGHT: 'RIGHT', ROUND: 'ROUND', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'SQRT', + SUBSTITUTE: 'SUBSTITUTE', SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', SUMIF: 'SUMIF', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'YEAR', YEARFRAC: 'YEARFRAC', - REPLACE: 'REPLACE', }, langCode: 'enGB', ui: { diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 3c301e49d9..7421027a22 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -150,7 +150,6 @@ export const dictionary: RawTranslationPackage = { OR: 'O', PI: 'PI', PMT: 'PAGO', - SUBSTITUTE: 'SUSTITUIR', POWER: 'POTENCIA', PPMT: 'PAGOPRIN', PROPER: 'NOMPROPIO', @@ -158,6 +157,7 @@ export const dictionary: RawTranslationPackage = { RADIANS: 'RADIANES', RAND: 'ALEATORIO', RATE: 'TASA', + REPLACE: 'REEMPLAZAR', REPT: 'REPETIR', RIGHT: 'DERECHA', ROUND: 'REDONDEAR', @@ -177,6 +177,7 @@ export const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'RAIZ', + SUBSTITUTE: 'SUSTITUIR', SUBTOTAL: 'SUBTOTALES', SUM: 'SUMA', SUMIF: 'SUMAR.SI', @@ -208,7 +209,6 @@ export const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'AÑO', YEARFRAC: 'FRAC.AÑO', - REPLACE: 'REEMPLAZAR', }, langCode: 'esES', ui: { diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 81a25a0164..6555d6706a 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'TAI', PI: 'PII', PMT: 'MAKSU', - SUBSTITUTE: 'VAIHDA', POWER: 'POTENSSI', PPMT: 'PPMT', PROPER: 'ERISNIMI', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIAANIT', RAND: 'SATUNNAISLUKU', RATE: 'KORKO', + REPLACE: 'KORVAA', REPT: 'TOISTA', RIGHT: 'OIKEA', ROUND: 'PYÖRISTÄ', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'STP', SPLIT: 'SPLIT', SQRT: 'NELIÖJUURI', + SUBSTITUTE: 'VAIHDA', SUBTOTAL: 'VÄLISUMMA', SUM: 'SUMMA', SUMIF: 'SUMMA.JOS', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'EHDOTON.TAI', YEAR: 'VUOSI', YEARFRAC: 'VUOSI.OSA', - REPLACE: 'KORVAA', }, langCode: 'fiFI', ui: { diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 8225e8c248..5117ebab46 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'OU', PI: 'PI', PMT: 'VPM', - SUBSTITUTE: 'SUBSTITUE', POWER: 'PUISSANCE', PPMT: 'PRINCPER', PROPER: 'NOMPROPRE', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANS', RAND: 'ALEA', RATE: 'TAUX', + REPLACE: 'REMPLACER', REPT: 'REPT', RIGHT: 'DROITE', ROUND: 'ARRONDI', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMORLIN', SPLIT: 'SPLIT', SQRT: 'RACINE', + SUBSTITUTE: 'SUBSTITUE', SUBTOTAL: 'SOUS.TOTAL', SUM: 'SOMME', SUMIF: 'SOMME.SI', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'OUX', YEAR: 'ANNEE', YEARFRAC: 'FRACTION.ANNEE', - REPLACE: 'REMPLACER', }, langCode: 'frFR', ui: { diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 37f5db6343..40ba1e892a 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'VAGY', PI: 'PI', PMT: 'RÉSZLET', - SUBSTITUTE: 'HELYETTE', POWER: 'HATVÁNY', PPMT: 'PRÉSZLET', PROPER: 'TNÉV', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIÁN', RAND: 'VÉL', RATE: 'RÁTA', + REPLACE: 'CSERE', REPT: 'SOKSZOR', RIGHT: 'JOBB', ROUND: 'KEREKÍTÉS', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LCSA', SPLIT: 'SPLIT', SQRT: 'GYÖK', + SUBSTITUTE: 'HELYETTE', SUBTOTAL: 'RÉSZÖSSZEG', SUM: 'SZUM', SUMIF: 'SZUMHA', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XVAGY', YEAR: 'ÉV', YEARFRAC: 'TÖRTÉV', - REPLACE: 'CSERE', }, langCode: 'huHU', ui: { diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index 82f7bdc3e0..aab2b04bc7 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'O', PI: 'PI.GRECO', PMT: 'RATA', - SUBSTITUTE: 'SOSTITUISCI', POWER: 'POTENZA', PPMT: 'P.RATA', PROPER: 'MAIUSC.INIZ', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANTI', RAND: 'CASUALE', RATE: 'TASSO', + REPLACE: 'RIMPIAZZA', REPT: 'RIPETI', RIGHT: 'DESTRA', ROUND: 'ARROTONDA', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMMORT.COST', SPLIT: 'SPLIT', SQRT: 'RADQ', + SUBSTITUTE: 'SOSTITUISCI', SUBTOTAL: 'SUBTOTALE', SUM: 'SOMMA', SUMIF: 'SOMMA.SE', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'ANNO', YEARFRAC: 'FRAZIONE.ANNO', - REPLACE: 'RIMPIAZZA', }, langCode: 'itIT', ui: { diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 02257251ba..ecb16e5830 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'AVDRAG', - SUBSTITUTE: 'BYTT.UT', POWER: 'OPPHØYD.I', PPMT: 'AMORT', PROPER: 'STOR.FORBOKSTAV', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANER', RAND: 'TILFELDIG', RATE: 'RENTE', + REPLACE: 'ERSTATT', REPT: 'GJENTA', RIGHT: 'HØYRE', ROUND: 'AVRUND', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVS', SPLIT: 'SPLIT', SQRT: 'ROT', + SUBSTITUTE: 'BYTT.UT', SUBTOTAL: 'DELSUM', SUM: 'SUMMER', SUMIF: 'SUMMERHVIS', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'EKSKLUSIVELLER', YEAR: 'ÅR', YEARFRAC: 'ÅRDEL', - REPLACE: 'ERSTATT', }, langCode: 'nbNO', ui: { diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 4ffacaaae1..47f2310ae1 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'OF', PI: 'PI', PMT: 'BET', - SUBSTITUTE: 'SUBSTITUEREN', POWER: 'MACHT', PPMT: 'PBET', PROPER: 'BEGINLETTERS', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIALEN', RAND: 'ASELECT', RATE: 'RENTE', + REPLACE: 'VERVANGEN', REPT: 'HERHALING', RIGHT: 'RECHTS', ROUND: 'AFRONDEN', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIN.AFSCHR', SPLIT: 'SPLIT', SQRT: 'WORTEL', + SUBSTITUTE: 'SUBSTITUEREN', SUBTOTAL: 'SUBTOTAAL', SUM: 'SOM', SUMIF: 'SOM.ALS', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'EX.OF', YEAR: 'JAAR', YEARFRAC: 'JAAR.DEEL', - REPLACE: 'VERVANGEN', }, langCode: 'nlNL', ui: { diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 8fb904899f..3b597dd84d 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'LUB', PI: 'PI', PMT: 'PMT', - SUBSTITUTE: 'PODSTAW', POWER: 'POTĘGA', PPMT: 'PPMT', PROPER: 'Z.WIELKIEJ.LITERY', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANY', RAND: 'LOSUJ', RATE: 'RATE', + REPLACE: 'ZASTĄP', REPT: 'POWT', RIGHT: 'PRAWY', ROUND: 'ZAOKR', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', + SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', SUMIF: 'SUMA.JEŻELI', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'ROK', YEARFRAC: 'CZĘŚĆ.ROKU', - REPLACE: 'ZASTĄP', }, langCode: 'plPL', ui: { diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index f84a654861..909de04e3c 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'OU', PI: 'PI', PMT: 'PGTO', - SUBSTITUTE: 'SUBSTITUIR', POWER: 'POTÊNCIA', PPMT: 'PPGTO', PROPER: 'PRI.MAIÚSCULA', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANOS', RAND: 'ALEATÓRIO', RATE: 'TAXA', + REPLACE: 'MUDAR', REPT: 'REPT', RIGHT: 'DIREITA', ROUND: 'ARRED', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DPD', SPLIT: 'SPLIT', SQRT: 'RAIZ', + SUBSTITUTE: 'SUBSTITUIR', SUBTOTAL: 'SUBTOTAL', SUM: 'SOMA', SUMIF: 'SOMASE', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'OUEXCL', YEAR: 'ANO', YEARFRAC: 'FRAÇÃOANO', - REPLACE: 'MUDAR', }, langCode: 'ptPT', ui: { diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 1efb68a990..61b5ac6e65 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'ИЛИ', PI: 'ПИ', PMT: 'ПЛТ', - SUBSTITUTE: 'ПОДСТАВИТЬ', POWER: 'СТЕПЕНЬ', PPMT: 'ОСПЛТ', PROPER: 'ПРОПНАЧ', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'РАДИАНЫ', RAND: 'СЛЧИС', RATE: 'СТАВКА', + REPLACE: 'ЗАМЕНИТЬ', REPT: 'ПОВТОР', RIGHT: 'ПРАВСИМВ', ROUND: 'ОКРУГЛ', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'АПЛ', SPLIT: 'SPLIT', SQRT: 'КОРЕНЬ', + SUBSTITUTE: 'ПОДСТАВИТЬ', SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ', SUM: 'СУММ', SUMIF: 'СУММЕСЛИ', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'ИСКЛИЛИ', YEAR: 'ГОД', YEARFRAC: 'ДОЛЯГОДА', - REPLACE: 'ЗАМЕНИТЬ', }, langCode: 'ruRU', ui: { diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 1e4944275e..c6ea1515cc 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'BETALNING', - SUBSTITUTE: 'BYT.UT', POWER: 'UPPHÖJT.TILL', PPMT: 'AMORT', PROPER: 'INITIAL', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADIANER', RAND: 'SLUMP', RATE: 'RÄNTA', + REPLACE: 'ERSÄTT', REPT: 'REP', RIGHT: 'HÖGER', ROUND: 'AVRUNDA', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVSKR', SPLIT: 'SPLIT', SQRT: 'ROT', + SUBSTITUTE: 'BYT.UT', SUBTOTAL: 'DELSUMMA', SUM: 'SUMMA', SUMIF: 'SUMMA.OM', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'XOR', YEAR: 'ÅR', YEARFRAC: 'ÅRDEL', - REPLACE: 'ERSÄTT', }, langCode: 'svSE', ui: { diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 2fbd737131..3a35815838 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -150,7 +150,6 @@ const dictionary: RawTranslationPackage = { OR: 'VEYA', PI: 'Pİ', PMT: 'DEVRESEL_ÖDEME', - SUBSTITUTE: 'YERİNEKOY', POWER: 'KUVVET', PPMT: 'ANA_PARA_ÖDEMESİ', PROPER: 'YAZIM.DÜZENİ', @@ -158,6 +157,7 @@ const dictionary: RawTranslationPackage = { RADIANS: 'RADYAN', RAND: 'S_SAYI_ÜRET', RATE: 'FAİZ_ORANI', + REPLACE: 'DEĞİŞTİR', REPT: 'YİNELE', RIGHT: 'SAĞ', ROUND: 'YUVARLA', @@ -177,6 +177,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DA', SPLIT: 'SPLIT', SQRT: 'KAREKÖK', + SUBSTITUTE: 'YERİNEKOY', SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE', SUM: 'TOPLA', SUMIF: 'ETOPLA', @@ -208,7 +209,6 @@ const dictionary: RawTranslationPackage = { XOR: 'ÖZELVEYA', YEAR: 'YIL', YEARFRAC: 'YILORAN', - REPLACE: 'DEĞİŞTİR', }, langCode: 'trTR', ui: { From 4c81061fd7bc1f3132a4e82297abd999d7bec2d6 Mon Sep 17 00:00:00 2001 From: Jakub Kowalski Date: Fri, 2 Oct 2020 15:05:04 +0200 Subject: [PATCH 04/40] Function PRODUCT --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/enGB.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + .../plugin/NumericAggregationPlugin.ts | 14 ++++++++++++ test/interpreter/function-product.spec.ts | 22 +++++++++++++++++++ test/interpreter/function-subtotal.spec.ts | 13 +++++++++++ 19 files changed, 65 insertions(+) create mode 100644 test/interpreter/function-product.spec.ts diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index ae8e985eb8..0a2191ff36 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'NEBO', PI: 'PI', PMT: 'PLATBA', + PRODUCT: 'SOUČIN', POWER: 'POWER', PPMT: 'PLATBA.ZÁKLAD', PROPER: 'VELKÁ2', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 651040ae1c..0cdfe4f9ab 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'YDELSE', + PRODUCT: 'PRODUKT', POWER: 'POTENS', PPMT: 'H.YDELSE', PROPER: 'STORT.FORBOGSTAV', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index cffb5e20a1..0f3bd3cfcb 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'ODER', PI: 'PI', PMT: 'RMZ', + PRODUCT: 'PRODUKT', POWER: 'POTENZ', PPMT: 'KAPZ', PROPER: 'GROSS2', diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index 55ea276990..cdf9921d3b 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'OR', PI: 'PI', PMT: 'PMT', + PRODUCT: 'PRODUCT', POWER: 'POWER', PPMT: 'PPMT', PROPER: 'PROPER', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 7421027a22..e375005cb2 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -150,6 +150,7 @@ export const dictionary: RawTranslationPackage = { OR: 'O', PI: 'PI', PMT: 'PAGO', + PRODUCT: 'PRODUCTO', POWER: 'POTENCIA', PPMT: 'PAGOPRIN', PROPER: 'NOMPROPIO', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 6555d6706a..ff195a9f47 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'TAI', PI: 'PII', PMT: 'MAKSU', + PRODUCT: 'TULO', POWER: 'POTENSSI', PPMT: 'PPMT', PROPER: 'ERISNIMI', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 5117ebab46..eabcb55550 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'OU', PI: 'PI', PMT: 'VPM', + PRODUCT: 'PRODUIT', POWER: 'PUISSANCE', PPMT: 'PRINCPER', PROPER: 'NOMPROPRE', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 40ba1e892a..1ab9aa426e 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'VAGY', PI: 'PI', PMT: 'RÉSZLET', + PRODUCT: 'SZORZAT', POWER: 'HATVÁNY', PPMT: 'PRÉSZLET', PROPER: 'TNÉV', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index aab2b04bc7..14759d6812 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'O', PI: 'PI.GRECO', PMT: 'RATA', + PRODUCT: 'PRODOTTO', POWER: 'POTENZA', PPMT: 'P.RATA', PROPER: 'MAIUSC.INIZ', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index ecb16e5830..8ac6d81d96 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'AVDRAG', + PRODUCT: 'PRODUKT', POWER: 'OPPHØYD.I', PPMT: 'AMORT', PROPER: 'STOR.FORBOKSTAV', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 47f2310ae1..5ed4509c2a 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'OF', PI: 'PI', PMT: 'BET', + PRODUCT: 'PRODUCT', POWER: 'MACHT', PPMT: 'PBET', PROPER: 'BEGINLETTERS', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 3b597dd84d..91f3939a52 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'LUB', PI: 'PI', PMT: 'PMT', + PRODUCT: 'ILOCZYN', POWER: 'POTĘGA', PPMT: 'PPMT', PROPER: 'Z.WIELKIEJ.LITERY', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 909de04e3c..a81dfe86ed 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'OU', PI: 'PI', PMT: 'PGTO', + PRODUCT: 'MULT', POWER: 'POTÊNCIA', PPMT: 'PPGTO', PROPER: 'PRI.MAIÚSCULA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 61b5ac6e65..80e402cb61 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'ИЛИ', PI: 'ПИ', PMT: 'ПЛТ', + PRODUCT: 'ПРОИЗВЕД', POWER: 'СТЕПЕНЬ', PPMT: 'ОСПЛТ', PROPER: 'ПРОПНАЧ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index c6ea1515cc..bb2e37f065 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'ELLER', PI: 'PI', PMT: 'BETALNING', + PRODUCT: 'PRODUKT', POWER: 'UPPHÖJT.TILL', PPMT: 'AMORT', PROPER: 'INITIAL', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 3a35815838..771df6d754 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -150,6 +150,7 @@ const dictionary: RawTranslationPackage = { OR: 'VEYA', PI: 'Pİ', PMT: 'DEVRESEL_ÖDEME', + PRODUCT: 'ÇARPIM', POWER: 'KUVVET', PPMT: 'ANA_PARA_ÖDEMESİ', PROPER: 'YAZIM.DÜZENİ', diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index 79968fc8a9..b99c16282d 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -91,6 +91,9 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'AVERAGEA': { method: 'averagea', }, + 'PRODUCT': { + method: 'product', + }, 'SUBTOTAL': { method: 'subtotal', parameters: [ @@ -183,6 +186,10 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } + public product(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doProduct(ast.args, formulaAddress) + } + public subtotal(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { if (ast.args.length < 1) { return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) @@ -206,6 +213,9 @@ export class NumericAggregationPlugin extends FunctionPlugin { case 5: case 105: return this.doMin(args, formulaAddress) + case 6: + case 106: + return this.doProduct(args, formulaAddress) case 9: case 109: return this.doSum(args, formulaAddress) @@ -270,6 +280,10 @@ export class NumericAggregationPlugin extends FunctionPlugin { return this.reduce(args, formulaAddress, 0, 'SUM', this.addWithEpsilon, identityMap, strictlyNumbers) } + private doProduct(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.reduce(args, formulaAddress, 1, 'PRODUCT', (left, right) => left * right, identityMap, strictlyNumbers) + } + private addWithEpsilon = (left: number, right: number): number => this.interpreter.arithmeticHelper.addWithEpsilon(left, right) /** diff --git a/test/interpreter/function-product.spec.ts b/test/interpreter/function-product.spec.ts new file mode 100644 index 0000000000..f504a8a350 --- /dev/null +++ b/test/interpreter/function-product.spec.ts @@ -0,0 +1,22 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function PRODUCT', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=PRODUCT()'] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate product', () => { + const engine = HyperFormula.buildFromArray([ + ['=PRODUCT(2, 3)'], + ['=PRODUCT(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(6) + expect(engine.getCellValue(adr('A2'))).toEqual(24) + }) +}) diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index 1215357d4a..d77a6c5e2d 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -68,6 +68,19 @@ describe('Function SUBTOTAL', () => { expect(engine.getCellValue(adr('B1'))).toEqual(2) }) + it('should calculate PRODUCT', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(6, A2:A4, A5)', '=SUBTOTAL(106, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(120) + expect(engine.getCellValue(adr('B1'))).toEqual(120) + }) + it('should calculate SUM', () => { const engine = HyperFormula.buildFromArray([ ['=SUBTOTAL(9, A2:A4, A5)', '=SUBTOTAL(109, A2:A4, A5)'], From 60149f79146e8cd46564a1ef27c861eba505652d Mon Sep 17 00:00:00 2001 From: izulin Date: Sat, 3 Oct 2020 23:39:00 +0200 Subject: [PATCH 05/40] function implementations --- src/i18n/languages/enGB.ts | 4 + .../plugin/NumericAggregationPlugin.ts | 149 ++++++++++++++++-- test/interpreter/function-stdevp.spec.ts | 22 +++ test/interpreter/function-stdevs.spec.ts | 24 +++ test/interpreter/function-subtotal.spec.ts | 69 +++++++- test/interpreter/function-varp.spec.ts | 22 +++ test/interpreter/function-vars.spec.ts | 24 +++ 7 files changed, 299 insertions(+), 15 deletions(-) create mode 100644 test/interpreter/function-stdevp.spec.ts create mode 100644 test/interpreter/function-stdevs.spec.ts create mode 100644 test/interpreter/function-varp.spec.ts create mode 100644 test/interpreter/function-vars.spec.ts diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index cdf9921d3b..db62e5d437 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -178,6 +178,8 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'SQRT', + 'STDEV.P': 'STDEV.P', + 'STDEV.S': 'STDEV.S', SUBSTITUTE: 'SUBSTITUTE', SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', @@ -205,6 +207,8 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'UPPER', VLOOKUP: 'VLOOKUP', + 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', WEEKDAY: 'WEEKDAY', WEEKNUM: 'WEEKNUM', XOR: 'XOR', diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index b99c16282d..b4b4fab9a9 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -9,10 +9,10 @@ import {CellError, EmptyValue, ErrorType, InternalScalarValue, SimpleCellAddress import {ErrorMessage} from '../../error-message' import {Maybe} from '../../Maybe' import {Ast, AstNodeType, CellRangeAst, ProcedureAst} from '../../parser' +import {ColumnRangeAst, RowRangeAst} from '../../parser/Ast' import {coerceBooleanToNumber} from '../ArithmeticHelper' import {SimpleRangeValue} from '../InterpreterValue' import {ArgumentTypes, FunctionPlugin} from './FunctionPlugin' -import {ColumnRangeAst, RowRangeAst} from '../../parser/Ast' export type BinaryOperation = (left: T, right: T) => T @@ -32,22 +32,23 @@ function zeroForInfinite(value: InternalScalarValue) { } } -class AverageResult { +class MomentsAggregate { - public static empty = new AverageResult(0, 0) + public static empty = new MomentsAggregate(0,0, 0) - public static single(arg: number): AverageResult { - return new AverageResult(arg, 1) + public static single(arg: number): MomentsAggregate { + return new MomentsAggregate(arg*arg, arg, 1) } constructor( + public readonly sumsq: number, public readonly sum: number, public readonly count: number, ) { } - public compose(other: AverageResult) { - return new AverageResult(this.sum + other.sum, this.count + other.count) + public compose(other: MomentsAggregate) { + return new MomentsAggregate(this.sumsq + other.sumsq, this.sum + other.sum, this.count + other.count) } public averageValue(): Maybe { @@ -57,6 +58,22 @@ class AverageResult { return undefined } } + + public varSValue(): Maybe { + if(this.count > 1) { + return (this.sumsq - (this.sum*this.sum)/this.count)/(this.count-1) + } else { + return undefined + } + } + + public varPValue(): Maybe { + if(this.count > 0) { + return (this.sumsq - (this.sum*this.sum)/this.count)/this.count + } else { + return undefined + } + } } export class NumericAggregationPlugin extends FunctionPlugin { @@ -94,6 +111,18 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'PRODUCT': { method: 'product', }, + 'VAR.S': { + method: 'vars', + }, + 'VAR.P': { + method: 'varp', + }, + 'STDEV.S': { + method: 'stdevs', + }, + 'STDEV.P': { + method: 'stdevp', + }, 'SUBTOTAL': { method: 'subtotal', parameters: [ @@ -173,9 +202,9 @@ export class NumericAggregationPlugin extends FunctionPlugin { } public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(ast.args, formulaAddress, AverageResult.empty, 'AVERAGE', + const result = this.reduce(ast.args, formulaAddress, MomentsAggregate.empty, 'AVERAGEA', (left, right) => left.compose(right), - (arg): AverageResult => AverageResult.single(arg), + (arg): MomentsAggregate => MomentsAggregate.single(arg), numbersBooleans ) @@ -186,6 +215,22 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } + public vars(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doVarS(ast.args, formulaAddress) + } + + public varp(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doVarP(ast.args, formulaAddress) + } + + public stdevs(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doStdevS(ast.args, formulaAddress) + } + + public stdevp(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + return this.doStdevP(ast.args, formulaAddress) + } + public product(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { return this.doProduct(ast.args, formulaAddress) } @@ -216,19 +261,31 @@ export class NumericAggregationPlugin extends FunctionPlugin { case 6: case 106: return this.doProduct(args, formulaAddress) + case 7: + case 107: + return this.doStdevS(args, formulaAddress) + case 8: + case 108: + return this.doStdevP(args, formulaAddress) case 9: case 109: return this.doSum(args, formulaAddress) + case 10: + case 110: + return this.doVarS(args, formulaAddress) + case 11: + case 111: + return this.doVarP(args, formulaAddress) default: - throw new Error('TODO') + return new CellError(ErrorType.VALUE, ErrorMessage.BadMode) } } private doAverage(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, AverageResult.empty, 'AVERAGE', (left, right) => { + const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { return left.compose(right) - }, (arg): AverageResult => { - return AverageResult.single(arg) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) }, strictlyNumbers ) @@ -240,6 +297,72 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } + private doVarS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { + return left.compose(right) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) + }, + strictlyNumbers + ) + + if (result instanceof CellError) { + return result + } else { + return result.varSValue() ?? new CellError(ErrorType.DIV_BY_ZERO) + } + } + + private doVarP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { + return left.compose(right) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) + }, + strictlyNumbers + ) + + if (result instanceof CellError) { + return result + } else { + return result.varPValue() ?? new CellError(ErrorType.DIV_BY_ZERO) + } + } + + private doStdevS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { + return left.compose(right) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) + }, + strictlyNumbers + ) + + if (result instanceof CellError) { + return result + } else { + const val = result.varSValue() + return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val) + } + } + + private doStdevP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { + return left.compose(right) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) + }, + strictlyNumbers + ) + + if (result instanceof CellError) { + return result + } else { + const val = result.varPValue() + return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val) + } + } + private doCount(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { const value = this.reduce(args, formulaAddress, 0, 'COUNT', (left, right) => left + right, identityMap, diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts new file mode 100644 index 0000000000..2557f065c6 --- /dev/null +++ b/test/interpreter/function-stdevp.spec.ts @@ -0,0 +1,22 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function STDEV.P', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate standard deviation (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(2, 3)'], + ['=STDEV.P(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.5) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(0.816496580927726, 6) + }) +}) diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts new file mode 100644 index 0000000000..396c3c9d3b --- /dev/null +++ b/test/interpreter/function-stdevs.spec.ts @@ -0,0 +1,24 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function STDEV.S', () => { + it('should take at least two arguments', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.S()'], + ['=STDEV.S(1)'] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + }) + + it('should calculate standard deviation (sample)', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.S(2, 3)'], + ['=STDEV.S(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) + expect(engine.getCellValue(adr('A2'))).toEqual(1) + }) +}) diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index d77a6c5e2d..9cc2848a03 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -1,5 +1,6 @@ -import {HyperFormula} from '../../src' -import {adr} from '../testUtils' +import {ErrorType, HyperFormula} from '../../src' +import {ErrorMessage} from '../../src/error-message' +import {adr, detailedError} from '../testUtils' describe('Function SUBTOTAL', () => { it('should calculate AVERAGE', () => { @@ -81,6 +82,32 @@ describe('Function SUBTOTAL', () => { expect(engine.getCellValue(adr('B1'))).toEqual(120) }) + it('should calculate STDEV.S', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(7, A2:A4, A5)', '=SUBTOTAL(107, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.29099444873581,6) + expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.29099444873581,6) + }) + + it('should calculate STDEV.P', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(8, A2:A4, A5)', '=SUBTOTAL(108, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.11803398875, 6) + expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.11803398875, 6) + }) + it('should calculate SUM', () => { const engine = HyperFormula.buildFromArray([ ['=SUBTOTAL(9, A2:A4, A5)', '=SUBTOTAL(109, A2:A4, A5)'], @@ -93,4 +120,42 @@ describe('Function SUBTOTAL', () => { expect(engine.getCellValue(adr('A1'))).toEqual(14) expect(engine.getCellValue(adr('B1'))).toEqual(14) }) + + it('should calculate VAR.S', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(10, A2:A4, A5)', '=SUBTOTAL(110, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(5/3,6) + expect(engine.getCellValue(adr('B1'))).toBeCloseTo(5/3, 6) + }) + + it('should calculate VAR.P', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(11, A2:A4, A5)', '=SUBTOTAL(111, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(5/4) + expect(engine.getCellValue(adr('B1'))).toEqual(5/4) + }) + + it('should return correct error', () => { + const engine = HyperFormula.buildFromArray([ + ['=SUBTOTAL(12345, A2:A4, A5)'], + [3], + [5], + [2], + [4] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.VALUE, ErrorMessage.BadMode)) + }) }) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts new file mode 100644 index 0000000000..0d669d6129 --- /dev/null +++ b/test/interpreter/function-varp.spec.ts @@ -0,0 +1,22 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function VAR.P', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate variance (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(2, 3)'], + ['=VAR.P(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.25) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2/3, 6) + }) +}) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts new file mode 100644 index 0000000000..d14ba1253c --- /dev/null +++ b/test/interpreter/function-vars.spec.ts @@ -0,0 +1,24 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function VAR.S', () => { + it('should take at least two arguments', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.S()'], + ['=VAR.S(1)'] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + }) + + it('should calculate variance (sample)', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.S(2, 3)'], + ['=VAR.S(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.5) + expect(engine.getCellValue(adr('A2'))).toEqual(1) + }) +}) From 41ee6d2137ec692b1adbf76754009397e18ee01c Mon Sep 17 00:00:00 2001 From: izulin Date: Sat, 3 Oct 2020 23:46:27 +0200 Subject: [PATCH 06/40] translations --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 0a2191ff36..89ef785bdf 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'ODPIS.LIN', SPLIT: 'SPLIT', SQRT: 'ODMOCNINA', + 'STDEV.P': 'SMODCH.P', SUBSTITUTE: 'DOSADIT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUMA', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 0cdfe4f9ab..8d9960ef89 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LA', SPLIT: 'SPLIT', SQRT: 'KVROD', + 'STDEV.P': 'STDAFV.P', SUBSTITUTE: 'UDSKIFT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 0f3bd3cfcb..5ce126b7f8 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIA', SPLIT: 'SPLIT', SQRT: 'WURZEL', + 'STDEV.P': 'STABW.N', SUBSTITUTE: 'WECHSELN', SUBTOTAL: 'TEILERGEBNIS', SUM: 'SUMME', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index e375005cb2..5ccb2267e8 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -178,6 +178,7 @@ export const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'RAIZ', + 'STDEV.P': 'DESVEST.P', SUBSTITUTE: 'SUSTITUIR', SUBTOTAL: 'SUBTOTALES', SUM: 'SUMA', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index ff195a9f47..697486a59a 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'STP', SPLIT: 'SPLIT', SQRT: 'NELIÖJUURI', + 'STDEV.P': 'KESKIHAJONTA.P', SUBSTITUTE: 'VAIHDA', SUBTOTAL: 'VÄLISUMMA', SUM: 'SUMMA', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index eabcb55550..1be021f2b7 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMORLIN', SPLIT: 'SPLIT', SQRT: 'RACINE', + 'STDEV.P': 'ECARTYPE.PEARSON', SUBSTITUTE: 'SUBSTITUE', SUBTOTAL: 'SOUS.TOTAL', SUM: 'SOMME', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 1ab9aa426e..9ffa8d9c58 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LCSA', SPLIT: 'SPLIT', SQRT: 'GYÖK', + 'STDEV.P': 'SZÓR.S', SUBSTITUTE: 'HELYETTE', SUBTOTAL: 'RÉSZÖSSZEG', SUM: 'SZUM', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index 14759d6812..e7af7dc59b 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMMORT.COST', SPLIT: 'SPLIT', SQRT: 'RADQ', + 'STDEV.P': 'DEV.ST.P', SUBSTITUTE: 'SOSTITUISCI', SUBTOTAL: 'SUBTOTALE', SUM: 'SOMMA', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 8ac6d81d96..90fad58a17 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVS', SPLIT: 'SPLIT', SQRT: 'ROT', + 'STDEV.P': 'STDAV.P', SUBSTITUTE: 'BYTT.UT', SUBTOTAL: 'DELSUM', SUM: 'SUMMER', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 5ed4509c2a..441c575ab4 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIN.AFSCHR', SPLIT: 'SPLIT', SQRT: 'WORTEL', + 'STDEV.P': 'STDEV.P', SUBSTITUTE: 'SUBSTITUEREN', SUBTOTAL: 'SUBTOTAAL', SUM: 'SOM', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 91f3939a52..1041db90b0 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', + 'STDEV.P': 'ODCH.STAND.POPUL', SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index a81dfe86ed..e2a29aa221 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DPD', SPLIT: 'SPLIT', SQRT: 'RAIZ', + 'STDEV.P': 'DESVPAD.P', SUBSTITUTE: 'SUBSTITUIR', SUBTOTAL: 'SUBTOTAL', SUM: 'SOMA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 80e402cb61..a1fc8b30ff 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'АПЛ', SPLIT: 'SPLIT', SQRT: 'КОРЕНЬ', + 'STDEV.P': 'СТАНДОТКЛОН.Г', SUBSTITUTE: 'ПОДСТАВИТЬ', SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ', SUM: 'СУММ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index bb2e37f065..00f7028246 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVSKR', SPLIT: 'SPLIT', SQRT: 'ROT', + 'STDEV.P': 'STDAV.P', SUBSTITUTE: 'BYT.UT', SUBTOTAL: 'DELSUMMA', SUM: 'SUMMA', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 771df6d754..2da05bb7dc 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DA', SPLIT: 'SPLIT', SQRT: 'KAREKÖK', + 'STDEV.P': 'STDSAPMA.P', SUBSTITUTE: 'YERİNEKOY', SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE', SUM: 'TOPLA', From c209d6520e4924ad65eb017b4f40b3a4c9475971 Mon Sep 17 00:00:00 2001 From: izulin Date: Sat, 3 Oct 2020 23:49:23 +0200 Subject: [PATCH 07/40] translations --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 89ef785bdf..e4da562ff7 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'ODMOCNINA', 'STDEV.P': 'SMODCH.P', + 'STDEV.S': 'SMODCH.VÝBĚR.S', SUBSTITUTE: 'DOSADIT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUMA', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 8d9960ef89..72cb21545b 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'KVROD', 'STDEV.P': 'STDAFV.P', + 'STDEV.S': 'STDAFV.S', SUBSTITUTE: 'UDSKIFT', SUBTOTAL: 'SUBTOTAL', SUM: 'SUM', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 5ce126b7f8..919ec24864 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'WURZEL', 'STDEV.P': 'STABW.N', + 'STDEV.S': 'STABW.S', SUBSTITUTE: 'WECHSELN', SUBTOTAL: 'TEILERGEBNIS', SUM: 'SUMME', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 5ccb2267e8..48a125d0f5 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -179,6 +179,7 @@ export const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'RAIZ', 'STDEV.P': 'DESVEST.P', + 'STDEV.S': 'DESVEST.M', SUBSTITUTE: 'SUSTITUIR', SUBTOTAL: 'SUBTOTALES', SUM: 'SUMA', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 697486a59a..99a0b973df 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'NELIÖJUURI', 'STDEV.P': 'KESKIHAJONTA.P', + 'STDEV.S': 'KESKIHAJONTA.S', SUBSTITUTE: 'VAIHDA', SUBTOTAL: 'VÄLISUMMA', SUM: 'SUMMA', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 1be021f2b7..758d3b9fcb 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'RACINE', 'STDEV.P': 'ECARTYPE.PEARSON', + 'STDEV.S': 'ECARTYPE.STANDARD', SUBSTITUTE: 'SUBSTITUE', SUBTOTAL: 'SOUS.TOTAL', SUM: 'SOMME', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 9ffa8d9c58..92804cd64c 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'GYÖK', 'STDEV.P': 'SZÓR.S', + 'STDEV.S': 'SZÓR.M', SUBSTITUTE: 'HELYETTE', SUBTOTAL: 'RÉSZÖSSZEG', SUM: 'SZUM', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index e7af7dc59b..f1f1d607b6 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'RADQ', 'STDEV.P': 'DEV.ST.P', + 'STDEV.S': 'DEV.ST.C', SUBSTITUTE: 'SOSTITUISCI', SUBTOTAL: 'SUBTOTALE', SUM: 'SOMMA', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 90fad58a17..2f133d2754 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'ROT', 'STDEV.P': 'STDAV.P', + 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYTT.UT', SUBTOTAL: 'DELSUM', SUM: 'SUMMER', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 441c575ab4..9b5d174faa 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'WORTEL', 'STDEV.P': 'STDEV.P', + 'STDEV.S': 'STDEV.S', SUBSTITUTE: 'SUBSTITUEREN', SUBTOTAL: 'SUBTOTAAL', SUM: 'SOM', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 1041db90b0..94311e92d5 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', 'STDEV.P': 'ODCH.STAND.POPUL', + 'STDEV.S': 'ODCH.STAND.POPUL', SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index e2a29aa221..8fa3f26aa2 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'RAIZ', 'STDEV.P': 'DESVPAD.P', + 'STDEV.S': 'DESVPAD.A', SUBSTITUTE: 'SUBSTITUIR', SUBTOTAL: 'SUBTOTAL', SUM: 'SOMA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index a1fc8b30ff..c51f8dec42 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'КОРЕНЬ', 'STDEV.P': 'СТАНДОТКЛОН.Г', + 'STDEV.S': 'СТАНДОТКЛОН.В', SUBSTITUTE: 'ПОДСТАВИТЬ', SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ', SUM: 'СУММ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 00f7028246..45fd2057cf 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'ROT', 'STDEV.P': 'STDAV.P', + 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYT.UT', SUBTOTAL: 'DELSUMMA', SUM: 'SUMMA', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 2da05bb7dc..a4ee5cd53e 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -179,6 +179,7 @@ const dictionary: RawTranslationPackage = { SPLIT: 'SPLIT', SQRT: 'KAREKÖK', 'STDEV.P': 'STDSAPMA.P', + 'STDEV.S': 'STDSAPMA.S', SUBSTITUTE: 'YERİNEKOY', SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE', SUM: 'TOPLA', From 6a1b1144b85f09ec325a50e360eb2e53f5323694 Mon Sep 17 00:00:00 2001 From: izulin Date: Sat, 3 Oct 2020 23:52:31 +0200 Subject: [PATCH 08/40] . --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/enGB.ts | 2 +- src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 16 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index e4da562ff7..e7faaf74f4 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'VELKÁ', + 'VAR.P': 'VAR.P', VLOOKUP: 'SVYHLEDAT', WEEKDAY: 'DENTÝDNE', WEEKNUM: 'WEEKNUM', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 72cb21545b..ebeb96b72d 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'STORE.BOGSTAVER', + 'VAR.P': 'VARIANS.P', VLOOKUP: 'LOPSLAG', WEEKDAY: 'UGEDAG', WEEKNUM: 'UGE.NR', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 919ec24864..12fa6d12ac 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNIZEICHEN', UNICODE: 'UNICODE', UPPER: 'GROSS', + 'VAR.P': 'VAR.P', VLOOKUP: 'SVERWEIS', WEEKDAY: 'WOCHENTAG', WEEKNUM: 'KALENDERWOCHE', diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index db62e5d437..b3c4136f61 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -206,9 +206,9 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'UPPER', - VLOOKUP: 'VLOOKUP', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', + VLOOKUP: 'VLOOKUP', WEEKDAY: 'WEEKDAY', WEEKNUM: 'WEEKNUM', XOR: 'XOR', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 48a125d0f5..551c0cef51 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -206,6 +206,7 @@ export const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'MAYUSC', + 'VAR.P': 'VAR.P', VLOOKUP: 'BUSCARV', WEEKDAY: 'DIASEM', WEEKNUM: 'NUM.DE.SEMANA', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 99a0b973df..89228cd22a 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODEMERKKI', UNICODE: 'UNICODE', UPPER: 'ISOT', + 'VAR.P': 'VAR.P', VLOOKUP: 'PHAKU', WEEKDAY: 'VIIKONPÄIVÄ', WEEKNUM: 'VIIKKO.NRO', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 758d3b9fcb..aa2d85ace2 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICAR', UNICODE: 'UNICODE', UPPER: 'MAJUSCULE', + 'VAR.P': 'VAR.P.N', VLOOKUP: 'RECHERCHEV', WEEKDAY: 'JOURSEM', WEEKNUM: 'NO.SEMAINE', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 92804cd64c..29331fe756 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNIKARAKTER', UNICODE: 'UNICODE', UPPER: 'NAGYBETŰS', + 'VAR.P': 'VAR.S', VLOOKUP: 'FKERES', WEEKDAY: 'HÉT.NAPJA', WEEKNUM: 'HÉT.SZÁMA', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index f1f1d607b6..43855181e8 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'CARATT.UNI', UNICODE: 'UNICODE', UPPER: 'MAIUSC', + 'VAR.P': 'VAR.P', VLOOKUP: 'CERCA.VERT', WEEKDAY: 'GIORNO.SETTIMANA', WEEKNUM: 'NUM.SETTIMANA', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 2f133d2754..2be0e1f313 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODETEGN', UNICODE: 'UNICODE', UPPER: 'STORE', + 'VAR.P': 'VARIANS.P', VLOOKUP: 'FINN.RAD', WEEKDAY: 'UKEDAG', WEEKNUM: 'UKENR', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 9b5d174faa..b03f37893d 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNITEKEN', UNICODE: 'UNICODE', UPPER: 'HOOFDLETTERS', + 'VAR.P': 'VAR.P', VLOOKUP: 'VERT.ZOEKEN', WEEKDAY: 'WEEKDAG', WEEKNUM: 'WEEKNUMMER', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 94311e92d5..f118557095 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'ZNAK.UNICODE', UNICODE: 'UNICODE', UPPER: 'LITERY.WIELKIE', + 'VAR.P': 'WARIANCJA.POP', VLOOKUP: 'WYSZUKAJ.PIONOWO', WEEKDAY: 'DZIEŃ.TYG', WEEKNUM: 'NUM.TYG', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 8fa3f26aa2..702f3e6cb3 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'CARACTUNI', UNICODE: 'UNICODE', UPPER: 'MAIÚSCULA', + 'VAR.P': 'VAR.P', VLOOKUP: 'PROCV', WEEKDAY: 'DIA.DA.SEMANA', WEEKNUM: 'NÚMSEMANA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index c51f8dec42..f0c18f4591 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'ЮНИСИМВ', UNICODE: 'UNICODE', UPPER: 'ПРОПИСН', + 'VAR.P': 'ДИСП.Г', VLOOKUP: 'ВПР', WEEKDAY: 'ДЕНЬНЕД', WEEKNUM: 'НОМНЕДЕЛИ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 45fd2057cf..afe32dae5a 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'VERSALER', + 'VAR.P': 'VARIANS.P', VLOOKUP: 'LETARAD', WEEKDAY: 'VECKODAG', WEEKNUM: 'VECKONR', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index a4ee5cd53e..1e1004b6c1 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -206,6 +206,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODEKARAKTERİ', UNICODE: 'UNICODE', UPPER: 'BÜYÜKHARF', + 'VAR.P': 'VAR.P', VLOOKUP: 'DÜŞEYARA', WEEKDAY: 'HAFTANINGÜNÜ', WEEKNUM: 'HAFTASAY', From 2efeb984cd06e21ab5ebe473fb765efb90f18f62 Mon Sep 17 00:00:00 2001 From: izulin Date: Sat, 3 Oct 2020 23:54:20 +0200 Subject: [PATCH 09/40] translations --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index e7faaf74f4..3f87c3f142 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'VELKÁ', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'SVYHLEDAT', WEEKDAY: 'DENTÝDNE', WEEKNUM: 'WEEKNUM', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index ebeb96b72d..ab999d41e0 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'STORE.BOGSTAVER', 'VAR.P': 'VARIANS.P', + 'VAR.S': 'VARIANS.S', VLOOKUP: 'LOPSLAG', WEEKDAY: 'UGEDAG', WEEKNUM: 'UGE.NR', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 12fa6d12ac..b501f4dbd3 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'GROSS', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'SVERWEIS', WEEKDAY: 'WOCHENTAG', WEEKNUM: 'KALENDERWOCHE', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 551c0cef51..5fdabbf200 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -207,6 +207,7 @@ export const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'MAYUSC', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'BUSCARV', WEEKDAY: 'DIASEM', WEEKNUM: 'NUM.DE.SEMANA', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 89228cd22a..b6da990e24 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'ISOT', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'PHAKU', WEEKDAY: 'VIIKONPÄIVÄ', WEEKNUM: 'VIIKKO.NRO', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index aa2d85ace2..c05d81eb70 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'MAJUSCULE', 'VAR.P': 'VAR.P.N', + 'VAR.S': 'VAR.S', VLOOKUP: 'RECHERCHEV', WEEKDAY: 'JOURSEM', WEEKNUM: 'NO.SEMAINE', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 29331fe756..015333ba0d 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'NAGYBETŰS', 'VAR.P': 'VAR.S', + 'VAR.S': 'VAR.M', VLOOKUP: 'FKERES', WEEKDAY: 'HÉT.NAPJA', WEEKNUM: 'HÉT.SZÁMA', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index 43855181e8..a0cad62a80 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'MAIUSC', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.C', VLOOKUP: 'CERCA.VERT', WEEKDAY: 'GIORNO.SETTIMANA', WEEKNUM: 'NUM.SETTIMANA', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 2be0e1f313..927155801a 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'STORE', 'VAR.P': 'VARIANS.P', + 'VAR.S': 'VARIANS.S', VLOOKUP: 'FINN.RAD', WEEKDAY: 'UKEDAG', WEEKNUM: 'UKENR', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index b03f37893d..f63eb08128 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'HOOFDLETTERS', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'VERT.ZOEKEN', WEEKDAY: 'WEEKDAG', WEEKNUM: 'WEEKNUMMER', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index f118557095..af68d6d0d8 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'LITERY.WIELKIE', 'VAR.P': 'WARIANCJA.POP', + 'VAR.S': 'WARIANCJA.PRÓBKI', VLOOKUP: 'WYSZUKAJ.PIONOWO', WEEKDAY: 'DZIEŃ.TYG', WEEKNUM: 'NUM.TYG', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 702f3e6cb3..2b6dc2189b 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'MAIÚSCULA', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.A', VLOOKUP: 'PROCV', WEEKDAY: 'DIA.DA.SEMANA', WEEKNUM: 'NÚMSEMANA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index f0c18f4591..1901d451a5 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'ПРОПИСН', 'VAR.P': 'ДИСП.Г', + 'VAR.S': 'ДИСП.В', VLOOKUP: 'ВПР', WEEKDAY: 'ДЕНЬНЕД', WEEKNUM: 'НОМНЕДЕЛИ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index afe32dae5a..daecb42cea 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'VERSALER', 'VAR.P': 'VARIANS.P', + 'VAR.S': 'VARIANS.S', VLOOKUP: 'LETARAD', WEEKDAY: 'VECKODAG', WEEKNUM: 'VECKONR', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 1e1004b6c1..3724e869ee 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -207,6 +207,7 @@ const dictionary: RawTranslationPackage = { UNICODE: 'UNICODE', UPPER: 'BÜYÜKHARF', 'VAR.P': 'VAR.P', + 'VAR.S': 'VAR.S', VLOOKUP: 'DÜŞEYARA', WEEKDAY: 'HAFTANINGÜNÜ', WEEKNUM: 'HAFTASAY', From f9edac7353465db1964a1a9277bf05caf3ed12d9 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 00:07:25 +0200 Subject: [PATCH 10/40] docs --- CHANGELOG.md | 2 ++ docs/guide/built-in-functions.md | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1579a92bf..71c9799046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added 9 text functions EXACT, LOWER, UPPER, MID, T, SUBSTITUTE, REPLACE, UNICODE, UNICHAR. (#159) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) +- Added 4 statistical functions VAR.P, VAR.S, STDEV.P, STDEV.S. +- Added 1 mathemtical function SUBTOTAL. ### Fixed - Fixed multiple issues with VLOOKUP function. (#526, #528) diff --git a/docs/guide/built-in-functions.md b/docs/guide/built-in-functions.md index 749f1a2a85..7225fc53ab 100644 --- a/docs/guide/built-in-functions.md +++ b/docs/guide/built-in-functions.md @@ -202,6 +202,7 @@ lets you design your own [custom functions](custom-functions). | SIN | Math and trigonometry | Returns the sine of the given angle (in radians). | SIN(Number) | | SINH
| Math and trigonometry | Returns the hyperbolic sine of the given value. | SINH(Number) | | SQRT | Math and trigonometry | Returns the positive square root of a number. | SQRT(Number) | +| SUBTOTAL | Math and trigonometry | Computes aggregation using function specified by number. | SUBTOTAL(Function; Number1; Number2; ... Number30) | | SUM | Math and trigonometry | Adds all the numbers in a range of cells. | SUM(Number1; Number2; ...; Number30) | | SUMIF | Math and trigonometry | Adds the cells specified by given criteria. | SUMIF(Range; Criteria; Sumrange) | | SUMIFS | Math and trigonometry | Returns the sum of the values of cells in a range that meets multiple criteria in multiple ranges. | SUMIFS(Sum_Range ; Criterion_range1 ; Criterion1 [ ; Criterion_range2 ; Criterion2 [;...]]) | @@ -228,6 +229,10 @@ lets you design your own [custom functions](custom-functions). | MEDIAN | Statistical | Returns the median of a set of numbers. | MEDIAN(Number1; Number2; ...Number30) | | MIN | Statistical | Returns the minimum value in a list of arguments. | MIN(Number1; Number2; ...Number30) | | MINA | Statistical | Returns the minimum value in a list of arguments. | MINA(Value1; Value2; ... Value30) | +| STDEV.P | Statistical | Returns standard deviation of a population. | STDEV.P(Value1; Value2; ... Value30) | +| STDEV.S | Statistical | Returns standard deviation of a sample. | STDEV.S(Value1; Value2; ... Value30) | +| VAR.P | Statistical | Returns variance of a population. | VAR.P(Value1; Value2; ... Value30) | +| VAR.S | Statistical | Returns variance of a sample. | VAR.S(Value1; Value2; ... Value30) | | CHAR | Text | Converts a number into a character according to the current code table. | CHAR(Number) | | CLEAN
| Text | Returns text that has been "cleaned" of line breaks and other non-printable characters. | CLEAN("Text") | | CLEAN | Text | Returns text that has been "cleaned" of line breaks and other non-printable characters. | CLEAN("Text") | From 6b942823a94074c517ab8bcc755fc72cee633663 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 00:08:28 +0200 Subject: [PATCH 11/40] linter --- src/interpreter/plugin/NumericAggregationPlugin.ts | 2 +- test/interpreter/function-subtotal.spec.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index b4b4fab9a9..c6454a16b0 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -34,7 +34,7 @@ function zeroForInfinite(value: InternalScalarValue) { class MomentsAggregate { - public static empty = new MomentsAggregate(0,0, 0) + public static empty = new MomentsAggregate(0, 0, 0) public static single(arg: number): MomentsAggregate { return new MomentsAggregate(arg*arg, arg, 1) diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index 9cc2848a03..1c015a8f54 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -91,8 +91,8 @@ describe('Function SUBTOTAL', () => { [4] ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.29099444873581,6) - expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.29099444873581,6) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.29099444873581, 6) + expect(engine.getCellValue(adr('B1'))).toBeCloseTo(1.29099444873581, 6) }) it('should calculate STDEV.P', () => { @@ -130,7 +130,7 @@ describe('Function SUBTOTAL', () => { [4] ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(5/3,6) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(5/3, 6) expect(engine.getCellValue(adr('B1'))).toBeCloseTo(5/3, 6) }) From dc352084a566ed7fe47ce3fd06475b8bf7400916 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 00:21:18 +0200 Subject: [PATCH 12/40] fixed translation --- src/i18n/languages/plPL.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index af68d6d0d8..6cc60a4f46 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -178,8 +178,8 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', - 'STDEV.P': 'ODCH.STAND.POPUL', - 'STDEV.S': 'ODCH.STAND.POPUL', + 'STDEV.P': 'ODCH.STAND.POPUL', //FIXME + 'STDEV.S': 'ODCH.STANDARD.PRÓBKI', //FIXME SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', From b54a8895cd5b206724f08ce8583bd910eb91a82a Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 12:29:50 +0200 Subject: [PATCH 13/40] a-versions --- src/i18n/languages/enGB.ts | 4 + .../plugin/NumericAggregationPlugin.ts | 111 ++++++++++++------ test/interpreter/function-stdeva.spec.ts | 24 ++++ test/interpreter/function-stdevpa.spec.ts | 22 ++++ test/interpreter/function-vara.spec.ts | 24 ++++ test/interpreter/function-varpa.spec.ts | 22 ++++ 6 files changed, 171 insertions(+), 36 deletions(-) create mode 100644 test/interpreter/function-stdeva.spec.ts create mode 100644 test/interpreter/function-stdevpa.spec.ts create mode 100644 test/interpreter/function-vara.spec.ts create mode 100644 test/interpreter/function-varpa.spec.ts diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index b3c4136f61..82acca2c23 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -178,7 +178,9 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'SQRT', + STDEVA: 'STDEVA', 'STDEV.P': 'STDEV.P', + STDEVPA: 'STDEVPA', 'STDEV.S': 'STDEV.S', SUBSTITUTE: 'SUBSTITUTE', SUBTOTAL: 'SUBTOTAL', @@ -206,7 +208,9 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'UPPER', + VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'VLOOKUP', WEEKDAY: 'WEEKDAY', diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index c6454a16b0..b979498fc4 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -117,19 +117,26 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'VAR.P': { method: 'varp', }, + 'VARA': { + method: 'vara', + }, + 'VARPA': { + method: 'varpa', + }, 'STDEV.S': { method: 'stdevs', }, 'STDEV.P': { method: 'stdevp', }, + 'STDEVA': { + method: 'stdeva', + }, + 'STDEVPA': { + method: 'stdevpa', + }, 'SUBTOTAL': { method: 'subtotal', - parameters: [ - {argumentType: ArgumentTypes.NUMBER}, - {argumentType: ArgumentTypes.RANGE} - ], - repeatLastArgs: 1 } } @@ -202,7 +209,7 @@ export class NumericAggregationPlugin extends FunctionPlugin { } public averagea(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(ast.args, formulaAddress, MomentsAggregate.empty, 'AVERAGEA', + const result = this.reduce(ast.args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE_A', (left, right) => left.compose(right), (arg): MomentsAggregate => MomentsAggregate.single(arg), numbersBooleans @@ -223,6 +230,26 @@ export class NumericAggregationPlugin extends FunctionPlugin { return this.doVarP(ast.args, formulaAddress) } + public vara(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduceAggregateA(ast.args, formulaAddress) + + if (result instanceof CellError) { + return result + } else { + return result.varSValue() ?? new CellError(ErrorType.DIV_BY_ZERO) + } + } + + public varpa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduceAggregateA(ast.args, formulaAddress) + + if (result instanceof CellError) { + return result + } else { + return result.varPValue() ?? new CellError(ErrorType.DIV_BY_ZERO) + } + } + public stdevs(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { return this.doStdevS(ast.args, formulaAddress) } @@ -231,6 +258,28 @@ export class NumericAggregationPlugin extends FunctionPlugin { return this.doStdevP(ast.args, formulaAddress) } + public stdeva(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduceAggregateA(ast.args, formulaAddress) + + if (result instanceof CellError) { + return result + } else { + const val = result.varSValue() + return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val) + } + } + + public stdevpa(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduceAggregateA(ast.args, formulaAddress) + + if (result instanceof CellError) { + return result + } else { + const val = result.varPValue() + return val === undefined ? new CellError(ErrorType.DIV_BY_ZERO) : Math.sqrt(val) + } + } + public product(ast: ProcedureAst, formulaAddress: SimpleCellAddress): InternalScalarValue { return this.doProduct(ast.args, formulaAddress) } @@ -281,14 +330,28 @@ export class NumericAggregationPlugin extends FunctionPlugin { } } - private doAverage(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { + private reduceAggregate(args: Ast[], formulaAddress: SimpleCellAddress): MomentsAggregate | CellError{ + return this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { return left.compose(right) }, (arg): MomentsAggregate => { return MomentsAggregate.single(arg) }, strictlyNumbers ) + } + + private reduceAggregateA(args: Ast[], formulaAddress: SimpleCellAddress): MomentsAggregate | CellError{ + return this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE_A', (left, right) => { + return left.compose(right) + }, (arg): MomentsAggregate => { + return MomentsAggregate.single(arg) + }, + numbersBooleans + ) + } + + private doAverage(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { + const result = this.reduceAggregate(args, formulaAddress) if (result instanceof CellError) { return result @@ -298,13 +361,7 @@ export class NumericAggregationPlugin extends FunctionPlugin { } private doVarS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { - return left.compose(right) - }, (arg): MomentsAggregate => { - return MomentsAggregate.single(arg) - }, - strictlyNumbers - ) + const result = this.reduceAggregate(args, formulaAddress) if (result instanceof CellError) { return result @@ -314,13 +371,7 @@ export class NumericAggregationPlugin extends FunctionPlugin { } private doVarP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { - return left.compose(right) - }, (arg): MomentsAggregate => { - return MomentsAggregate.single(arg) - }, - strictlyNumbers - ) + const result = this.reduceAggregate(args, formulaAddress) if (result instanceof CellError) { return result @@ -330,13 +381,7 @@ export class NumericAggregationPlugin extends FunctionPlugin { } private doStdevS(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { - return left.compose(right) - }, (arg): MomentsAggregate => { - return MomentsAggregate.single(arg) - }, - strictlyNumbers - ) + const result = this.reduceAggregate(args, formulaAddress) if (result instanceof CellError) { return result @@ -347,13 +392,7 @@ export class NumericAggregationPlugin extends FunctionPlugin { } private doStdevP(args: Ast[], formulaAddress: SimpleCellAddress): InternalScalarValue { - const result = this.reduce(args, formulaAddress, MomentsAggregate.empty, '_AGGREGATE', (left, right) => { - return left.compose(right) - }, (arg): MomentsAggregate => { - return MomentsAggregate.single(arg) - }, - strictlyNumbers - ) + const result = this.reduceAggregate(args, formulaAddress) if (result instanceof CellError) { return result diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts new file mode 100644 index 0000000000..80adf13359 --- /dev/null +++ b/test/interpreter/function-stdeva.spec.ts @@ -0,0 +1,24 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function STDEVA', () => { + it('should take at least two arguments', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVA()'], + ['=STDEVA(1)'] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + }) + + it('should calculate standard deviation (sample)', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVA(2, 3)'], + ['=STDEVA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.78885438199983, 6) + }) +}) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts new file mode 100644 index 0000000000..d6a3565a56 --- /dev/null +++ b/test/interpreter/function-stdevpa.spec.ts @@ -0,0 +1,22 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function STDEVPA', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate standard deviation (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA(2, 3)'], + ['=STDEVPA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.5) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.6, 6) + }) +}) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts new file mode 100644 index 0000000000..13de2cb518 --- /dev/null +++ b/test/interpreter/function-vara.spec.ts @@ -0,0 +1,24 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function VARA', () => { + it('should take at least two arguments', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARA()'], + ['=VARA(1)'] + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + }) + + it('should calculate variance (sample)', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARA(2, 3)'], + ['=VARA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.5) + expect(engine.getCellValue(adr('A2'))).toEqual(3.2) + }) +}) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts new file mode 100644 index 0000000000..fe3e616fba --- /dev/null +++ b/test/interpreter/function-varpa.spec.ts @@ -0,0 +1,22 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function VARPA', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARPA()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate variance (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARPA(2, 3)'], + ['=VARPA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.25) + expect(engine.getCellValue(adr('A2'))).toEqual(2.56) + }) +}) From 01362bba145712dee28fb5542679ba2af5cd8df8 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 12:46:33 +0200 Subject: [PATCH 14/40] . --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 5 +++-- src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 3f87c3f142..f863899d53 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'ODPIS.LIN', SPLIT: 'SPLIT', SQRT: 'ODMOCNINA', + STDEVA: 'STDEVA', 'STDEV.P': 'SMODCH.P', 'STDEV.S': 'SMODCH.VÝBĚR.S', SUBSTITUTE: 'DOSADIT', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index ab999d41e0..e9b1fe2a09 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LA', SPLIT: 'SPLIT', SQRT: 'KVROD', + STDEVA: 'STDAFVV', 'STDEV.P': 'STDAFV.P', 'STDEV.S': 'STDAFV.S', SUBSTITUTE: 'UDSKIFT', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index b501f4dbd3..0daf2d11d4 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIA', SPLIT: 'SPLIT', SQRT: 'WURZEL', + STDEVA: 'STABWA', 'STDEV.P': 'STABW.N', 'STDEV.S': 'STABW.S', SUBSTITUTE: 'WECHSELN', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 5fdabbf200..a1faa0fff3 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -178,6 +178,7 @@ export const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'SPLIT', SQRT: 'RAIZ', + STDEVA: 'DESVESTA', 'STDEV.P': 'DESVEST.P', 'STDEV.S': 'DESVEST.M', SUBSTITUTE: 'SUSTITUIR', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index b6da990e24..086aca74d5 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'STP', SPLIT: 'SPLIT', SQRT: 'NELIÖJUURI', + STDEVA: 'KESKIHAJONTAA', 'STDEV.P': 'KESKIHAJONTA.P', 'STDEV.S': 'KESKIHAJONTA.S', SUBSTITUTE: 'VAIHDA', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index c05d81eb70..0cd997d0c3 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMORLIN', SPLIT: 'SPLIT', SQRT: 'RACINE', + STDEVA: 'STDEVA', 'STDEV.P': 'ECARTYPE.PEARSON', 'STDEV.S': 'ECARTYPE.STANDARD', SUBSTITUTE: 'SUBSTITUE', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 015333ba0d..400102466f 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LCSA', SPLIT: 'SPLIT', SQRT: 'GYÖK', + STDEVA: 'SZÓRÁSA', 'STDEV.P': 'SZÓR.S', 'STDEV.S': 'SZÓR.M', SUBSTITUTE: 'HELYETTE', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index a0cad62a80..f78e6383c6 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'AMMORT.COST', SPLIT: 'SPLIT', SQRT: 'RADQ', + STDEVA: 'DEV.ST.VALORI', 'STDEV.P': 'DEV.ST.P', 'STDEV.S': 'DEV.ST.C', SUBSTITUTE: 'SOSTITUISCI', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 927155801a..1deeb6ba6c 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVS', SPLIT: 'SPLIT', SQRT: 'ROT', + STDEVA: 'STDAVVIKA', 'STDEV.P': 'STDAV.P', 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYTT.UT', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index f63eb08128..676ea3f53d 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LIN.AFSCHR', SPLIT: 'SPLIT', SQRT: 'WORTEL', + STDEVA: 'STDEVA', 'STDEV.P': 'STDEV.P', 'STDEV.S': 'STDEV.S', SUBSTITUTE: 'SUBSTITUEREN', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 6cc60a4f46..bf6d0e7d67 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -178,8 +178,9 @@ const dictionary: RawTranslationPackage = { SLN: 'SLN', SPLIT: 'PODZIEL.TEKST', SQRT: 'PIERWIASTEK', - 'STDEV.P': 'ODCH.STAND.POPUL', //FIXME - 'STDEV.S': 'ODCH.STANDARD.PRÓBKI', //FIXME + STDEVA: 'ODCH.STANDARDOWE.A', + 'STDEV.P': 'ODCH.STAND.POPUL', + 'STDEV.S': 'ODCH.STANDARD.PRÓBKI', SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', SUM: 'SUMA', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 2b6dc2189b..6285444d95 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DPD', SPLIT: 'SPLIT', SQRT: 'RAIZ', + STDEVA: 'DESVPADA', 'STDEV.P': 'DESVPAD.P', 'STDEV.S': 'DESVPAD.A', SUBSTITUTE: 'SUBSTITUIR', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 1901d451a5..d33b5d1822 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'АПЛ', SPLIT: 'SPLIT', SQRT: 'КОРЕНЬ', + STDEVA: 'СТАНДОТКЛОНА', 'STDEV.P': 'СТАНДОТКЛОН.Г', 'STDEV.S': 'СТАНДОТКЛОН.В', SUBSTITUTE: 'ПОДСТАВИТЬ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index daecb42cea..56de08432c 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'LINAVSKR', SPLIT: 'SPLIT', SQRT: 'ROT', + STDEVA: 'STDEVA', 'STDEV.P': 'STDAV.P', 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYT.UT', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index 3724e869ee..e660d8bd55 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -178,6 +178,7 @@ const dictionary: RawTranslationPackage = { SLN: 'DA', SPLIT: 'SPLIT', SQRT: 'KAREKÖK', + STDEVA: 'STDSAPMAA', 'STDEV.P': 'STDSAPMA.P', 'STDEV.S': 'STDSAPMA.S', SUBSTITUTE: 'YERİNEKOY', From cd1cd17d6432c1ff751fe2aa3231d99349035b58 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 12:49:10 +0200 Subject: [PATCH 15/40] . --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index f863899d53..f08cc5438e 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'ODMOCNINA', STDEVA: 'STDEVA', 'STDEV.P': 'SMODCH.P', + STDEVPA: 'STDEVPA', 'STDEV.S': 'SMODCH.VÝBĚR.S', SUBSTITUTE: 'DOSADIT', SUBTOTAL: 'SUBTOTAL', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index e9b1fe2a09..b31a6f687c 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'KVROD', STDEVA: 'STDAFVV', 'STDEV.P': 'STDAFV.P', + STDEVPA: 'STDAFVPV', 'STDEV.S': 'STDAFV.S', SUBSTITUTE: 'UDSKIFT', SUBTOTAL: 'SUBTOTAL', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 0daf2d11d4..81e4e5e2ff 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'WURZEL', STDEVA: 'STABWA', 'STDEV.P': 'STABW.N', + STDEVPA: 'STABWNA', 'STDEV.S': 'STABW.S', SUBSTITUTE: 'WECHSELN', SUBTOTAL: 'TEILERGEBNIS', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index a1faa0fff3..4d897669d1 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -180,6 +180,7 @@ export const dictionary: RawTranslationPackage = { SQRT: 'RAIZ', STDEVA: 'DESVESTA', 'STDEV.P': 'DESVEST.P', + STDEVPA: 'DESVESTPA', 'STDEV.S': 'DESVEST.M', SUBSTITUTE: 'SUSTITUIR', SUBTOTAL: 'SUBTOTALES', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 086aca74d5..88e79a8b43 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'NELIÖJUURI', STDEVA: 'KESKIHAJONTAA', 'STDEV.P': 'KESKIHAJONTA.P', + STDEVPA: 'KESKIHAJONTAPA', 'STDEV.S': 'KESKIHAJONTA.S', SUBSTITUTE: 'VAIHDA', SUBTOTAL: 'VÄLISUMMA', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 0cd997d0c3..44fc40b057 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'RACINE', STDEVA: 'STDEVA', 'STDEV.P': 'ECARTYPE.PEARSON', + STDEVPA: 'STDEVPA', 'STDEV.S': 'ECARTYPE.STANDARD', SUBSTITUTE: 'SUBSTITUE', SUBTOTAL: 'SOUS.TOTAL', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 400102466f..5fed3fb01b 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'GYÖK', STDEVA: 'SZÓRÁSA', 'STDEV.P': 'SZÓR.S', + STDEVPA: 'SZÓRÁSPA', 'STDEV.S': 'SZÓR.M', SUBSTITUTE: 'HELYETTE', SUBTOTAL: 'RÉSZÖSSZEG', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index f78e6383c6..ee07bf672e 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'RADQ', STDEVA: 'DEV.ST.VALORI', 'STDEV.P': 'DEV.ST.P', + STDEVPA: 'DEV.ST.POP.VALORI', 'STDEV.S': 'DEV.ST.C', SUBSTITUTE: 'SOSTITUISCI', SUBTOTAL: 'SUBTOTALE', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 1deeb6ba6c..24439824e8 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'ROT', STDEVA: 'STDAVVIKA', 'STDEV.P': 'STDAV.P', + STDEVPA: 'STDAVVIKPA', 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYTT.UT', SUBTOTAL: 'DELSUM', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 676ea3f53d..ddb4edb61f 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'WORTEL', STDEVA: 'STDEVA', 'STDEV.P': 'STDEV.P', + STDEVPA: 'STDEVPA', 'STDEV.S': 'STDEV.S', SUBSTITUTE: 'SUBSTITUEREN', SUBTOTAL: 'SUBTOTAAL', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index bf6d0e7d67..c41b742720 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'PIERWIASTEK', STDEVA: 'ODCH.STANDARDOWE.A', 'STDEV.P': 'ODCH.STAND.POPUL', + STDEVPA: 'ODCH.STANDARD.POPUL.A', 'STDEV.S': 'ODCH.STANDARD.PRÓBKI', SUBSTITUTE: 'PODSTAW', SUBTOTAL: 'SUMY.CZĘŚCIOWE', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 6285444d95..307383f428 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'RAIZ', STDEVA: 'DESVPADA', 'STDEV.P': 'DESVPAD.P', + STDEVPA: 'DESVPADPA', 'STDEV.S': 'DESVPAD.A', SUBSTITUTE: 'SUBSTITUIR', SUBTOTAL: 'SUBTOTAL', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index d33b5d1822..38dbf995d4 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'КОРЕНЬ', STDEVA: 'СТАНДОТКЛОНА', 'STDEV.P': 'СТАНДОТКЛОН.Г', + STDEVPA: 'СТАНДОТКЛОНПА', 'STDEV.S': 'СТАНДОТКЛОН.В', SUBSTITUTE: 'ПОДСТАВИТЬ', SUBTOTAL: 'ПРОМЕЖУТОЧНЫЕ.ИТОГИ', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 56de08432c..fd5c2fc97d 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'ROT', STDEVA: 'STDEVA', 'STDEV.P': 'STDAV.P', + STDEVPA: 'STDEVPA', 'STDEV.S': 'STDAV.S', SUBSTITUTE: 'BYT.UT', SUBTOTAL: 'DELSUMMA', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index e660d8bd55..a5292df964 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -180,6 +180,7 @@ const dictionary: RawTranslationPackage = { SQRT: 'KAREKÖK', STDEVA: 'STDSAPMAA', 'STDEV.P': 'STDSAPMA.P', + STDEVPA: 'STDSAPMASA', 'STDEV.S': 'STDSAPMA.S', SUBSTITUTE: 'YERİNEKOY', SUBTOTAL: 'ALTTOPLAM SUMY.CZĘŚCIOWE', From 6dc222a59b83ecbc76ff14fed4c8cdd8c776a54a Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 12:52:04 +0200 Subject: [PATCH 16/40] . --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index f08cc5438e..468c15e75c 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'VELKÁ', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'SVYHLEDAT', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index b31a6f687c..09b5faa59d 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'STORE.BOGSTAVER', + VARA: 'VARIANSV', 'VAR.P': 'VARIANS.P', 'VAR.S': 'VARIANS.S', VLOOKUP: 'LOPSLAG', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 81e4e5e2ff..10016cee6d 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNIZEICHEN', UNICODE: 'UNICODE', UPPER: 'GROSS', + VARA: 'VARIANZA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'SVERWEIS', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 4d897669d1..6b38721c36 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -208,6 +208,7 @@ export const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'MAYUSC', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'BUSCARV', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index 88e79a8b43..b1c06e7cbd 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODEMERKKI', UNICODE: 'UNICODE', UPPER: 'ISOT', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'PHAKU', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 44fc40b057..2c995adb3b 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICAR', UNICODE: 'UNICODE', UPPER: 'MAJUSCULE', + VARA: 'VARA', 'VAR.P': 'VAR.P.N', 'VAR.S': 'VAR.S', VLOOKUP: 'RECHERCHEV', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 5fed3fb01b..3d24cd79e3 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNIKARAKTER', UNICODE: 'UNICODE', UPPER: 'NAGYBETŰS', + VARA: 'VARA', 'VAR.P': 'VAR.S', 'VAR.S': 'VAR.M', VLOOKUP: 'FKERES', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index ee07bf672e..9fcbb49461 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'CARATT.UNI', UNICODE: 'UNICODE', UPPER: 'MAIUSC', + VARA: 'VAR.VALORI', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.C', VLOOKUP: 'CERCA.VERT', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index 24439824e8..fc9e0d12bf 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODETEGN', UNICODE: 'UNICODE', UPPER: 'STORE', + VARA: 'VARIANSA', 'VAR.P': 'VARIANS.P', 'VAR.S': 'VARIANS.S', VLOOKUP: 'FINN.RAD', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index ddb4edb61f..33a91dd36c 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNITEKEN', UNICODE: 'UNICODE', UPPER: 'HOOFDLETTERS', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'VERT.ZOEKEN', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index c41b742720..c41332694b 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'ZNAK.UNICODE', UNICODE: 'UNICODE', UPPER: 'LITERY.WIELKIE', + VARA: 'WARIANCJA.A', 'VAR.P': 'WARIANCJA.POP', 'VAR.S': 'WARIANCJA.PRÓBKI', VLOOKUP: 'WYSZUKAJ.PIONOWO', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 307383f428..ace14e624c 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'CARACTUNI', UNICODE: 'UNICODE', UPPER: 'MAIÚSCULA', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.A', VLOOKUP: 'PROCV', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index 38dbf995d4..b29aa57a10 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'ЮНИСИМВ', UNICODE: 'UNICODE', UPPER: 'ПРОПИСН', + VARA: 'ДИСПА', 'VAR.P': 'ДИСП.Г', 'VAR.S': 'ДИСП.В', VLOOKUP: 'ВПР', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index fd5c2fc97d..654b51987c 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICHAR', UNICODE: 'UNICODE', UPPER: 'VERSALER', + VARA: 'VARA', 'VAR.P': 'VARIANS.P', 'VAR.S': 'VARIANS.S', VLOOKUP: 'LETARAD', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index a5292df964..bad32de904 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -208,6 +208,7 @@ const dictionary: RawTranslationPackage = { UNICHAR: 'UNICODEKARAKTERİ', UNICODE: 'UNICODE', UPPER: 'BÜYÜKHARF', + VARA: 'VARA', 'VAR.P': 'VAR.P', 'VAR.S': 'VAR.S', VLOOKUP: 'DÜŞEYARA', From 04f53bbf9719fcbdb5c30eab084731816125f1ef Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 15:09:57 +0200 Subject: [PATCH 17/40] . --- src/i18n/languages/csCZ.ts | 1 + src/i18n/languages/daDK.ts | 1 + src/i18n/languages/deDE.ts | 1 + src/i18n/languages/esES.ts | 1 + src/i18n/languages/fiFI.ts | 1 + src/i18n/languages/frFR.ts | 1 + src/i18n/languages/huHU.ts | 1 + src/i18n/languages/itIT.ts | 1 + src/i18n/languages/nbNO.ts | 1 + src/i18n/languages/nlNL.ts | 1 + src/i18n/languages/plPL.ts | 1 + src/i18n/languages/ptPT.ts | 1 + src/i18n/languages/ruRU.ts | 1 + src/i18n/languages/svSE.ts | 1 + src/i18n/languages/trTR.ts | 1 + 15 files changed, 15 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 468c15e75c..ff8df8f4cb 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'VELKÁ', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'SVYHLEDAT', WEEKDAY: 'DENTÝDNE', diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index 09b5faa59d..71860a1c04 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'STORE.BOGSTAVER', VARA: 'VARIANSV', 'VAR.P': 'VARIANS.P', + VARPA: 'VARIANSPV', 'VAR.S': 'VARIANS.S', VLOOKUP: 'LOPSLAG', WEEKDAY: 'UGEDAG', diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index 10016cee6d..e712b43b54 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'GROSS', VARA: 'VARIANZA', 'VAR.P': 'VAR.P', + VARPA: 'VARIANZENA', 'VAR.S': 'VAR.S', VLOOKUP: 'SVERWEIS', WEEKDAY: 'WOCHENTAG', diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 6b38721c36..3214e1f25b 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -210,6 +210,7 @@ export const dictionary: RawTranslationPackage = { UPPER: 'MAYUSC', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'BUSCARV', WEEKDAY: 'DIASEM', diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index b1c06e7cbd..bba71b1fa4 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'ISOT', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'PHAKU', WEEKDAY: 'VIIKONPÄIVÄ', diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 2c995adb3b..d8d622a23e 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'MAJUSCULE', VARA: 'VARA', 'VAR.P': 'VAR.P.N', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'RECHERCHEV', WEEKDAY: 'JOURSEM', diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 3d24cd79e3..ea663d4610 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'NAGYBETŰS', VARA: 'VARA', 'VAR.P': 'VAR.S', + VARPA: 'VARPA', 'VAR.S': 'VAR.M', VLOOKUP: 'FKERES', WEEKDAY: 'HÉT.NAPJA', diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index 9fcbb49461..d56575eae1 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'MAIUSC', VARA: 'VAR.VALORI', 'VAR.P': 'VAR.P', + VARPA: 'VAR.POP.VALORI', 'VAR.S': 'VAR.C', VLOOKUP: 'CERCA.VERT', WEEKDAY: 'GIORNO.SETTIMANA', diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index fc9e0d12bf..fd190d2d78 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'STORE', VARA: 'VARIANSA', 'VAR.P': 'VARIANS.P', + VARPA: 'VARIANSPA', 'VAR.S': 'VARIANS.S', VLOOKUP: 'FINN.RAD', WEEKDAY: 'UKEDAG', diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 33a91dd36c..0fd6024d26 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'HOOFDLETTERS', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.S', VLOOKUP: 'VERT.ZOEKEN', WEEKDAY: 'WEEKDAG', diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index c41332694b..1ec8f1ff15 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'LITERY.WIELKIE', VARA: 'WARIANCJA.A', 'VAR.P': 'WARIANCJA.POP', + VARPA: 'WARIANCJA.POPUL.A', 'VAR.S': 'WARIANCJA.PRÓBKI', VLOOKUP: 'WYSZUKAJ.PIONOWO', WEEKDAY: 'DZIEŃ.TYG', diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index ace14e624c..0b67d3add7 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'MAIÚSCULA', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARPA', 'VAR.S': 'VAR.A', VLOOKUP: 'PROCV', WEEKDAY: 'DIA.DA.SEMANA', diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index b29aa57a10..506b92923d 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'ПРОПИСН', VARA: 'ДИСПА', 'VAR.P': 'ДИСП.Г', + VARPA: 'ДИСПРА', 'VAR.S': 'ДИСП.В', VLOOKUP: 'ВПР', WEEKDAY: 'ДЕНЬНЕД', diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 654b51987c..6cd09a2f1f 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'VERSALER', VARA: 'VARA', 'VAR.P': 'VARIANS.P', + VARPA: 'VARPA', 'VAR.S': 'VARIANS.S', VLOOKUP: 'LETARAD', WEEKDAY: 'VECKODAG', diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index bad32de904..5ccc3d4047 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -210,6 +210,7 @@ const dictionary: RawTranslationPackage = { UPPER: 'BÜYÜKHARF', VARA: 'VARA', 'VAR.P': 'VAR.P', + VARPA: 'VARSA', 'VAR.S': 'VAR.S', VLOOKUP: 'DÜŞEYARA', WEEKDAY: 'HAFTANINGÜNÜ', From 8590b38ee052ea8f536f4b17d6cc299aec096f27 Mon Sep 17 00:00:00 2001 From: izulin Date: Sun, 4 Oct 2020 15:18:58 +0200 Subject: [PATCH 18/40] docs --- CHANGELOG.md | 2 +- docs/guide/built-in-functions.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c9799046..2d3667eab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added 9 text functions EXACT, LOWER, UPPER, MID, T, SUBSTITUTE, REPLACE, UNICODE, UNICHAR. (#159) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) -- Added 4 statistical functions VAR.P, VAR.S, STDEV.P, STDEV.S. +- Added 8 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA. - Added 1 mathemtical function SUBTOTAL. ### Fixed diff --git a/docs/guide/built-in-functions.md b/docs/guide/built-in-functions.md index 7225fc53ab..54aec62cd1 100644 --- a/docs/guide/built-in-functions.md +++ b/docs/guide/built-in-functions.md @@ -229,9 +229,13 @@ lets you design your own [custom functions](custom-functions). | MEDIAN | Statistical | Returns the median of a set of numbers. | MEDIAN(Number1; Number2; ...Number30) | | MIN | Statistical | Returns the minimum value in a list of arguments. | MIN(Number1; Number2; ...Number30) | | MINA | Statistical | Returns the minimum value in a list of arguments. | MINA(Value1; Value2; ... Value30) | +| STDEVA | Statistical | Returns standard deviation of a sample. | STDEVA(Value1; Value2; ... Value30) | | STDEV.P | Statistical | Returns standard deviation of a population. | STDEV.P(Value1; Value2; ... Value30) | +| STDEVPA | Statistical | Returns standard deviation of a population. | STDEVPA(Value1; Value2; ... Value30) | | STDEV.S | Statistical | Returns standard deviation of a sample. | STDEV.S(Value1; Value2; ... Value30) | +| VARA | Statistical | Returns variance of a sample. | VARA(Value1; Value2; ... Value30) | | VAR.P | Statistical | Returns variance of a population. | VAR.P(Value1; Value2; ... Value30) | +| VARPA | Statistical | Returns variance of a population. | VARPA(Value1; Value2; ... Value30) | | VAR.S | Statistical | Returns variance of a sample. | VAR.S(Value1; Value2; ... Value30) | | CHAR | Text | Converts a number into a character according to the current code table. | CHAR(Number) | | CLEAN
| Text | Returns text that has been "cleaned" of line breaks and other non-printable characters. | CLEAN("Text") | From 8ed9107491e7c522078af43cb7486a071552e000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Sun, 4 Oct 2020 15:34:40 +0200 Subject: [PATCH 19/40] Update CHANGELOG.md Co-authored-by: Jakub Kowalski --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70690cdf09..d71ecf32b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added 5 datetime functions: INTERVAL, NETWORKDAYS, NETWORKDAYS.INTL, WORKDAY, WORKDAY.INTL. (#153) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) - Added 8 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA. -- Added 1 mathemtical function SUBTOTAL. +- Added 1 mathematical function SUBTOTAL. ### Fixed - Fixed multiple issues with VLOOKUP function. (#526, #528) From c722b941480754144a6bde1f8db274659c21c396 Mon Sep 17 00:00:00 2001 From: Jakub Kowalski Date: Sun, 4 Oct 2020 15:39:55 +0200 Subject: [PATCH 20/40] Remove TODO --- src/interpreter/plugin/NumericAggregationPlugin.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index b979498fc4..bcb57b918d 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -288,7 +288,6 @@ export class NumericAggregationPlugin extends FunctionPlugin { if (ast.args.length < 1) { return new CellError(ErrorType.NA, ErrorMessage.WrongArgNumber) } - /* TODO use runFunction and pass tail? */ const functionType = this.coerceToType(this.evaluateAst(ast.args[0], formulaAddress), {argumentType: ArgumentTypes.NUMBER}) const args = ast.args.slice(1) switch (functionType) { From c236f1344cf58b9ba2037487373c8a1f770ed15a Mon Sep 17 00:00:00 2001 From: izulin Date: Tue, 6 Oct 2020 11:50:57 +0200 Subject: [PATCH 21/40] docs --- CHANGELOG.md | 2 +- docs/guide/built-in-functions.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d71ecf32b6..b0343ee21a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added 5 datetime functions: INTERVAL, NETWORKDAYS, NETWORKDAYS.INTL, WORKDAY, WORKDAY.INTL. (#153) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) - Added 8 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA. -- Added 1 mathematical function SUBTOTAL. +- Added 2 mathematical function SUBTOTAL, PRODUCT. ### Fixed - Fixed multiple issues with VLOOKUP function. (#526, #528) diff --git a/docs/guide/built-in-functions.md b/docs/guide/built-in-functions.md index a3bfc056ea..3be5b50461 100644 --- a/docs/guide/built-in-functions.md +++ b/docs/guide/built-in-functions.md @@ -197,6 +197,7 @@ lets you design your own [custom functions](custom-functions). | ODD | Math and trigonometry | Rounds a positive number up to the nearest odd integer and a negative number down to the nearest odd integer. | ODD(Number) | | PI | Math and trigonometry | Returns 3.14159265358979, the value of the mathematical constant PI to 14 decimal places. | PI() | | POWER | Math and trigonometry | Returns a number raised to another number. | POWER(Base; Exponent) | +| PRODUCT | Math and trigonometry | Returns product of numbers. | PRODUCT(Number1; Number2; ...; Number30) | | RADIANS | Math and trigonometry | Converts degrees to radians. | RADIANS(Number) | | RAND | Math and trigonometry | Returns a random number between 0 and 1. | RAND() | | ROUND | Math and trigonometry | Rounds a number to a certain number of decimal places. | ROUND(Number; Count) | From 2aa303341769bd75fb40bec29b351c4c2745644d Mon Sep 17 00:00:00 2001 From: izulin Date: Tue, 6 Oct 2020 12:38:39 +0200 Subject: [PATCH 22/40] tests --- test/interpreter/function-stdeva.spec.ts | 4 ++-- test/interpreter/function-stdevp.spec.ts | 4 ++-- test/interpreter/function-stdevpa.spec.ts | 4 ++-- test/interpreter/function-stdevs.spec.ts | 4 ++-- test/interpreter/function-subtotal.spec.ts | 13 +++++++++++++ test/interpreter/function-vara.spec.ts | 4 ++-- test/interpreter/function-varp.spec.ts | 4 ++-- test/interpreter/function-varpa.spec.ts | 4 ++-- test/interpreter/function-vars.spec.ts | 4 ++-- 9 files changed, 29 insertions(+), 16 deletions(-) diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts index 80adf13359..01e38b1efc 100644 --- a/test/interpreter/function-stdeva.spec.ts +++ b/test/interpreter/function-stdeva.spec.ts @@ -16,9 +16,9 @@ describe('Function STDEVA', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVA(2, 3)'], - ['=STDEVA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=STDEVA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.78885438199983, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.50639661750509, 6) }) }) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index 2557f065c6..1f52102095 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -14,9 +14,9 @@ describe('Function STDEV.P', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.P(2, 3)'], - ['=STDEV.P(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=STDEV.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(0.816496580927726, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.4142135623731, 6) }) }) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index d6a3565a56..5d92e0b0aa 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -14,9 +14,9 @@ describe('Function STDEVPA', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVPA(2, 3)'], - ['=STDEVPA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=STDEVPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.6, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.45160010235011, 6) }) }) diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts index 396c3c9d3b..b5261bfb09 100644 --- a/test/interpreter/function-stdevs.spec.ts +++ b/test/interpreter/function-stdevs.spec.ts @@ -16,9 +16,9 @@ describe('Function STDEV.S', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.S(2, 3)'], - ['=STDEV.S(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=STDEV.S(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toEqual(1) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.49071198499986, 6) }) }) diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index 1c015a8f54..fbb04232ae 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -158,4 +158,17 @@ describe('Function SUBTOTAL', () => { expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.VALUE, ErrorMessage.BadMode)) }) + + /** + * Inconsistency with ODFF standard. + */ + it('does not ignore other SUBTOTALS', () => { + const engine = HyperFormula.buildFromArray( [ + ['=SUBTOTAL(9, A2:A4)'], + ['=SUBTOTAL(9, B2:C2)', 1, 1], + ['=SUBTOTAL(9, B3:C3)', 1, 1], + ['=SUBTOTAL(9, B4:C4)', 1, 1], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(6) + }) }) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index 13de2cb518..5be588b587 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -16,9 +16,9 @@ describe('Function VARA', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VARA(2, 3)'], - ['=VARA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=VARA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toEqual(3.2) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.26923076923077) }) }) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 0d669d6129..6a9de7eea5 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -14,9 +14,9 @@ describe('Function VAR.P', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.P(2, 3)'], - ['=VAR.P(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=VAR.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2/3, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2, 6) }) }) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index fe3e616fba..95621d9fa4 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -14,9 +14,9 @@ describe('Function VARPA', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(2, 3)'], - ['=VARPA(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=VARPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toEqual(2.56) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.10714285714286, 6) }) }) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts index d14ba1253c..c81c431986 100644 --- a/test/interpreter/function-vars.spec.ts +++ b/test/interpreter/function-vars.spec.ts @@ -16,9 +16,9 @@ describe('Function VAR.S', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.S(2, 3)'], - ['=VAR.S(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=VAR.S(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toEqual(1) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.22222222222222, 6) }) }) From 172f8d05524fabb9e374c276ef318c5f39eed414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Tue, 6 Oct 2020 15:08:28 +0200 Subject: [PATCH 23/40] Update known-limitations.md --- docs/guide/known-limitations.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/guide/known-limitations.md b/docs/guide/known-limitations.md index 43c5b9c229..205fd6aff4 100644 --- a/docs/guide/known-limitations.md +++ b/docs/guide/known-limitations.md @@ -34,4 +34,5 @@ you can't compare the arguments in a formula like this: * Asynchronous functions * Structured references ("Tables") * Currency data type - * Relative named expressions \ No newline at end of file + * Relative named expressions +* Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL). From 60ad72104f47c7f1474e21bba2f85b042ef83b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 7 Oct 2020 23:01:10 +0200 Subject: [PATCH 24/40] Update docs/guide/known-limitations.md Co-authored-by: Bartek Dudek --- docs/guide/known-limitations.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/guide/known-limitations.md b/docs/guide/known-limitations.md index 205fd6aff4..e4de7a470f 100644 --- a/docs/guide/known-limitations.md +++ b/docs/guide/known-limitations.md @@ -35,4 +35,5 @@ you can't compare the arguments in a formula like this: * Structured references ("Tables") * Currency data type * Relative named expressions -* Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL). + * Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL). + * SUBTOTAL function does not ignore nested subtotals. From 18a77f993d0b62f8d61037515565077db1bfb974 Mon Sep 17 00:00:00 2001 From: izulin Date: Fri, 9 Oct 2020 12:33:11 +0200 Subject: [PATCH 25/40] small tests --- test/interpreter/function-stdevp.spec.ts | 2 ++ test/interpreter/function-stdevpa.spec.ts | 2 ++ test/interpreter/function-varp.spec.ts | 2 ++ test/interpreter/function-varpa.spec.ts | 2 ++ 4 files changed, 8 insertions(+) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index 1f52102095..d8ef3ae810 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -15,8 +15,10 @@ describe('Function STDEV.P', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.P(2, 3)'], ['=STDEV.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEV.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.4142135623731, 6) + expect(engine.getCellValue(adr('A3'))).toEqual(0) }) }) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index 5d92e0b0aa..3605cae5cc 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -15,8 +15,10 @@ describe('Function STDEVPA', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVPA(2, 3)'], ['=STDEVPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEVPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.45160010235011, 6) + expect(engine.getCellValue(adr('A3'))).toEqual(0) }) }) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 6a9de7eea5..20529d4000 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -15,8 +15,10 @@ describe('Function VAR.P', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.P(2, 3)'], ['=VAR.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VAR.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2, 6) + expect(engine.getCellValue(adr('A3'))).toEqual(0) }) }) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index 95621d9fa4..50b913f5cb 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -15,8 +15,10 @@ describe('Function VARPA', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(2, 3)'], ['=VARPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VARPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.10714285714286, 6) + expect(engine.getCellValue(adr('A3'))).toEqual(0) }) }) From 6b20777b533f9e0ea861739e148fb68ef3661daa Mon Sep 17 00:00:00 2001 From: izulin Date: Fri, 9 Oct 2020 14:34:55 +0200 Subject: [PATCH 26/40] tests --- test/interpreter/function-stdeva.spec.ts | 6 ++++-- test/interpreter/function-stdevp.spec.ts | 8 +++++--- test/interpreter/function-stdevpa.spec.ts | 8 +++++--- test/interpreter/function-stdevs.spec.ts | 6 ++++-- test/interpreter/function-vara.spec.ts | 6 ++++-- test/interpreter/function-varp.spec.ts | 8 +++++--- test/interpreter/function-varpa.spec.ts | 8 +++++--- test/interpreter/function-vars.spec.ts | 6 ++++-- 8 files changed, 36 insertions(+), 20 deletions(-) diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts index 01e38b1efc..7296d744a3 100644 --- a/test/interpreter/function-stdeva.spec.ts +++ b/test/interpreter/function-stdeva.spec.ts @@ -16,9 +16,11 @@ describe('Function STDEVA', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVA(2, 3)'], - ['=STDEVA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEVA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=STDEVA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.50639661750509, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.51185789203691, 6) + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1.61834718742537, 6) }) }) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index d8ef3ae810..3ebd713859 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -14,11 +14,13 @@ describe('Function STDEV.P', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.P(2, 3)'], - ['=STDEV.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=STDEV.P(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=STDEV.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.4142135623731, 6) - expect(engine.getCellValue(adr('A3'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(0.816496580927726, 6) + expect(engine.getCellValue(adr('A4'))).toEqual(0) }) }) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index 3605cae5cc..4ecc7d8666 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -14,11 +14,13 @@ describe('Function STDEVPA', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVPA(2, 3)'], - ['=STDEVPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEVPA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=STDEVPA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=STDEVPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.45160010235011, 6) - expect(engine.getCellValue(adr('A3'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.39970842444753, 6) + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1.49829835452879, 6) + expect(engine.getCellValue(adr('A4'))).toEqual(0) }) }) diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts index b5261bfb09..12cd2c1cbe 100644 --- a/test/interpreter/function-stdevs.spec.ts +++ b/test/interpreter/function-stdevs.spec.ts @@ -16,9 +16,11 @@ describe('Function STDEV.S', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.S(2, 3)'], - ['=STDEV.S(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=STDEV.S(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=STDEV.S(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.49071198499986, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.51185789203691, 6) //inconsistency with product #1 + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1, 6) }) }) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index 5be588b587..36bc4b9ab8 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -16,9 +16,11 @@ describe('Function VARA', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VARA(2, 3)'], - ['=VARA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VARA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=VARA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.26923076923077) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.28571428571429) + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(2.61904761904762) }) }) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 20529d4000..8566987bf9 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -14,11 +14,13 @@ describe('Function VAR.P', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.P(2, 3)'], - ['=VAR.P(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=VAR.P(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=VAR.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2, 6) - expect(engine.getCellValue(adr('A3'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(0.666666666666667, 6) + expect(engine.getCellValue(adr('A4'))).toEqual(0) }) }) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index 50b913f5cb..7b90cbdbf9 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -14,11 +14,13 @@ describe('Function VARPA', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(2, 3)'], - ['=VARPA(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VARPA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=VARPA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=VARPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.10714285714286, 6) - expect(engine.getCellValue(adr('A3'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.95918367346939, 6) + expect(engine.getCellValue(adr('A3'))).toBeCloseTo(2.24489795918367, 6) + expect(engine.getCellValue(adr('A4'))).toEqual(0) }) }) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts index c81c431986..45da4b64e9 100644 --- a/test/interpreter/function-vars.spec.ts +++ b/test/interpreter/function-vars.spec.ts @@ -16,9 +16,11 @@ describe('Function VAR.S', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.S(2, 3)'], - ['=VAR.S(B2:I2, 2, 3, 4, TRUE(), FALSE(), "1",)', 2, 3, 4, true, false, 'a', '\'1', null], + ['=VAR.S(2, 3, 4, TRUE(), FALSE(), "1",)'], + ['=VAR.S(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.22222222222222, 6) + expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.28571428571429, 6) //inconsistency with product #1 + expect(engine.getCellValue(adr('A3'))).toEqual(1) }) }) From 3a3727edb7b00ba16212c2debe066cf8871dc8b5 Mon Sep 17 00:00:00 2001 From: izulin Date: Fri, 9 Oct 2020 14:38:02 +0200 Subject: [PATCH 27/40] . --- test/interpreter/function-product.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/interpreter/function-product.spec.ts b/test/interpreter/function-product.spec.ts index f504a8a350..c76ad6794d 100644 --- a/test/interpreter/function-product.spec.ts +++ b/test/interpreter/function-product.spec.ts @@ -1,6 +1,6 @@ import {ErrorType, HyperFormula} from '../../src' -import {adr, detailedError} from '../testUtils' import {ErrorMessage} from '../../src/error-message' +import {adr, detailedError} from '../testUtils' describe('Function PRODUCT', () => { it('should take at least one argument', () => { @@ -15,8 +15,10 @@ describe('Function PRODUCT', () => { const engine = HyperFormula.buildFromArray([ ['=PRODUCT(2, 3)'], ['=PRODUCT(B2:D2, E2, F2)', 2, 3, 'foo', 'bar', 4], + ['=PRODUCT(5, "foo")'] ]) expect(engine.getCellValue(adr('A1'))).toEqual(6) expect(engine.getCellValue(adr('A2'))).toEqual(24) + expect(engine.getCellValue(adr('A3'))).toEqual(detailedError(ErrorType.VALUE,ErrorMessage.NumberCoercion)) }) }) From 4403788dfe65e9e7585ccb322b517ec5c34f40b2 Mon Sep 17 00:00:00 2001 From: izulin Date: Fri, 9 Oct 2020 17:22:21 +0200 Subject: [PATCH 28/40] linter --- test/interpreter/function-product.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interpreter/function-product.spec.ts b/test/interpreter/function-product.spec.ts index c76ad6794d..117f23d41b 100644 --- a/test/interpreter/function-product.spec.ts +++ b/test/interpreter/function-product.spec.ts @@ -19,6 +19,6 @@ describe('Function PRODUCT', () => { ]) expect(engine.getCellValue(adr('A1'))).toEqual(6) expect(engine.getCellValue(adr('A2'))).toEqual(24) - expect(engine.getCellValue(adr('A3'))).toEqual(detailedError(ErrorType.VALUE,ErrorMessage.NumberCoercion)) + expect(engine.getCellValue(adr('A3'))).toEqual(detailedError(ErrorType.VALUE, ErrorMessage.NumberCoercion)) }) }) From 1b9468edf4b4cc07cba25d642ae898520ecbd4b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:39:33 +0200 Subject: [PATCH 29/40] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0343ee21a..6e96331550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added 5 datetime functions: INTERVAL, NETWORKDAYS, NETWORKDAYS.INTL, WORKDAY, WORKDAY.INTL. (#153) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) - Added 8 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA. -- Added 2 mathematical function SUBTOTAL, PRODUCT. +- Added 2 mathematical functions SUBTOTAL, PRODUCT. ### Fixed - Fixed multiple issues with VLOOKUP function. (#526, #528) From 933ba3eb44b91d1d69aaf97b4ab4b649fe5108fd Mon Sep 17 00:00:00 2001 From: izulin Date: Mon, 12 Oct 2020 21:00:51 +0200 Subject: [PATCH 30/40] merge --- test/interpreter/function-product.spec.ts | 4 ++-- test/interpreter/function-stdeva.spec.ts | 4 ++-- test/interpreter/function-stdevp.spec.ts | 2 +- test/interpreter/function-stdevpa.spec.ts | 2 +- test/interpreter/function-stdevs.spec.ts | 4 ++-- test/interpreter/function-subtotal.spec.ts | 2 +- test/interpreter/function-vara.spec.ts | 4 ++-- test/interpreter/function-varp.spec.ts | 2 +- test/interpreter/function-varpa.spec.ts | 2 +- test/interpreter/function-vars.spec.ts | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/interpreter/function-product.spec.ts b/test/interpreter/function-product.spec.ts index 117f23d41b..f405dc4ad1 100644 --- a/test/interpreter/function-product.spec.ts +++ b/test/interpreter/function-product.spec.ts @@ -8,7 +8,7 @@ describe('Function PRODUCT', () => { ['=PRODUCT()'] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) }) it('should calculate product', () => { @@ -19,6 +19,6 @@ describe('Function PRODUCT', () => { ]) expect(engine.getCellValue(adr('A1'))).toEqual(6) expect(engine.getCellValue(adr('A2'))).toEqual(24) - expect(engine.getCellValue(adr('A3'))).toEqual(detailedError(ErrorType.VALUE, ErrorMessage.NumberCoercion)) + expect(engine.getCellValue(adr('A3'))).toEqualError(detailedError(ErrorType.VALUE, ErrorMessage.NumberCoercion)) }) }) diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts index 7296d744a3..720c8721b9 100644 --- a/test/interpreter/function-stdeva.spec.ts +++ b/test/interpreter/function-stdeva.spec.ts @@ -9,8 +9,8 @@ describe('Function STDEVA', () => { ['=STDEVA(1)'] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO)) }) it('should calculate standard deviation (sample)', () => { diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index 3ebd713859..9e1fcbae72 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -8,7 +8,7 @@ describe('Function STDEV.P', () => { ['=STDEV.P()'], ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) }) it('should calculate standard deviation (population)', () => { diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index 4ecc7d8666..937224229e 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -8,7 +8,7 @@ describe('Function STDEVPA', () => { ['=STDEVPA()'], ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) }) it('should calculate standard deviation (population)', () => { diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts index 12cd2c1cbe..f1b6b80c8a 100644 --- a/test/interpreter/function-stdevs.spec.ts +++ b/test/interpreter/function-stdevs.spec.ts @@ -9,8 +9,8 @@ describe('Function STDEV.S', () => { ['=STDEV.S(1)'] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO)) }) it('should calculate standard deviation (sample)', () => { diff --git a/test/interpreter/function-subtotal.spec.ts b/test/interpreter/function-subtotal.spec.ts index fbb04232ae..609e99f5b8 100644 --- a/test/interpreter/function-subtotal.spec.ts +++ b/test/interpreter/function-subtotal.spec.ts @@ -156,7 +156,7 @@ describe('Function SUBTOTAL', () => { [4] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.VALUE, ErrorMessage.BadMode)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.VALUE, ErrorMessage.BadMode)) }) /** diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index 36bc4b9ab8..c5b1483924 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -9,8 +9,8 @@ describe('Function VARA', () => { ['=VARA(1)'] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO)) }) it('should calculate variance (sample)', () => { diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 8566987bf9..57b2faf628 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -8,7 +8,7 @@ describe('Function VAR.P', () => { ['=VAR.P()'], ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) }) it('should calculate variance (population)', () => { diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index 7b90cbdbf9..e49b898701 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -8,7 +8,7 @@ describe('Function VARPA', () => { ['=VARPA()'], ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) }) it('should calculate variance (population)', () => { diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts index 45da4b64e9..8f6271fbbf 100644 --- a/test/interpreter/function-vars.spec.ts +++ b/test/interpreter/function-vars.spec.ts @@ -9,8 +9,8 @@ describe('Function VAR.S', () => { ['=VAR.S(1)'] ]) - expect(engine.getCellValue(adr('A1'))).toEqual(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - expect(engine.getCellValue(adr('A2'))).toEqual(detailedError(ErrorType.DIV_BY_ZERO)) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.DIV_BY_ZERO)) }) it('should calculate variance (sample)', () => { From 569a152092bedd58cc16046e85e13be5ae31e6df Mon Sep 17 00:00:00 2001 From: izulin Date: Wed, 14 Oct 2020 19:41:55 +0200 Subject: [PATCH 31/40] tests descriptions --- test/interpreter/function-stdeva.spec.ts | 25 +++++++++++++++++---- test/interpreter/function-stdevp.spec.ts | 27 ++++++++++++++++++----- test/interpreter/function-stdevpa.spec.ts | 27 ++++++++++++++++++----- test/interpreter/function-stdevs.spec.ts | 26 ++++++++++++++++++---- test/interpreter/function-vara.spec.ts | 25 +++++++++++++++++---- test/interpreter/function-varp.spec.ts | 27 ++++++++++++++++++----- test/interpreter/function-varpa.spec.ts | 27 ++++++++++++++++++----- test/interpreter/function-vars.spec.ts | 26 ++++++++++++++++++---- 8 files changed, 174 insertions(+), 36 deletions(-) diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts index 720c8721b9..accf1735c6 100644 --- a/test/interpreter/function-stdeva.spec.ts +++ b/test/interpreter/function-stdeva.spec.ts @@ -16,11 +16,28 @@ describe('Function STDEVA', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVA(2, 3)'], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.707106781186548) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ ['=STDEVA(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=STDEVA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.51185789203691, 6) - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1.61834718742537, 6) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691) + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.61834718742537) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index 9e1fcbae72..e4f084859b 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -14,13 +14,30 @@ describe('Function STDEV.P', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.P(2, 3)'], - ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=STDEV.P(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=STDEV.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(0.816496580927726, 6) - expect(engine.getCellValue(adr('A4'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.816496580927726, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index 937224229e..a4adf9cd33 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -14,13 +14,30 @@ describe('Function STDEVPA', () => { it('should calculate standard deviation (population)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVPA(2, 3)'], - ['=STDEVPA(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=STDEVPA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=STDEVPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.39970842444753, 6) - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1.49829835452879, 6) - expect(engine.getCellValue(adr('A4'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.49829835452879, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts index f1b6b80c8a..0da1b1f7c5 100644 --- a/test/interpreter/function-stdevs.spec.ts +++ b/test/interpreter/function-stdevs.spec.ts @@ -16,11 +16,29 @@ describe('Function STDEV.S', () => { it('should calculate standard deviation (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.S(2, 3)'], - ['=STDEV.S(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=STDEV.S(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.707106781186548, 6) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.51185789203691, 6) //inconsistency with product #1 - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(1, 6) + }) + + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.S(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(1) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.S(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index c5b1483924..f6882e3ea8 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -16,11 +16,28 @@ describe('Function VARA', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VARA(2, 3)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.5, 6) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ ['=VARA(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=VARA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) - expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.28571428571429) - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(2.61904761904762) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429) + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.61904761904762) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 57b2faf628..0f206928b5 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -14,13 +14,30 @@ describe('Function VAR.P', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.P(2, 3)'], - ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=VAR.P(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=VAR.P(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(0.666666666666667, 6) - expect(engine.getCellValue(adr('A4'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.666666666666667, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index e49b898701..01616522f9 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -14,13 +14,30 @@ describe('Function VARPA', () => { it('should calculate variance (population)', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(2, 3)'], - ['=VARPA(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=VARPA(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ['=VARPA(1)'], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.95918367346939, 6) - expect(engine.getCellValue(adr('A3'))).toBeCloseTo(2.24489795918367, 6) - expect(engine.getCellValue(adr('A4'))).toEqual(0) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARPA(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.24489795918367, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=VARPA(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts index 8f6271fbbf..91a478db5a 100644 --- a/test/interpreter/function-vars.spec.ts +++ b/test/interpreter/function-vars.spec.ts @@ -16,11 +16,29 @@ describe('Function VAR.S', () => { it('should calculate variance (sample)', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.S(2, 3)'], - ['=VAR.S(2, 3, 4, TRUE(), FALSE(), "1",)'], - ['=VAR.S(B3:I3)', 2, 3, 4, true, false, 'a', '\'1', null], ]) expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toBeCloseTo(2.28571428571429, 6) //inconsistency with product #1 - expect(engine.getCellValue(adr('A3'))).toEqual(1) + }) + + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.S(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(1) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.S(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) }) }) From 25e1a39c926248557c52e3ae6ea70c679acd4547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 14 Oct 2020 20:49:00 +0200 Subject: [PATCH 32/40] Update docs/guide/known-limitations.md Co-authored-by: Wojciech Czerniak --- docs/guide/known-limitations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/known-limitations.md b/docs/guide/known-limitations.md index e4de7a470f..5dc112c9c6 100644 --- a/docs/guide/known-limitations.md +++ b/docs/guide/known-limitations.md @@ -35,5 +35,5 @@ you can't compare the arguments in a formula like this: * Structured references ("Tables") * Currency data type * Relative named expressions - * Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL). - * SUBTOTAL function does not ignore nested subtotals. + * Functions cannot use UI metadata (e.g. hidden rows for SUBTOTAL). + * SUBTOTAL function does not ignore nested subtotals. From 1e141b2df7b9ea51c68aad52d8356c6e03746506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 14 Oct 2020 20:49:44 +0200 Subject: [PATCH 33/40] Update test/interpreter/function-varpa.spec.ts Co-authored-by: Wojciech Czerniak --- test/interpreter/function-varpa.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index 01616522f9..cafc34d7bc 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -27,7 +27,7 @@ describe('Function VARPA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) }) - it('should ignore non-numeric values in ranges', () => { + it('should evaluate TRUE to 1, FALSE to 0 and coerce text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) From 7adf5774bd68d00f91586a4ceb2e66042282e9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 14 Oct 2020 20:50:05 +0200 Subject: [PATCH 34/40] Update test/interpreter/function-varp.spec.ts Co-authored-by: Wojciech Czerniak --- test/interpreter/function-varp.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 0f206928b5..5d14c22f22 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -27,7 +27,7 @@ describe('Function VAR.P', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 }) - it('should ignore non-numeric values in ranges', () => { + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) From c882391b158e844cf969ff3db8c81c6f207a8924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 14 Oct 2020 20:50:55 +0200 Subject: [PATCH 35/40] Update test/interpreter/function-vars.spec.ts Co-authored-by: Wojciech Czerniak --- test/interpreter/function-vars.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-vars.spec.ts index 91a478db5a..a6ef8db9b6 100644 --- a/test/interpreter/function-vars.spec.ts +++ b/test/interpreter/function-vars.spec.ts @@ -28,7 +28,7 @@ describe('Function VAR.S', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429, 6) //inconsistency with product #1 }) - it('should ignore non-numeric values in ranges', () => { + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=VAR.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) From eeb69ceffd230944ac44cf80c8012fb07e5d5b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Uzna=C5=84ski?= <40573492+izulin@users.noreply.github.com> Date: Wed, 14 Oct 2020 20:51:23 +0200 Subject: [PATCH 36/40] Update test/interpreter/function-vara.spec.ts Co-authored-by: Wojciech Czerniak --- test/interpreter/function-vara.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index f6882e3ea8..4b6e038bfd 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -27,7 +27,7 @@ describe('Function VARA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429) }) - it('should ignore non-numeric values in ranges', () => { + it('should evaluate TRUE to 1, FALSE to 0 and coerce text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=VARA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) From faf1645cfa005774de8bb2803b65b876c6240dfa Mon Sep 17 00:00:00 2001 From: izulin Date: Wed, 14 Oct 2020 21:08:41 +0200 Subject: [PATCH 37/40] . --- test/interpreter/function-stdeva.spec.ts | 2 +- test/interpreter/function-stdevp.spec.ts | 2 +- test/interpreter/function-stdevpa.spec.ts | 10 +++++----- test/interpreter/function-stdevs.spec.ts | 2 +- test/interpreter/function-vara.spec.ts | 2 +- test/interpreter/function-varpa.spec.ts | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/interpreter/function-stdeva.spec.ts b/test/interpreter/function-stdeva.spec.ts index accf1735c6..fc4c518bb3 100644 --- a/test/interpreter/function-stdeva.spec.ts +++ b/test/interpreter/function-stdeva.spec.ts @@ -27,7 +27,7 @@ describe('Function STDEVA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691) }) - it('should ignore non-numeric values in ranges', () => { + it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => { const engine = HyperFormula.buildFromArray([ ['=STDEVA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index e4f084859b..84e5e78665 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -27,7 +27,7 @@ describe('Function STDEV.P', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 }) - it('should ignore non-numeric values in ranges', () => { + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) diff --git a/test/interpreter/function-stdevpa.spec.ts b/test/interpreter/function-stdevpa.spec.ts index a4adf9cd33..f08cc1fb16 100644 --- a/test/interpreter/function-stdevpa.spec.ts +++ b/test/interpreter/function-stdevpa.spec.ts @@ -27,11 +27,11 @@ describe('Function STDEVPA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) }) - it('should ignore non-numeric values in ranges', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEVPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], - ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.49829835452879, 6) + it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEVPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.49829835452879, 6) }) it('should propagate errors', () => { diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdevs.spec.ts index 0da1b1f7c5..6d9fd20137 100644 --- a/test/interpreter/function-stdevs.spec.ts +++ b/test/interpreter/function-stdevs.spec.ts @@ -28,7 +28,7 @@ describe('Function STDEV.S', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.51185789203691, 6) //inconsistency with product #1 }) - it('should ignore non-numeric values in ranges', () => { + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { const engine = HyperFormula.buildFromArray([ ['=STDEV.S(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) diff --git a/test/interpreter/function-vara.spec.ts b/test/interpreter/function-vara.spec.ts index 4b6e038bfd..5d655ae09c 100644 --- a/test/interpreter/function-vara.spec.ts +++ b/test/interpreter/function-vara.spec.ts @@ -27,7 +27,7 @@ describe('Function VARA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(2.28571428571429) }) - it('should evaluate TRUE to 1, FALSE to 0 and coerce text representation of numbers', () => { + it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => { const engine = HyperFormula.buildFromArray([ ['=VARA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) diff --git a/test/interpreter/function-varpa.spec.ts b/test/interpreter/function-varpa.spec.ts index cafc34d7bc..0b37691ad9 100644 --- a/test/interpreter/function-varpa.spec.ts +++ b/test/interpreter/function-varpa.spec.ts @@ -27,7 +27,7 @@ describe('Function VARPA', () => { expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) }) - it('should evaluate TRUE to 1, FALSE to 0 and coerce text representation of numbers', () => { + it('should evaluate TRUE to 1, FALSE to 0 and text to 0', () => { const engine = HyperFormula.buildFromArray([ ['=VARPA(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], ]) From 601f5b6c0d20b82bb00ecdd11876ee48350be250 Mon Sep 17 00:00:00 2001 From: izulin Date: Wed, 14 Oct 2020 21:36:49 +0200 Subject: [PATCH 38/40] aliases --- src/i18n/languages/csCZ.ts | 4 ++++ src/i18n/languages/daDK.ts | 4 ++++ src/i18n/languages/deDE.ts | 4 ++++ src/i18n/languages/enGB.ts | 4 ++++ src/i18n/languages/esES.ts | 4 ++++ src/i18n/languages/fiFI.ts | 4 ++++ src/i18n/languages/frFR.ts | 4 ++++ src/i18n/languages/huHU.ts | 4 ++++ src/i18n/languages/itIT.ts | 4 ++++ src/i18n/languages/nbNO.ts | 4 ++++ src/i18n/languages/nlNL.ts | 4 ++++ src/i18n/languages/plPL.ts | 4 ++++ src/i18n/languages/ptPT.ts | 4 ++++ src/i18n/languages/ruRU.ts | 4 ++++ src/i18n/languages/svSE.ts | 4 ++++ src/i18n/languages/trTR.ts | 4 ++++ src/interpreter/plugin/NumericAggregationPlugin.ts | 12 ++++++++++++ 17 files changed, 76 insertions(+) diff --git a/src/i18n/languages/csCZ.ts b/src/i18n/languages/csCZ.ts index 027864ff33..cb5387daa0 100644 --- a/src/i18n/languages/csCZ.ts +++ b/src/i18n/languages/csCZ.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR.VÝBĚR', + VARP: 'VAR', + STDEV: 'SMODCH.VÝBĚR', + STDEVP: 'SMODCH', }, langCode: 'csCZ', ui: { diff --git a/src/i18n/languages/daDK.ts b/src/i18n/languages/daDK.ts index e19b58c81a..26428f7dee 100644 --- a/src/i18n/languages/daDK.ts +++ b/src/i18n/languages/daDK.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VARIANS', + VARP: 'VARIANSP', + STDEV: 'STDAFV', + STDEVP: 'STDAFVP', }, langCode: 'daDK', ui: { diff --git a/src/i18n/languages/deDE.ts b/src/i18n/languages/deDE.ts index fb8da12d9f..17213f44fd 100644 --- a/src/i18n/languages/deDE.ts +++ b/src/i18n/languages/deDE.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VARIANZ', + VARP: 'VARIANZEN', + STDEV: 'STABW', + STDEVP: 'STABWN', }, langCode: 'deDE', ui: { diff --git a/src/i18n/languages/enGB.ts b/src/i18n/languages/enGB.ts index 0e7456130d..0a102fa429 100644 --- a/src/i18n/languages/enGB.ts +++ b/src/i18n/languages/enGB.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VARP: 'VARP', + VAR: 'VAR', + STDEVP: 'STDEVP', + STDEV: 'STDEV' }, langCode: 'enGB', ui: { diff --git a/src/i18n/languages/esES.ts b/src/i18n/languages/esES.ts index 15f43d3937..e7f8968934 100644 --- a/src/i18n/languages/esES.ts +++ b/src/i18n/languages/esES.ts @@ -238,6 +238,10 @@ export const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARP', + STDEV: 'DESVEST', + STDEVP: 'DESVESTP', }, langCode: 'esES', ui: { diff --git a/src/i18n/languages/fiFI.ts b/src/i18n/languages/fiFI.ts index c6d3b012aa..7999cfe9cd 100644 --- a/src/i18n/languages/fiFI.ts +++ b/src/i18n/languages/fiFI.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARP', + STDEV: 'KESKIHAJONTA', + STDEVP: 'KESKIHAJONTAP', }, langCode: 'fiFI', ui: { diff --git a/src/i18n/languages/frFR.ts b/src/i18n/languages/frFR.ts index 34721dcaf7..ae2f566d88 100644 --- a/src/i18n/languages/frFR.ts +++ b/src/i18n/languages/frFR.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VAR.P', + STDEV: 'ECARTYPE', + STDEVP: 'ECARTYPEP', }, langCode: 'frFR', ui: { diff --git a/src/i18n/languages/huHU.ts b/src/i18n/languages/huHU.ts index 23f26957e1..a964eb27b5 100644 --- a/src/i18n/languages/huHU.ts +++ b/src/i18n/languages/huHU.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARP', + STDEV: 'SZÓRÁS', + STDEVP: 'SZÓRÁSP', }, langCode: 'huHU', ui: { diff --git a/src/i18n/languages/itIT.ts b/src/i18n/languages/itIT.ts index c8a3a7adc4..e7e54a7227 100644 --- a/src/i18n/languages/itIT.ts +++ b/src/i18n/languages/itIT.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VAR.POP', + STDEV: 'DEV.ST', + STDEVP: 'DEV.ST.POP', }, langCode: 'itIT', ui: { diff --git a/src/i18n/languages/nbNO.ts b/src/i18n/languages/nbNO.ts index bbdb97a8d4..b720910e74 100644 --- a/src/i18n/languages/nbNO.ts +++ b/src/i18n/languages/nbNO.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VARIANS', + VARP: 'VARIANSP', + STDEV: 'STDAV', + STDEVP: 'STDAVP', }, langCode: 'nbNO', ui: { diff --git a/src/i18n/languages/nlNL.ts b/src/i18n/languages/nlNL.ts index 113b1f799f..f5f5260b18 100644 --- a/src/i18n/languages/nlNL.ts +++ b/src/i18n/languages/nlNL.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARP', + STDEV: 'STDEV', + STDEVP: 'STDEVP', }, langCode: 'nlNL', ui: { diff --git a/src/i18n/languages/plPL.ts b/src/i18n/languages/plPL.ts index 40813355ee..c36e4e405b 100644 --- a/src/i18n/languages/plPL.ts +++ b/src/i18n/languages/plPL.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'WARIANCJA', + VARP: 'WARIANCJA.POPUL', + STDEV: 'ODCH.STANDARDOWE', + STDEVP: 'ODCH.STANDARD.POPUL', }, langCode: 'plPL', ui: { diff --git a/src/i18n/languages/ptPT.ts b/src/i18n/languages/ptPT.ts index 922101dbc8..90634f5da0 100644 --- a/src/i18n/languages/ptPT.ts +++ b/src/i18n/languages/ptPT.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARP', + STDEV: 'DESVPAD', + STDEVP: 'DESVPADP', }, langCode: 'ptPT', ui: { diff --git a/src/i18n/languages/ruRU.ts b/src/i18n/languages/ruRU.ts index e6d81a070b..43947dc176 100644 --- a/src/i18n/languages/ruRU.ts +++ b/src/i18n/languages/ruRU.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'ДИСП', + VARP: 'ДИСПР', + STDEV: 'СТАНДОТКЛОН', + STDEVP: 'СТАНДОТКЛОНП', }, langCode: 'ruRU', ui: { diff --git a/src/i18n/languages/svSE.ts b/src/i18n/languages/svSE.ts index 0d1be29194..4509fc548f 100644 --- a/src/i18n/languages/svSE.ts +++ b/src/i18n/languages/svSE.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VARIANS', + VARP: 'VARIANSP', + STDEV: 'STDAV', + STDEVP: 'STDAVP', }, langCode: 'svSE', ui: { diff --git a/src/i18n/languages/trTR.ts b/src/i18n/languages/trTR.ts index d0e2ee7d3c..984acb100a 100644 --- a/src/i18n/languages/trTR.ts +++ b/src/i18n/languages/trTR.ts @@ -238,6 +238,10 @@ const dictionary: RawTranslationPackage = { 'HF.UMINUS': 'HF.UMINUS', 'HF.UNARY_PERCENT': 'HF.UNARY_PERCENT', 'HF.UPLUS': 'HF.UPLUS', + VAR: 'VAR', + VARP: 'VARS', + STDEV: 'STDSAPMA', + STDEVP: 'STDSAPMAS', }, langCode: 'trTR', ui: { diff --git a/src/interpreter/plugin/NumericAggregationPlugin.ts b/src/interpreter/plugin/NumericAggregationPlugin.ts index bcb57b918d..3a2abd0068 100644 --- a/src/interpreter/plugin/NumericAggregationPlugin.ts +++ b/src/interpreter/plugin/NumericAggregationPlugin.ts @@ -114,9 +114,15 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'VAR.S': { method: 'vars', }, + 'VAR': { + method: 'vars', //alias of VAR.S + }, 'VAR.P': { method: 'varp', }, + 'VARP': { + method: 'varp', //alias of VAR.P + }, 'VARA': { method: 'vara', }, @@ -126,9 +132,15 @@ export class NumericAggregationPlugin extends FunctionPlugin { 'STDEV.S': { method: 'stdevs', }, + 'STDEV': { + method: 'stdevs', //alias of STDEV.S + }, 'STDEV.P': { method: 'stdevp', }, + 'STDEVP': { + method: 'stdevp', //alias of STDEVP + }, 'STDEVA': { method: 'stdeva', }, From 9d3c779a208f82f2f30d90cd5d52475fd370ad9c Mon Sep 17 00:00:00 2001 From: izulin Date: Wed, 14 Oct 2020 21:41:58 +0200 Subject: [PATCH 39/40] docs --- CHANGELOG.md | 2 +- docs/guide/built-in-functions.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b398d82cbd..e66981e66c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added 9 text functions EXACT, LOWER, UPPER, MID, T, SUBSTITUTE, REPLACE, UNICODE, UNICHAR. (#159) - Added 5 datetime functions: INTERVAL, NETWORKDAYS, NETWORKDAYS.INTL, WORKDAY, WORKDAY.INTL. (#153) - Added 3 information functions HLOOKUP, ROW, COLUMN. (#158) -- Added 8 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA. +- Added 12 statistical functions VAR.P, VAR.S, VARA, VARPA, STDEV.P, STDEV.S, STDEVA, STDEVPA, VARP, VAR, STDEVP, STDEV. - Added 2 mathematical functions SUBTOTAL, PRODUCT. - Added 15 operator functions HF.ADD, HF.CONCAT, HF.DIVIDE, HF.EQ, HF.GT, HF.GTE, HF.LT, HF.LTE, HF.MINUS, HF.MULTIPLY, HF.NE, HF.POW, HF.UMINUS, HF.UNARY_PERCENT, HF.UPLUS. diff --git a/docs/guide/built-in-functions.md b/docs/guide/built-in-functions.md index 2720aecd51..c2cb4f9917 100644 --- a/docs/guide/built-in-functions.md +++ b/docs/guide/built-in-functions.md @@ -250,11 +250,15 @@ lets you design your own [custom functions](custom-functions). | MEDIAN | Statistical | Returns the median of a set of numbers. | MEDIAN(Number1; Number2; ...Number30) | | MIN | Statistical | Returns the minimum value in a list of arguments. | MIN(Number1; Number2; ...Number30) | | MINA | Statistical | Returns the minimum value in a list of arguments. | MINA(Value1; Value2; ... Value30) | +| STDEV | Statistical | Returns standard deviation of a sample. | STDEV(Value1; Value2; ... Value30) | | STDEVA | Statistical | Returns standard deviation of a sample. | STDEVA(Value1; Value2; ... Value30) | +| STDEVP | Statistical | Returns standard deviation of a population. | STDEVP(Value1; Value2; ... Value30) | | STDEV.P | Statistical | Returns standard deviation of a population. | STDEV.P(Value1; Value2; ... Value30) | | STDEVPA | Statistical | Returns standard deviation of a population. | STDEVPA(Value1; Value2; ... Value30) | | STDEV.S | Statistical | Returns standard deviation of a sample. | STDEV.S(Value1; Value2; ... Value30) | +| VAR | Statistical | Returns variance of a sample. | VAR(Value1; Value2; ... Value30) | | VARA | Statistical | Returns variance of a sample. | VARA(Value1; Value2; ... Value30) | +| VARP | Statistical | Returns variance of a population. | VARP(Value1; Value2; ... Value30) | | VAR.P | Statistical | Returns variance of a population. | VAR.P(Value1; Value2; ... Value30) | | VARPA | Statistical | Returns variance of a population. | VARPA(Value1; Value2; ... Value30) | | VAR.S | Statistical | Returns variance of a sample. | VAR.S(Value1; Value2; ... Value30) | From b271ea4ec82d233ce88c8fbb516537b7594eac0c Mon Sep 17 00:00:00 2001 From: izulin Date: Wed, 14 Oct 2020 22:12:24 +0200 Subject: [PATCH 40/40] tests for aliases --- test/interpreter/function-stdev.p.spec.ts | 43 ++++++++++++++++ ...tdevs.spec.ts => function-stdev.s.spec.ts} | 0 test/interpreter/function-stdev.spec.ts | 10 ++++ test/interpreter/function-stdevp.spec.ts | 49 +++---------------- test/interpreter/function-var.p.spec.ts | 43 ++++++++++++++++ ...on-vars.spec.ts => function-var.s.spec.ts} | 0 test/interpreter/function-var.spec.ts | 10 ++++ test/interpreter/function-varp.spec.ts | 49 +++---------------- 8 files changed, 122 insertions(+), 82 deletions(-) create mode 100644 test/interpreter/function-stdev.p.spec.ts rename test/interpreter/{function-stdevs.spec.ts => function-stdev.s.spec.ts} (100%) create mode 100644 test/interpreter/function-stdev.spec.ts create mode 100644 test/interpreter/function-var.p.spec.ts rename test/interpreter/{function-vars.spec.ts => function-var.s.spec.ts} (100%) create mode 100644 test/interpreter/function-var.spec.ts diff --git a/test/interpreter/function-stdev.p.spec.ts b/test/interpreter/function-stdev.p.spec.ts new file mode 100644 index 0000000000..84e5e78665 --- /dev/null +++ b/test/interpreter/function-stdev.p.spec.ts @@ -0,0 +1,43 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function STDEV.P', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate standard deviation (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(2, 3)'], + ['=STDEV.P(1)'], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.5) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.816496580927726, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=STDEV.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) + }) +}) diff --git a/test/interpreter/function-stdevs.spec.ts b/test/interpreter/function-stdev.s.spec.ts similarity index 100% rename from test/interpreter/function-stdevs.spec.ts rename to test/interpreter/function-stdev.s.spec.ts diff --git a/test/interpreter/function-stdev.spec.ts b/test/interpreter/function-stdev.spec.ts new file mode 100644 index 0000000000..eec40a9681 --- /dev/null +++ b/test/interpreter/function-stdev.spec.ts @@ -0,0 +1,10 @@ +import {HyperFormula} from '../../src' + +describe('Function STDEV', () => { + it('should be an alias of STDEV.S', () => { + const engine = HyperFormula.buildEmpty() + const metadata1 = engine.getFunctionPlugin('STDEV')?.implementedFunctions!['STDEV'] + const metadata2 = engine.getFunctionPlugin('STDEV.S')?.implementedFunctions!['STDEV.S'] + expect(metadata1).toEqual(metadata2) + }) +}) diff --git a/test/interpreter/function-stdevp.spec.ts b/test/interpreter/function-stdevp.spec.ts index 84e5e78665..0ddeb524f7 100644 --- a/test/interpreter/function-stdevp.spec.ts +++ b/test/interpreter/function-stdevp.spec.ts @@ -1,43 +1,10 @@ -import {ErrorType, HyperFormula} from '../../src' -import {adr, detailedError} from '../testUtils' -import {ErrorMessage} from '../../src/error-message' - -describe('Function STDEV.P', () => { - it('should take at least one argument', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEV.P()'], - ]) - - expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - }) - - it('should calculate standard deviation (population)', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEV.P(2, 3)'], - ['=STDEV.P(1)'], - ]) - expect(engine.getCellValue(adr('A1'))).toEqual(0.5) - expect(engine.getCellValue(adr('A2'))).toEqual(0) - }) - - it('should coerce explicit argument to numbers', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEV.P(2, 3, 4, TRUE(), FALSE(), "1",)'], - ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.39970842444753, 6) //inconsistency with product #1 - }) - - it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEV.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], - ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.816496580927726, 6) - }) - - it('should propagate errors', () => { - const engine = HyperFormula.buildFromArray([ - ['=STDEV.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], - ]) - expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) +import {HyperFormula} from '../../src' + +describe('Function STDEVP', () => { + it('should be an alias of STDEV.P', () => { + const engine = HyperFormula.buildEmpty() + const metadata1 = engine.getFunctionPlugin('STDEVP')?.implementedFunctions!['STDEVP'] + const metadata2 = engine.getFunctionPlugin('STDEV.P')?.implementedFunctions!['STDEV.P'] + expect(metadata1).toEqual(metadata2) }) }) diff --git a/test/interpreter/function-var.p.spec.ts b/test/interpreter/function-var.p.spec.ts new file mode 100644 index 0000000000..5d14c22f22 --- /dev/null +++ b/test/interpreter/function-var.p.spec.ts @@ -0,0 +1,43 @@ +import {ErrorType, HyperFormula} from '../../src' +import {adr, detailedError} from '../testUtils' +import {ErrorMessage} from '../../src/error-message' + +describe('Function VAR.P', () => { + it('should take at least one argument', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P()'], + ]) + + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) + }) + + it('should calculate variance (population)', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(2, 3)'], + ['=VAR.P(1)'], + ]) + expect(engine.getCellValue(adr('A1'))).toEqual(0.25) + expect(engine.getCellValue(adr('A2'))).toEqual(0) + }) + + it('should coerce explicit argument to numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 + }) + + it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.666666666666667, 6) + }) + + it('should propagate errors', () => { + const engine = HyperFormula.buildFromArray([ + ['=VAR.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], + ]) + expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) + }) +}) diff --git a/test/interpreter/function-vars.spec.ts b/test/interpreter/function-var.s.spec.ts similarity index 100% rename from test/interpreter/function-vars.spec.ts rename to test/interpreter/function-var.s.spec.ts diff --git a/test/interpreter/function-var.spec.ts b/test/interpreter/function-var.spec.ts new file mode 100644 index 0000000000..4b67c166a0 --- /dev/null +++ b/test/interpreter/function-var.spec.ts @@ -0,0 +1,10 @@ +import {HyperFormula} from '../../src' + +describe('Function VAR', () => { + it('should be an alias of VAR.S', () => { + const engine = HyperFormula.buildEmpty() + const metadata1 = engine.getFunctionPlugin('VAR')?.implementedFunctions!['VAR'] + const metadata2 = engine.getFunctionPlugin('VAR.S')?.implementedFunctions!['VAR.S'] + expect(metadata1).toEqual(metadata2) + }) +}) diff --git a/test/interpreter/function-varp.spec.ts b/test/interpreter/function-varp.spec.ts index 5d14c22f22..7ada3977e6 100644 --- a/test/interpreter/function-varp.spec.ts +++ b/test/interpreter/function-varp.spec.ts @@ -1,43 +1,10 @@ -import {ErrorType, HyperFormula} from '../../src' -import {adr, detailedError} from '../testUtils' -import {ErrorMessage} from '../../src/error-message' - -describe('Function VAR.P', () => { - it('should take at least one argument', () => { - const engine = HyperFormula.buildFromArray([ - ['=VAR.P()'], - ]) - - expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) - }) - - it('should calculate variance (population)', () => { - const engine = HyperFormula.buildFromArray([ - ['=VAR.P(2, 3)'], - ['=VAR.P(1)'], - ]) - expect(engine.getCellValue(adr('A1'))).toEqual(0.25) - expect(engine.getCellValue(adr('A2'))).toEqual(0) - }) - - it('should coerce explicit argument to numbers', () => { - const engine = HyperFormula.buildFromArray([ - ['=VAR.P(2, 3, 4, TRUE(), FALSE(), "1",)'], - ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(1.95918367346939, 6) //inconsistency with product #1 - }) - - it('should ignore non-numeric values in ranges, including ignoring logical values and text representation of numbers', () => { - const engine = HyperFormula.buildFromArray([ - ['=VAR.P(B1:I1)', 2, 3, 4, true, false, 'a', '\'1', null], - ]) - expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.666666666666667, 6) - }) - - it('should propagate errors', () => { - const engine = HyperFormula.buildFromArray([ - ['=VAR.P(B1:I1)', 2, 3, 4, '=NA()', false, 'a', '\'1', null], - ]) - expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA)) +import {HyperFormula} from '../../src' + +describe('Function VARP', () => { + it('should be an alias of VAR.P', () => { + const engine = HyperFormula.buildEmpty() + const metadata1 = engine.getFunctionPlugin('VARP')?.implementedFunctions!['VARP'] + const metadata2 = engine.getFunctionPlugin('VAR.P')?.implementedFunctions!['VAR.P'] + expect(metadata1).toEqual(metadata2) }) })