linebender / linebender/parley
Account for floating point inaccuracies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 736
- Forks
- 120
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 53
Description
Currently, we calculate aggregated advances based on their component advances, such as line advances being a sum of run advances and inline box widths, and run advances being a sum of cluster advances. All of these advances, including the aggregates, are always `f32`, which means that inaccuracies may occur based on the order in which the component advances are being added. See [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1736f2cb6b11c7d9fa66e2597c3708c3) for an example of the problem.
This is generally not a problem since those inaccuracies are very small, but it does pose a problem for invariants such as `layout.width <= layout.max_content_width` as discovered in #259.
@tomcur offered a [suggestion](https://github.com/linebender/parley/pull/259#discussion_r1948915010) in #259, but I wanted to move discussion to a new issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Rust playground example linked in the issue, then read the discussion and suggestion in PR #259. Trace how component advances are aggregated and verify the chosen change preserves invariants such as layout.width <= layout.max_content_width across addition orders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100