handsontable / handsontable/hyperformula
Should formulas support arg percentages with quotes?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RRI function definition and its ArgumentTypes.NUMBER parameters, then trace runFunction and the custom sum() handling mentioned in the issue. Use the provided RRI test case as the regression test; done means quoted percentage arguments such as "2%" calculate correctly without breaking the existing numeric cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100