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

NaN is given as ratio when the previous value is 0 #204

Closed
miparnisari opened this issue Nov 30, 2023 · 2 comments · Fixed by #222
Closed

NaN is given as ratio when the previous value is 0 #204

miparnisari opened this issue Nov 30, 2023 · 2 comments · Fixed by #222

Comments

@miparnisari
Copy link
Contributor

miparnisari commented Nov 30, 2023

image

If a previous benchmark is 0, don't try to divide here

const ratio = biggerIsBetter(curSuite.tool)
? prev.value / current.value // e.g. current=100, prev=200
: current.value / prev.value;

or here

const ratio = biggerIsBetter(config.tool)
? previousBench.value / bench.value
: bench.value / previousBench.value;

or here

const ratio = biggerIsBetter(curSuite.tool)
? prev.value / current.value // e.g. current=100, prev=200
: current.value / prev.value; // e.g. current=200, prev=100

(Why are there three places doing a division? 😆 )

@ktrz
Copy link
Member

ktrz commented Jan 30, 2024

Hi @miparnisari

I've created a PR #222 to address this. I went for a solution that is not mathematically correct but I think it still gives good information IMO:

  • display 1 as ratio if both values are 0
  • display +∞ or -∞ if division results in Infinity or -Infinity (this happens in JS when the divisor is 0 but the dividend is non-0)

What do you think of this solution?

@ktrz
Copy link
Member

ktrz commented Feb 2, 2024

released in v1.19.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants