-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Match lerped values using moreOrLessEquals #64908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
An alternative is that we change some tests to use values with exact floating point representations, such as 0.25, 0.5 or other numbers that can be represented as sums of inverse powers of two, but that feels like a bit of an unfair constraint to place on test authors. Probably better to continue using the values we like, and continue migrating any cases we run into where we're doing exact equality checks on values that have been scaled/etc. that aren't using already using |
|
We normally use "moreOrLessEquals" which abstracts out the epsilon. |
Several of our tests make use of numbers without an exact floating point representation (frequently 0.x where x!=5) which, when scaled, also scale the error. The end result is that some of these tests currently implicitly rely on an implementation detail of floating point math and are sensitive to differences in the ~15th decimal place. This patch reduces the sensitivity of some of these tests, checking values up to the precisionErrorTolerance from the foundation layer rather than requiring en exact match.
|
TIL. Done! Also sent out #64914, which migrates other uses of |
Several of our tests make use of numbers without an exact floating point representation (frequently 0.x where x!=5) which, when scaled, also scale the error. The end result is that some of these tests currently implicitly rely on an implementation detail of floating point math and are sensitive to differences in the ~15th decimal place. This patch reduces the sensitivity of some of these tests, checking values using `moreOrLessEquals` from the flutter_test package rather than requiring en exact match.
Description
Several of our tests make use of numbers without an exact floating point representation (frequently 0.x where x!=5) which, when scaled, also scale the error. The end result is that some of these tests currently implicitly rely on an implementation detail of floating point math and are sensitive to differences in the ~15th decimal place.
This patch reduces the sensitivity of some of these tests, checking values up to the
precisionErrorTolerancefrom the foundation layer rather than requiring en exact match.Related patches
flutter/engine#20879 fixes a bug in
lerpDoublesuch that when thea,bendpoint parameters differ significantly in value, 0.0 is always returned rather than an intermediate value. As part of that patch, we change the implementation of the calculation to an algebraically-equivalent form which reduces the floating point error, but which produces small differences in the least-significant bits of the double representation, particularly when the arguments in the test have no exact floating-point representation (such as 0.2, 0.3, 0.6, 0.8 in several of these particular tests).