sparse strips: Fix erf calculation, fixing blurred rectangles with very small/zero blur#1422
Merged
Merged
Conversation
tomcur
commented
Feb 5, 2026
Member
Author
tomcur
left a comment
There was a problem hiding this comment.
First commit adds tests, second commit adds the fix. Note the tests fail in the first commit.
LaurenzV
approved these changes
Feb 5, 2026
Collaborator
LaurenzV
left a comment
There was a problem hiding this comment.
I don't think I have the maths knowledge to properly evaluate this, but since it fixes the issue LGTM. 👍
erf7 calculation, fixing blurred rectangles with very small/zero blurerf calculation, fixing blurred rectangles with very small/zero blur
1b18765 to
1d96223
Compare
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.
This fixes #1406.
The issue there is not incorrect blending, but rather that blurred rounded rectangles with a small or zero blur standard deviation cause calculations to overflow the max finite values an
f32can represent. This causes them to punch a transparent hole instead.Specifically, the issue is in our
erfcalculation. We can clamp the input without any loss of information:erf(x)quickly approaches 1 asxgrows (-1 for negative values), and aterf(10)the result is approximately 1 well within evenf64precision, let alonef32. Our implementation calculateserf(+/- 10)gracefully inf32.