1. 31 8月, 2020 7 次提交
    • C
      Improve the precision of lerpDouble (#20879) · 784e6d74
      Chris Bracken 提交于
      Reduces errors caused by the loss of floating point precision when the
      two extrema of the lerp differ significantly in magnitude. Previously,
      we used the calculation:
      
          a + (b - a) * t
      
      When the difference in magnitude between `a` and `b` exceeds the
      precision representable by double-precision floating point math, `b - a`
      results in the larger-magnitude value of `a` or `b`. The error between
      the value produced and the correct value is then scaled by t.
      
      A simple example of the impact can be seen when `a` is significantly
      larger in magnitude than `b`. In that case, `b - a` results in `a` and
      when `t` is 1.0, the resulting value is `a - (a) * 1.0 == 0`.
      
      The patch transforms the computation to the mathematically-equivalent
      expression:
      
          a * (1.0 - t) + b * t
      
      By scaling each value independently, the behaviour is more accurate.
      From the point of view of performance, this adds an extra
      multiplication, but multiplication is relatively cheap and the behaviour
      is significantly better.
      
      This patch also adds a `precisionErrorTolerance` constant to
      test_utils.dart and migrates existing tests to use `closeTo()` for
      testing.
      
      The tests themselves *do* currently use values that have an exact
      floating-point representation, but we should allow for flexibility in
      future implementation changes.
      784e6d74
    • F
      [web] Fix path clip crash when reused (#20846) · bada9fc5
      Ferhat 提交于
      bada9fc5
    • S
    • S
    • C
      lerpDouble: stricter handling of NaN and infinity (#20871) · dbc9b1a8
      Chris Bracken 提交于
      Previously, the behaviour of lerpDouble with respect to NaN and infinity
      was relatively complex and difficult to reason about. This patch
      simplifies the behaviour with respect to those conditions and adds
      documentation and tests.
      
      In general, if `a == b` or both values are null, infinite, or NaN, `a`
      is returned. Otherwise we require `a` and `b` and `t` to be finite or
      null and the result of the linear interpolation is returned.
      dbc9b1a8
    • C
      Extract Dart test utilities library (#20874) · 14ac65c9
      Chris Bracken 提交于
      This extracts a Dart test utilities library, containing
      `expectAssertion` and `expectArgumentError` functions that simplify
      running tests that test assertions across debug, profile, and release
      configurations.
      
      This change also restricts Dart unit tests to testing files whose
      filename matches `*_test.dart` under `flutter/testing/dart`; previously
      any file in that directory was run, but all files matched the above
      pattern.
      14ac65c9
    • S
  2. 30 8月, 2020 8 次提交
  3. 29 8月, 2020 15 次提交
  4. 28 8月, 2020 10 次提交