Skip to content

Commit

Permalink
修复符号错误
Browse files Browse the repository at this point in the history
  • Loading branch information
SeWZC committed Jan 10, 2025
1 parent 73beb72 commit 82ec958
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DotNetCampus.Numerics/FloatingPointNumberExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static int RoundingHalfAwayFromZero(this float value)
/// <returns>五舍六入到整数。</returns>
public static int RoundingHalfToZero(this double value)
{
return (int)Math.Truncate(value + Math.CopySign(0.5, value));
return (int)Math.Truncate(value - Math.CopySign(0.5, value));
}

/// <summary>
Expand All @@ -117,7 +117,7 @@ public static int RoundingHalfToZero(this double value)
/// <returns>五舍六入到整数。</returns>
public static int RoundingHalfToZero(this float value)
{
return (int)MathF.Truncate(value + MathF.CopySign(0.5f, value));
return (int)MathF.Truncate(value - MathF.CopySign(0.5f, value));
}

/// <summary>
Expand Down

0 comments on commit 82ec958

Please sign in to comment.