Should formulas support arg percentages with quotes?
Description
Here's the RRI function:
'RRI': {
method: 'rri',
parameters: [
{argumentType: ArgumentTypes.NUMBER, greaterThan: 0},
{argumentType: ArgumentTypes.NUMBER},
{argumentType: ArgumentTypes.NUMBER},
],
returnNumberType: NumberType.NUMBER_PERCENT
},
ArgumentTypes.NUMBER means percentages will not work such as =RRI("2%",3,1).
They should be ArgumentTypes.ANY. However runFunction will not work then as it doesn't parse percentages properly, so a custom one such as sum() does is needed I think.
it('should calculate the correct value with correct arguments and defaults', () => {
const [engine] = HyperFormula.buildFromArray([
['=RRI("1%", 2, 1)', '=RRI(2, 1, 2)', '=RRI(0.1, 2, 1)'],
['=RRI(1, -1, -1)', '=RRI(1, -1, 1)', '=RRI(1, 1, -1)'],
]);
expect(engine.getCellValue(adr('A1'))).toBeCloseTo(-1);
});
Fails.
I just realised I was doing this "1%" instead of 1%. I think this is quite a common behaviour for users to do quotes like this as I was doing.
Google Sheets, Libre Office & (I think) Excel support quotes of percentages in formulas. Perhaps HF should? Not sure. I'll leave this issue open for this reason.
If the issue could be changed to 'feature' instead
Thank you for a prompt update. The label is changed.