using System; using System.Collections.Generic; namespace UnityEngine.Assertions.Comparers { // Token: 0x02000494 RID: 1172 public class FloatComparer : IEqualityComparer { // Token: 0x06003AA1 RID: 15009 RVA: 0x0006738C File Offset: 0x0006558C public FloatComparer() : this(1E-05f, false) { } // Token: 0x06003AA2 RID: 15010 RVA: 0x0006739C File Offset: 0x0006559C public FloatComparer(bool relative) : this(1E-05f, relative) { } // Token: 0x06003AA3 RID: 15011 RVA: 0x000673AC File Offset: 0x000655AC public FloatComparer(float error) : this(error, false) { } // Token: 0x06003AA4 RID: 15012 RVA: 0x000673B8 File Offset: 0x000655B8 public FloatComparer(float error, bool relative) { this.m_Error = error; this.m_Relative = relative; } // Token: 0x06003AA5 RID: 15013 RVA: 0x000673D0 File Offset: 0x000655D0 public bool Equals(float a, float b) { return (!this.m_Relative) ? FloatComparer.AreEqual(a, b, this.m_Error) : FloatComparer.AreEqualRelative(a, b, this.m_Error); } // Token: 0x06003AA6 RID: 15014 RVA: 0x00067410 File Offset: 0x00065610 public int GetHashCode(float obj) { return base.GetHashCode(); } // Token: 0x06003AA7 RID: 15015 RVA: 0x0006742C File Offset: 0x0006562C public static bool AreEqual(float expected, float actual, float error) { return Math.Abs(actual - expected) <= error; } // Token: 0x06003AA8 RID: 15016 RVA: 0x00067450 File Offset: 0x00065650 public static bool AreEqualRelative(float expected, float actual, float error) { bool flag; if (expected == actual) { flag = true; } else { float num = Math.Abs(expected); float num2 = Math.Abs(actual); float num3 = Math.Abs((actual - expected) / ((num <= num2) ? num2 : num)); flag = num3 <= error; } return flag; } // Token: 0x040011B5 RID: 4533 private readonly float m_Error; // Token: 0x040011B6 RID: 4534 private readonly bool m_Relative; // Token: 0x040011B7 RID: 4535 public static readonly FloatComparer s_ComparerWithDefaultTolerance = new FloatComparer(1E-05f); // Token: 0x040011B8 RID: 4536 public const float kEpsilon = 1E-05f; } }