Skip to content

fix(pie): prevent angle and percentage overflow with large numbers. close #21882 - #21883

Open
jeethgame wants to merge 1 commit into
apache:masterfrom
jeethgame:fix-pie-large-values-overflow
Open

jeethgame wants to merge 1 commit into
apache:masterfrom
jeethgame:fix-pie-large-values-overflow

Conversation

@jeethgame

Copy link
Copy Markdown

What does this PR do?

Fixes a floating-point overflow issue when pie chart values are very large finite numbers (e.g. \1e308).

Previously:

  1. In \getPercentSeats()\ (\src/util/number.ts), adding values whose sum exceeds \Number.MAX_VALUE\ produced \sum = Infinity. This caused \�otesPerQuota\ to be \

…lose apache#21882

- Scale values down by maximum value when their sum exceeds finite floating point limits in getPercentSeats and pieLayout.
- Ensures equal shares and accurate slice angles for extreme finite numbers without overflowing to Infinity or producing NaN angles.
- Add unit tests in number.test.ts for getPercentSeats with large numbers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant