DoubleUtils.cs 473 B

12345678910111213141516
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. namespace Avalonia.Animation.Utils
  5. {
  6. internal static class DoubleUtils
  7. {
  8. internal static bool AboutEqual(double x, double y)
  9. {
  10. double epsilon = Math.Max(Math.Abs(x), Math.Abs(y)) * 1E-15;
  11. return Math.Abs(x - y) <= epsilon;
  12. }
  13. }
  14. }