Skip to content

Commit

Permalink
math helper
Browse files Browse the repository at this point in the history
  • Loading branch information
saint11 committed Jul 17, 2023
1 parent e1287e7 commit a7baf35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Murder/Utilities/Calculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections;
using System.Collections.Immutable;
using System.Diagnostics;

namespace Murder.Utilities
{
Expand Down Expand Up @@ -202,6 +203,10 @@ public static bool SameSignOrSimilar(float num1, float num2)
num1 > 0 && num2 > 0 || num1 < 0 && num2 < 0 ||
MathF.Abs(num1 - num2) < float.Epsilon;
}
public static bool AlmostEqual(float num1, float num2)
{
return Math.Abs(num1 - num2) <= float.Epsilon;
}

public static int WrapAround(int value, in int min, in int max)
{
Expand Down

0 comments on commit a7baf35

Please sign in to comment.