refactor: clean up Ema and EmaVector tests for consistency, update TValue equality check

This commit is contained in:
Miha Kralj
2025-11-29 17:30:20 -08:00
parent ce77bc9c85
commit 8f6142cfc0
6 changed files with 113 additions and 100 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ public readonly struct TValue : IEquatable<TValue>
public override string ToString() => $"[{AsDateTime:yyyy-MM-dd HH:mm:ss}, {Value:F2}]";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(TValue other) => Time == other.Time && Value == other.Value;
public bool Equals(TValue other) => Time == other.Time && Math.Abs(Value - other.Value) < 1e-9;
public override bool Equals(object? obj) => obj is TValue other && Equals(other);
public override int GetHashCode() => HashCode.Combine(Time, Value);