Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RATE function misbehaves #905

Closed
mrfullset opened this issue Feb 15, 2022 · 4 comments · Fixed by #933
Closed

RATE function misbehaves #905

mrfullset opened this issue Feb 15, 2022 · 4 comments · Fixed by #933
Assignees
Labels
Bug Something isn't working Released

Comments

@mrfullset
Copy link

Description

RATE function misbehaves for some valid inputs.

Examples:

  • input: (300, -465.96, 100000), expected: ~0.25%, got: #NUM!
  • input: (200, -500, 200000), expected: ~-0.62%, got: #NUM!

Steps to reproduce

const hf = HyperFormula.buildFromArray([['=RATE(200, -500, 200000)']], { licenseKey: 'gpl-v3' });
console.log(hf.getCellValue({ col: 0, row: 0, sheet: 0 }));

Your environment

MB Pro 2016
macOS 12.2
node v14.17.4
npm v6.14.14

  • HyperFormula version: 13.3.1
  • Browser Name and version: Chrome 98.0.4758.80 x86_64
  • Operating System: macOS 12.2

Links

https://gist.github.com/kucukharf/677d8f21660efaa33f72 -- this algorithm works ok. maybe it's ok as a reference for you.

@mrfullset mrfullset added the Bug Something isn't working label Feb 15, 2022
@sequba sequba self-assigned this Feb 17, 2022
@sequba
Copy link
Contributor

sequba commented Mar 9, 2022

Hi @mrfullset-yolk!

I investigated your issue. In fact our algorithm is able to compute the correct values for these inputs. The problem is, it takes too many iterations. We'll see what we can do to make it converge faster.

https://gist.github.com/kucukharf/677d8f21660efaa33f72 -- this algorithm works ok. maybe it's ok as a reference for you.

How did you verify that kucukharf's implementation works correctly? Could you share your code? It might be helpful for us.

@mrfullset
Copy link
Author

mrfullset commented Mar 10, 2022

Hi @sequba,

I've verified that algorithm with provided examples in the issue. kucukharf's implementation returns correct values, which are the same with MS Excel. Currently I'm using his implementation in my project and it works ok.

The only code I had is also provided in the description. It was a usual React functional component with only those 2 rows inside.

@sequba
Copy link
Contributor

sequba commented Mar 10, 2022

Thanks. In the meantime I managed to fix our implementation and it will be included in the upcoming release of HF: #933

@AMBudnik
Copy link
Contributor

AMBudnik commented Apr 14, 2022

Hi @mrfullset-yolk I'm just here to share the good news. HyperFormula v2 is already online with @sequba 's fix for this issue.

Here #964 you can read more about the changes within that version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants