fix(ruler): round display mm on rotated labels to drop float noise#45
Merged
Conversation
When the ruler is reversed for 180°/270° rotated labels, computing `labelXxxMm - mm` reintroduces IEEE-754 artefacts (e.g. 100 - 30 = 70.00000000000001) on top of the already-rounded `mm`. The result rendered as tick labels with up to 12 trailing decimals. Re-round at the subtraction site, mirroring the existing rounding on the `mm` accumulator. `rulerLabel` stays a neutral formatter.
There was a problem hiding this comment.
Code Review
This pull request addresses floating-point precision issues in the Ruler component by rounding tick label values to three decimal places when the ruler is reversed. This prevents IEEE-754 artifacts from creating visual noise in the labels. The review feedback suggests duplicating the explanatory comment from the horizontal ruler implementation to the vertical ruler for better consistency and maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the ruler is reversed for 180°/270° rotated labels, computing
labelXxxMm - mmreintroduces IEEE-754 artefacts (e.g. 100 - 30 = 70.00000000000001) on top of the already-roundedmm. The result rendered as tick labels with up to 12 trailing decimals.Re-round at the subtraction site, mirroring the existing rounding on the
mmaccumulator.rulerLabelstays a neutral formatter.