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

fix: format Decimal values for display in content evaluator #124

Conversation

developerfred
Copy link

  • Apply toFixed(2) to relevance and reward calculations to ensure consistent decimal place display.

Resolves #77

- Apply toFixed(2) to relevance and reward calculations to ensure consistent decimal place display.
Copy link
Member

@0x4007 0x4007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should only be once at the end. Which is the last time possible to set fixed?

@developerfred
Copy link
Author

Yes, we must define in the last element, if it is number or float, in this case I focussed only on the rewards

@gentlementlegen
Copy link
Member

gentlementlegen commented Sep 20, 2024

I don't think using fixed numbers is the solution, since we would lose precision on calculations. The result given showed that numbers have been used over decimals which induced a floating precision loss on division (in the example it is literally doing 54.6 / 1). The fix is to properly use decimals during these operations.

@developerfred
Copy link
Author

I don't think using fixed numbers is the solution, since we would lose precision on calculations. The result given showed that numbers have been used over decimals which induced a floating precision loss on division (in the example it is literally doing 54.6 / 1). The fix is to properly use decimals during these operations.

Thanks, I will use this solution.

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 this pull request may close these issues.

Decimal is not properly displayed
3 participants