diff --git a/DotNetCampus.Numerics/FloatingPointNumberExtensions.cs b/DotNetCampus.Numerics/FloatingPointNumberExtensions.cs index 14f4645..23eca56 100644 --- a/DotNetCampus.Numerics/FloatingPointNumberExtensions.cs +++ b/DotNetCampus.Numerics/FloatingPointNumberExtensions.cs @@ -107,7 +107,7 @@ public static int RoundingHalfAwayFromZero(this float value) /// 五舍六入到整数。 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)); } /// @@ -117,7 +117,7 @@ public static int RoundingHalfToZero(this double value) /// 五舍六入到整数。 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)); } ///