Fix bezier curve unit tests ocassionally failing #6240
Merged
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.
Summary
Reanimated unit test workflow occasionally got triggered due to math rounding errors.
example failed workflow: link
Test plan
Run the following code which uses values known to cause high-rounding-error bezier curve.
Create mathematical reflection of
curve1
:Cancel out both functions to get their identity + their error rate:
Measure error rate at
0.27
and0.31
points of thealmostIdentity
as these are known to have the over-limit values on this particular curve.Notice how these two values are higher than the previous limit of
0.01
.Which value is better?
Upon further testing of over 600000 cases, the highest value i encountered was
0.017
.It is likely it's impossible for this value to be higher than
0.02
due toBezier
implementation, thus I'm changing the precision limit to0.02