diff --git a/X10D/src/DoubleExtensions/DoubleExtensions.cs b/X10D/src/DoubleExtensions/DoubleExtensions.cs index 62ded6f..a21b125 100644 --- a/X10D/src/DoubleExtensions/DoubleExtensions.cs +++ b/X10D/src/DoubleExtensions/DoubleExtensions.cs @@ -108,13 +108,23 @@ namespace X10D.DoubleExtensions return angle * (180.0 / Math.PI); } + /// + /// Rounds the current value to the nearest whole number. + /// + /// The value to round. + /// rounded to the nearest whole number. + public static double Round(this double value) + { + return value.Round(1.0); + } + /// /// Rounds the current value to the nearest multiple of a specified number. /// /// The value to round. /// The nearest multiple to which should be rounded. /// rounded to the nearest multiple of . - public static double Round(this double value, double nearest = 1) + public static double Round(this double value, double nearest) { return Math.Round(value / nearest) * nearest; } diff --git a/X10D/src/SingleExtensions/SingleExtensions.cs b/X10D/src/SingleExtensions/SingleExtensions.cs index 976726b..ddc5f61 100644 --- a/X10D/src/SingleExtensions/SingleExtensions.cs +++ b/X10D/src/SingleExtensions/SingleExtensions.cs @@ -109,13 +109,23 @@ namespace X10D.SingleExtensions return (float)((double)angle).RadiansToDegrees(); } + /// + /// Rounds the current value to the nearest whole number. + /// + /// The value to round. + /// rounded to the nearest whole number. + public static float Round(this float value) + { + return value.Round(1.0f); + } + /// /// Rounds the current value to the nearest multiple of a specified number. /// /// The value to round. /// The nearest multiple to which should be rounded. /// rounded to the nearest multiple of . - public static float Round(this float value, float nearest = 1) + public static float Round(this float value, float nearest) { return (float)((double)value).Round(nearest); }