diff --git a/src/libraries/System.Numerics.Vectors/tests/Util.cs b/src/libraries/System.Numerics.Vectors/tests/Util.cs index 74affb1bd52ab4..6c3e821c8ad393 100644 --- a/src/libraries/System.Numerics.Vectors/tests/Util.cs +++ b/src/libraries/System.Numerics.Vectors/tests/Util.cs @@ -91,62 +91,53 @@ public static T GenerateSingleValue(int min = 1, int max = 100) where T : str return value; } - [RequiresPreviewFeatures] public static T Abs(T value) where T : INumber { return T.Abs(value); } - [RequiresPreviewFeatures] + public static T Sqrt(T value) where T : struct, INumber { - double dValue = Create(value); + double dValue = CreateChecked(value); double dSqrt = Math.Sqrt(dValue); return T.CreateTruncating(dSqrt); } - [RequiresPreviewFeatures] - private static TSelf Create(TOther value) + private static TResult CreateChecked(TOther value) where TOther : INumber - where TSelf : INumber - => TSelf.Create(value); + where TResult : INumber + => TResult.CreateChecked(value); - [RequiresPreviewFeatures] public static T Multiply(T left, T right) where T : INumber { return left * right; } - [RequiresPreviewFeatures] public static T Divide(T left, T right) where T : INumber { return left / right; } - [RequiresPreviewFeatures] public static T Add(T left, T right) where T : INumber { return left + right; } - [RequiresPreviewFeatures] public static T Subtract(T left, T right) where T : INumber { return left - right; } - [RequiresPreviewFeatures] public static T Xor(T left, T right) where T : IBitwiseOperators { return left ^ right; } - [RequiresPreviewFeatures] public static T AndNot(T left, T right) where T : IBitwiseOperators { return left & ~ right; } - [RequiresPreviewFeatures] public static T OnesComplement(T left) where T : IBitwiseOperators { return ~left; @@ -157,43 +148,36 @@ public static float Clamp(float value, float min, float max) return value > max ? max : value < min ? min : value; } - [RequiresPreviewFeatures] public static T Zero() where T : struct, INumber { return T.Zero; } - [RequiresPreviewFeatures] public static T One() where T : struct, INumber { return T.One; } - [RequiresPreviewFeatures] public static bool GreaterThan(T left, T right) where T : INumber { return left > right; } - [RequiresPreviewFeatures] - public static bool GreaterThanOrEqual(T left, T right) where T : INumber - { + public static bool GreaterThanOrEqual(T left, T right) where T : INumber + { return left >= right; } - [RequiresPreviewFeatures] public static bool LessThan(T left, T right) where T : INumber { return left < right; } - [RequiresPreviewFeatures] public static bool LessThanOrEqual(T left, T right) where T : INumber { return left <= right; } - [RequiresPreviewFeatures] public static bool AnyEqual(T[] left, T[] right) where T : INumber { for (int g = 0; g < left.Length; g++) @@ -206,7 +190,6 @@ public static bool AnyEqual(T[] left, T[] right) where T : INumber return false; } - [RequiresPreviewFeatures] public static bool AllEqual(T[] left, T[] right) where T : INumber { for (int g = 0; g < left.Length; g++) diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 0b77ecb3fb0878..2eae0a6bd633fc 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -2373,26 +2373,38 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Private.CoreLib/src/System/Byte.cs b/src/libraries/System.Private.CoreLib/src/System/Byte.cs index 8af11674af2a5f..fc36841179c072 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Byte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Byte.cs @@ -32,16 +32,16 @@ public readonly struct Byte public const byte MinValue = 0; /// Represents the additive identity (0). - public const byte AdditiveIdentity = 0; + private const byte AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const byte MultiplicativeIdentity = 1; + private const byte MultiplicativeIdentity = 1; /// Represents the number one (1). - public const byte One = 1; + private const byte One = 1; /// Represents the number zero (0). - public const byte Zero = 0; + private const byte Zero = 0; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -314,6 +314,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right); + /// public static byte LeadingZeroCount(byte value) => (byte)(BitOperations.LeadingZeroCount(value) - 24); @@ -449,21 +452,18 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - /// - static byte INumber.One => One; - - /// - static byte INumber.Zero => Zero; - /// - public static byte Abs(byte value) => value; + static byte INumber.Abs(byte value) => value; /// public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max); - /// + /// + static byte INumber.CopySign(byte value, byte sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static byte Create(TOther value) + public static byte CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -685,17 +685,23 @@ public static byte CreateTruncating(TOther value) } } - /// - public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(byte value) => false; /// public static byte Max(byte x, byte y) => Math.Max(x, y); + /// + static byte INumber.MaxMagnitude(byte x, byte y) => Max(x, y); + /// public static byte Min(byte x, byte y) => Math.Min(x, y); + /// + static byte INumber.MinMagnitude(byte x, byte y) => Min(x, y); + /// - public static byte Sign(byte value) => (byte)((value == 0) ? 0 : 1); + public static int Sign(byte value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -885,10 +891,20 @@ public static bool TryCreate(TOther value, out byte result) } // - // IParseable + // INumberBase // - /// + /// + static byte INumberBase.One => One; + + /// + static byte INumberBase.Zero => Zero; + + // + // IParsable + // + + /// public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out byte result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -905,13 +921,13 @@ public static bool TryCreate(TOther value, out byte result) // static byte IShiftOperators.operator >>>(byte value, int shiftAmount) => (byte)(value >> shiftAmount); // - // ISpanParseable + // ISpanParsable // - /// + /// public static byte Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out byte result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -940,8 +956,5 @@ public static bool TryCreate(TOther value, out byte result) /// static byte IUnaryPlusOperators.operator +(byte value) => (byte)(+value); - - // /// - // static byte IUnaryPlusOperators.operator checked +(byte value) => checked((byte)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Char.cs b/src/libraries/System.Private.CoreLib/src/System/Char.cs index 117362d37759ed..06c575f509e95a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Char.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Char.cs @@ -1082,6 +1082,9 @@ public static int ConvertToUtf32(string s, int index) // IBinaryInteger // + /// + public static (char Quotient, char Remainder) DivRem(char left, char right) => ((char, char))Math.DivRem(left, right); + /// public static char LeadingZeroCount(char value) => (char)(BitOperations.LeadingZeroCount(value) - 16); @@ -1217,21 +1220,18 @@ public static int ConvertToUtf32(string s, int index) // INumber // - /// - static char INumber.One => (char)1; - - /// - static char INumber.Zero => (char)0; - /// - public static char Abs(char value) => value; + static char INumber.Abs(char value) => value; /// public static char Clamp(char value, char min, char max) => (char)Math.Clamp(value, min, max); - /// + /// + static char INumber.CopySign(char value, char sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static char Create(TOther value) + public static char CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -1450,17 +1450,23 @@ public static char CreateTruncating(TOther value) } } - /// - public static (char Quotient, char Remainder) DivRem(char left, char right) => ((char, char))Math.DivRem(left, right); + /// + static bool INumber.IsNegative(char value) => false; /// public static char Max(char x, char y) => (char)Math.Max(x, y); + /// + static char INumber.MaxMagnitude(char x, char y) => Max(x, y); + /// public static char Min(char x, char y) => (char)Math.Min(x, y); + /// + static char INumber.MinMagnitude(char x, char y) => Min(x, y); + /// - public static char Sign(char value) => (char)((value == 0) ? 0 : 1); + public static int Sign(char value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1666,12 +1672,22 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo } // - // IParseable + // INumberBase // - static char IParseable.Parse(string s, IFormatProvider? provider) => Parse(s); + /// + static char INumberBase.One => (char)1; - static bool IParseable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out char result) => TryParse(s, out result); + /// + static char INumberBase.Zero => (char)0; + + // + // IParsable + // + + static char IParsable.Parse(string s, IFormatProvider? provider) => Parse(s); + + static bool IParsable.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out char result) => TryParse(s, out result); // // IShiftOperators @@ -1687,10 +1703,10 @@ static bool INumber.TryParse(ReadOnlySpan s, NumberStyles style, IFo // static char IShiftOperators.operator >>>(char value, int shiftAmount) => (char)(value >> shiftAmount); // - // ISpanParseable + // ISpanParsable // - static char ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? provider) + static char ISpanParsable.Parse(ReadOnlySpan s, IFormatProvider? provider) { if (s.Length != 1) { @@ -1699,7 +1715,7 @@ static char ISpanParseable.Parse(ReadOnlySpan s, IFormatProvider? pr return s[0]; } - static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out char result) + static bool ISpanParsable.TryParse(ReadOnlySpan s, IFormatProvider? provider, out char result) { if (s.Length != 1) { @@ -1736,8 +1752,5 @@ static bool ISpanParseable.TryParse(ReadOnlySpan s, IFormatProvider? /// static char IUnaryPlusOperators.operator +(char value) => (char)(+value); - - // /// - // static byte IUnaryPlusOperators.operator checked +(byte value) => checked((char)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs b/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs index 4b492fb1bfe771..76cfb03311d796 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateOnly.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.Versioning; namespace System @@ -18,7 +19,7 @@ public readonly struct DateOnly ISpanFormattable, IComparisonOperators, IMinMaxValue, - ISpanParseable + ISpanParsable { private readonly int _dayNumber; @@ -834,23 +835,23 @@ public string ToString(string? format, IFormatProvider? provider) } // - // IParseable + // IParsable // - /// + /// public static DateOnly Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - /// + /// public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); // - // ISpanParseable + // ISpanParsable // - /// + /// public static DateOnly Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/DateTime.cs b/src/libraries/System.Private.CoreLib/src/System/DateTime.cs index c854be82fa5195..b3cc06c3725fae 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateTime.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateTime.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; @@ -55,7 +56,7 @@ public readonly partial struct DateTime IAdditiveIdentity, IComparisonOperators, IMinMaxValue, - ISpanParseable, + ISpanParsable, ISubtractionOperators, ISubtractionOperators { @@ -1518,7 +1519,7 @@ internal static bool TryCreate(int year, int month, int day, int hour, int minut // /// - public static TimeSpan AdditiveIdentity => default; + static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; // // IMinMaxValue @@ -1529,20 +1530,20 @@ internal static bool TryCreate(int year, int month, int day, int hour, int minut static DateTime IMinMaxValue.MaxValue => MaxValue; // - // IParseable + // IParsable // - /// + /// public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result); // - // ISpanParseable + // ISpanParsable // - /// + /// public static DateTime Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateTime result) => TryParse(s, provider, DateTimeStyles.None, out result); // diff --git a/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs b/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs index a560541ec1e10f..61c57ed07c9a19 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DateTimeOffset.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; @@ -44,7 +45,7 @@ public readonly struct DateTimeOffset IAdditiveIdentity, IComparisonOperators, IMinMaxValue, - ISpanParseable, + ISpanParsable, ISubtractionOperators, ISubtractionOperators { @@ -874,7 +875,7 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => // /// - public static TimeSpan AdditiveIdentity => default; + static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; // // IMinMaxValue @@ -885,20 +886,20 @@ public static implicit operator DateTimeOffset(DateTime dateTime) => static DateTimeOffset IMinMaxValue.MaxValue => MaxValue; // - // IParseable + // IParsable // - /// + /// public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out DateTimeOffset result) => TryParse(s, provider, DateTimeStyles.None, out result); // - // ISpanParseable + // ISpanParsable // - /// + /// public static DateTimeOffset Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out DateTimeOffset result) => TryParse(s, provider, DateTimeStyles.None, out result); // diff --git a/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs b/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs index 349c8fda8789ae..cde5b26719205b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs @@ -17,8 +17,6 @@ public partial struct Decimal internal uint Low => (uint)_lo64; internal uint Mid => (uint)(_lo64 >> 32); - internal bool IsNegative => _flags < 0; - private ulong Low64 => _lo64; private static ref DecCalc AsMutable(ref decimal d) => ref Unsafe.As(ref d); @@ -1877,7 +1875,7 @@ internal static double VarR8FromDec(in decimal value) double dbl = ((double)value.Low64 + (double)value.High * ds2to64) / s_doublePowers10[value.Scale]; - if (value.IsNegative) + if (decimal.IsNegative(value)) dbl = -dbl; return dbl; diff --git a/src/libraries/System.Private.CoreLib/src/System/Decimal.cs b/src/libraries/System.Private.CoreLib/src/System/Decimal.cs index f7e6f9d8b510ec..2589db83aed4da 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Decimal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Decimal.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; @@ -66,8 +67,8 @@ public readonly partial struct Decimal IEquatable, ISerializable, IDeserializationCallback, - IMinMaxValue, - ISignedNumber + IFloatingPoint, + IMinMaxValue { // Sign mask for the flags field. A value of zero in this bit indicates a // positive Decimal value, and a value of one in this bit indicates a @@ -103,13 +104,13 @@ public readonly partial struct Decimal public const decimal MinValue = -79228162514264337593543950335m; /// Represents the additive identity (0). - public const decimal AdditiveIdentity = 0m; + private const decimal AdditiveIdentity = 0m; /// Represents the multiplicative identity (1). - public const decimal MultiplicativeIdentity = 1m; + private const decimal MultiplicativeIdentity = 1m; /// Represents the number negative one (-1). - public const decimal NegativeOne = -1m; + private const decimal NegativeOne = -1m; // The lo, mid, hi, and flags fields contain the representation of the // Decimal value. The lo, mid, and hi fields contain the 96-bit integer @@ -664,8 +665,6 @@ private static decimal Round(ref decimal d, int decimals, MidpointRounding mode) return d; } - internal static int Sign(in decimal d) => (d.Low64 | d.High) == 0 ? 0 : (d._flags >> 31) | 1; - // Subtracts two Decimal values. // public static decimal Subtract(decimal d1, decimal d2) @@ -753,7 +752,7 @@ public static int ToInt32(decimal d) if ((d.High | d.Mid) == 0) { int i = (int)d.Low; - if (!d.IsNegative) + if (!IsNegative(d)) { if (i >= 0) return i; } @@ -776,7 +775,7 @@ public static long ToInt64(decimal d) if (d.High == 0) { long l = (long)d.Low64; - if (!d.IsNegative) + if (!IsNegative(d)) { if (l >= 0) return l; } @@ -821,7 +820,7 @@ public static uint ToUInt32(decimal d) if ((d.High| d.Mid) == 0) { uint i = d.Low; - if (!d.IsNegative || i == 0) + if (!IsNegative(d) || i == 0) return i; } throw new OverflowException(SR.Overflow_UInt32); @@ -838,7 +837,7 @@ public static ulong ToUInt64(decimal d) if (d.High == 0) { ulong l = d.Low64; - if (!d.IsNegative || l == 0) + if (!IsNegative(d) || l == 0) return l; } throw new OverflowException(SR.Overflow_UInt64); @@ -1142,21 +1141,24 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - /// - static decimal INumber.One => One; - - /// - static decimal INumber.Zero => Zero; - /// public static decimal Abs(decimal value) { return new decimal(in value, value._flags & ~SignMask); } - /// + /// + public static decimal Clamp(decimal value, decimal min, decimal max) => Math.Clamp(value, min, max); + + /// + public static decimal CopySign(decimal value, decimal sign) + { + return new decimal(in value, (value._flags & ~SignMask) | (sign._flags & SignMask)); + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static decimal Create(TOther value) + public static decimal CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -1358,11 +1360,8 @@ public static decimal CreateTruncating(TOther value) } } - /// - public static decimal Clamp(decimal value, decimal min, decimal max) => Math.Clamp(value, min, max); - - /// - public static (decimal Quotient, decimal Remainder) DivRem(decimal left, decimal right) => (left / right, left % right); + /// + public static bool IsNegative(decimal value) => value._flags < 0; /// public static decimal Max(decimal x, decimal y) @@ -1370,14 +1369,20 @@ public static decimal Max(decimal x, decimal y) return DecCalc.VarDecCmp(in x, in y) >= 0 ? x : y; } + /// + public static decimal MaxMagnitude(decimal x, decimal y) => (Abs(x) >= Abs(y)) ? x : y; + /// public static decimal Min(decimal x, decimal y) { return DecCalc.VarDecCmp(in x, in y) < 0 ? x : y; } + /// + public static decimal MinMagnitude(decimal x, decimal y) => (Abs(x) <= Abs(y)) ? x : y; + /// - static decimal INumber.Sign(decimal value) => Math.Sign(value); + public static int Sign(decimal d) => (d.Low64 | d.High) == 0 ? 0 : (d._flags >> 31) | 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1463,7 +1468,17 @@ public static bool TryCreate(TOther value, out decimal result) } // - // IParseable + // INumberBase + // + + /// + static decimal INumberBase.One => One; + + /// + static decimal INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out decimal result) => TryParse(s, NumberStyles.Number, provider, out result); @@ -1476,13 +1491,13 @@ public static bool TryCreate(TOther value, out decimal result) static decimal ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static decimal Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Number, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out decimal result) => TryParse(s, NumberStyles.Number, provider, out result); // @@ -1498,12 +1513,5 @@ public static bool TryCreate(TOther value, out decimal result) // /// // static decimal IUnaryNegationOperators.operator checked -(decimal value) => checked(-value); - - // - // IUnaryPlusOperators - // - - // /// - // static decimal IUnaryPlusOperators.operator checked +(decimal value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Double.cs b/src/libraries/System.Private.CoreLib/src/System/Double.cs index f605d61c514d83..62b7b8ff49ab73 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Double.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Double.cs @@ -13,6 +13,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -28,7 +29,7 @@ public readonly struct Double ISpanFormattable, IComparable, IEquatable, - IBinaryFloatingPoint, + IBinaryFloatingPointIeee754, IMinMaxValue { private readonly double m_value; // Do not rename (binary serialization) @@ -47,19 +48,19 @@ public readonly struct Double public const double NaN = (double)0.0 / (double)0.0; /// Represents the additive identity (0). - public const double AdditiveIdentity = 0.0; + private const double AdditiveIdentity = 0.0; /// Represents the multiplicative identity (1). - public const double MultiplicativeIdentity = 1.0; + private const double MultiplicativeIdentity = 1.0; /// Represents the number one (1). - public const double One = 1.0; + private const double One = 1.0; /// Represents the number zero (0). - public const double Zero = 0.0; + private const double Zero = 0.0; /// Represents the number negative one (-1). - public const double NegativeOne = -1.0; + private const double NegativeOne = -1.0; /// Represents the number negative zero (-0). public const double NegativeZero = -0.0; @@ -573,219 +574,140 @@ public static bool IsPow2(double value) // static double IDivisionOperators.operator checked /(double left, double right) => checked(left / right); // - // IFloatingPoint + // IExponentialFunctions // - /// - static double IFloatingPoint.E => Math.E; - - /// - static double IFloatingPoint.Epsilon => Epsilon; - - /// - static double IFloatingPoint.NaN => NaN; - - /// - static double IFloatingPoint.NegativeInfinity => NegativeInfinity; - - /// - static double IFloatingPoint.NegativeZero => NegativeZero; - - /// - static double IFloatingPoint.Pi => Pi; - - /// - static double IFloatingPoint.PositiveInfinity => PositiveInfinity; - - /// - static double IFloatingPoint.Tau => Tau; - - /// - public static double Acos(double x) => Math.Acos(x); - - /// - public static double Acosh(double x) => Math.Acosh(x); - - /// - public static double Asin(double x) => Math.Asin(x); - - /// - public static double Asinh(double x) => Math.Asinh(x); + /// + public static double Exp(double x) => Math.Exp(x); - /// - public static double Atan(double x) => Math.Atan(x); + // /// + // public static double ExpM1(double x) => Math.ExpM1(x); - /// - public static double Atan2(double y, double x) => Math.Atan2(y, x); + // /// + // public static double Exp2(double x) => Math.Exp2(x); - /// - public static double Atanh(double x) => Math.Atanh(x); + // /// + // public static double Exp2M1(double x) => Math.Exp2M1(x); - /// - public static double BitIncrement(double x) => Math.BitIncrement(x); + // /// + // public static double Exp10(double x) => Math.Exp10(x); - /// - public static double BitDecrement(double x) => Math.BitDecrement(x); + // /// + // public static double Exp10M1(double x) => Math.Exp10M1(x); - /// - public static double Cbrt(double x) => Math.Cbrt(x); + // + // IFloatingPoint + // /// public static double Ceiling(double x) => Math.Ceiling(x); - /// - public static double CopySign(double x, double y) => Math.CopySign(x, y); - - /// - public static double Cos(double x) => Math.Cos(x); - - /// - public static double Cosh(double x) => Math.Cosh(x); - - /// - public static double Exp(double x) => Math.Exp(x); - /// public static double Floor(double x) => Math.Floor(x); - /// - public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend); - - /// - public static double IEEERemainder(double left, double right) => Math.IEEERemainder(left, right); - - /// - public static TInteger ILogB(double x) - where TInteger : IBinaryInteger => TInteger.Create(Math.ILogB(x)); - - /// - public static double Log(double x) => Math.Log(x); - - /// - public static double Log(double x, double newBase) => Math.Log(x, newBase); - - /// - public static double Log10(double x) => Math.Log10(x); - - /// - public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y); - - /// - public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y); - - /// - public static double Pow(double x, double y) => Math.Pow(x, y); - - /// - public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x); - - /// - public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x); - /// public static double Round(double x) => Math.Round(x); - /// - public static double Round(double x, TInteger digits) - where TInteger : IBinaryInteger => Math.Round(x, int.Create(digits)); + /// + public static double Round(double x, int digits) => Math.Round(x, digits); /// public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode); - /// - public static double Round(double x, TInteger digits, MidpointRounding mode) - where TInteger : IBinaryInteger => Math.Round(x, int.Create(digits), mode); + /// + public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode); - /// - public static double ScaleB(double x, TInteger n) - where TInteger : IBinaryInteger => Math.ScaleB(x, int.Create(n)); + /// + public static double Truncate(double x) => Math.Truncate(x); - /// - public static double Sin(double x) => Math.Sin(x); + // + // IFloatingPointIeee754 + // - /// - public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x); + /// + static double IFloatingPointIeee754.E => Math.E; - /// - public static double Sinh(double x) => Math.Sinh(x); + /// + static double IFloatingPointIeee754.Epsilon => Epsilon; - /// - public static double Sqrt(double x) => Math.Sqrt(x); + /// + static double IFloatingPointIeee754.NaN => NaN; - /// - public static double Tan(double x) => Math.Tan(x); + /// + static double IFloatingPointIeee754.NegativeInfinity => NegativeInfinity; - /// - public static double Tanh(double x) => Math.Tanh(x); + /// + static double IFloatingPointIeee754.NegativeZero => NegativeZero; - /// - public static double Truncate(double x) => Math.Truncate(x); + /// + static double IFloatingPointIeee754.Pi => Pi; - // /// - // public static double AcosPi(double x) => Math.AcosPi(x); + /// + static double IFloatingPointIeee754.PositiveInfinity => PositiveInfinity; - // /// - // public static double AsinPi(double x) => Math.AsinPi(x); - - // /// - // public static double AtanPi(double x) => Math.AtanPi(x); - - // /// - // public static double Atan2Pi(double y, double x) => Math.Atan2Pi(y, x); - - // /// - // public static double Compound(double x, double n) => Math.Compound(x, n); - - // /// - // public static double CosPi(double x) => Math.CosPi(x); + /// + static double IFloatingPointIeee754.Tau => Tau; - // /// - // public static double ExpM1(double x) => Math.ExpM1(x); + /// + public static double BitDecrement(double x) => Math.BitDecrement(x); - // /// - // public static double Exp2(double x) => Math.Exp2(x); + /// + public static double BitIncrement(double x) => Math.BitIncrement(x); - // /// - // public static double Exp2M1(double x) => Math.Exp2M1(x); + /// + public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend); - // /// - // public static double Exp10(double x) => Math.Exp10(x); + /// + public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right); - // /// - // public static double Exp10M1(double x) => Math.Exp10M1(x); + /// + public static int ILogB(double x) => Math.ILogB(x); - // /// - // public static double Hypot(double x, double y) => Math.Hypot(x, y); + /// + public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x); - // /// - // public static double LogP1(double x) => Math.LogP1(x); + /// + public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x); - // /// - // public static double Log2P1(double x) => Math.Log2P1(x); + /// + public static double ScaleB(double x, int n) => Math.ScaleB(x, n); - // /// - // public static double Log10P1(double x) => Math.Log10P1(x); + // /// + // public static double Compound(double x, double n) => Math.Compound(x, n); - // /// + // /// // public static double MaxMagnitudeNumber(double x, double y) => Math.MaxMagnitudeNumber(x, y); - // /// + // /// // public static double MaxNumber(double x, double y) => Math.MaxNumber(x, y); - // /// + // /// // public static double MinMagnitudeNumber(double x, double y) => Math.MinMagnitudeNumber(x, y); - // /// + // /// // public static double MinNumber(double x, double y) => Math.MinNumber(x, y); - // /// - // public static double Root(double x, double n) => Math.Root(x, n); + // + // IHyperbolicFunctions + // - // /// - // public static double SinPi(double x) => Math.SinPi(x, y); + /// + public static double Acosh(double x) => Math.Acosh(x); - // /// - // public static double TanPi(double x) => Math.TanPi(x, y); + /// + public static double Asinh(double x) => Math.Asinh(x); + + /// + public static double Atanh(double x) => Math.Atanh(x); + + /// + public static double Cosh(double x) => Math.Cosh(x); + + /// + public static double Sinh(double x) => Math.Sinh(x); + + /// + public static double Tanh(double x) => Math.Tanh(x); // // IIncrementOperators @@ -797,6 +719,28 @@ public static double ScaleB(double x, TInteger n) // /// // static double IIncrementOperators.operator checked ++(double value) => checked(++value); + // + // ILogarithmicFunctions + // + + /// + public static double Log(double x) => Math.Log(x); + + /// + public static double Log(double x, double newBase) => Math.Log(x, newBase); + + /// + public static double Log10(double x) => Math.Log10(x); + + // /// + // public static double LogP1(double x) => Math.LogP1(x); + + // /// + // public static double Log2P1(double x) => Math.Log2P1(x); + + // /// + // public static double Log10P1(double x) => Math.Log10P1(x); + // // IMinMaxValue // @@ -837,21 +781,18 @@ public static double ScaleB(double x, TInteger n) // INumber // - /// - static double INumber.One => One; - - /// - static double INumber.Zero => Zero; - /// public static double Abs(double value) => Math.Abs(value); /// public static double Clamp(double value, double min, double max) => Math.Clamp(value, min, max); - /// + /// + public static double CopySign(double x, double y) => Math.CopySign(x, y); + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static double Create(TOther value) + public static double CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -1053,17 +994,20 @@ public static double CreateTruncating(TOther value) } } - /// - public static (double Quotient, double Remainder) DivRem(double left, double right) => (left / right, left % right); - /// public static double Max(double x, double y) => Math.Max(x, y); + /// + public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y); + /// public static double Min(double x, double y) => Math.Min(x, y); + /// + public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y); + /// - public static double Sign(double value) => Math.Sign(value); + public static int Sign(double value) => Math.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1149,11 +1093,44 @@ public static bool TryCreate(TOther value, out double result) } // - // IParseable + // INumberBase + // + + /// + static double INumberBase.One => One; + + /// + static double INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out double result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); + // + // IPowerFunctions + // + + /// + public static double Pow(double x, double y) => Math.Pow(x, y); + + // + // IRootFunctions + // + + /// + public static double Cbrt(double x) => Math.Cbrt(x); + + // /// + // public static double Hypot(double x, double y) => Math.Hypot(x, y); + + /// + public static double Sqrt(double x) => Math.Sqrt(x); + + // /// + // public static double Root(double x, double n) => Math.Root(x, n); + // // ISignedNumber // @@ -1162,13 +1139,13 @@ public static bool TryCreate(TOther value, out double result) static double ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static double Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out double result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // @@ -1181,6 +1158,55 @@ public static bool TryCreate(TOther value, out double result) // /// // static double ISubtractionOperators.operator checked -(double left, double right) => checked((double)(left - right)); + // + // ITrigonometricFunctions + // + + /// + public static double Acos(double x) => Math.Acos(x); + + /// + public static double Asin(double x) => Math.Asin(x); + + /// + public static double Atan(double x) => Math.Atan(x); + + /// + public static double Atan2(double y, double x) => Math.Atan2(y, x); + + /// + public static double Cos(double x) => Math.Cos(x); + + /// + public static double Sin(double x) => Math.Sin(x); + + /// + public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x); + + /// + public static double Tan(double x) => Math.Tan(x); + + // /// + // public static double AcosPi(double x) => Math.AcosPi(x); + + // /// + // public static double AsinPi(double x) => Math.AsinPi(x); + + // /// + // public static double AtanPi(double x) => Math.AtanPi(x); + + // /// + // public static double Atan2Pi(double y, double x) => Math.Atan2Pi(y, x); + + // /// + // public static double CosPi(double x) => Math.CosPi(x); + + // /// + // public static double SinPi(double x) => Math.SinPi(x, y); + + // /// + // public static double TanPi(double x) => Math.TanPi(x, y); + // // IUnaryNegationOperators // @@ -1197,8 +1223,5 @@ public static bool TryCreate(TOther value, out double result) /// static double IUnaryPlusOperators.operator +(double value) => (double)(+value); - - // /// - // static double IUnaryPlusOperators.operator checked +(double value) => checked((double)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Guid.cs b/src/libraries/System.Private.CoreLib/src/System/Guid.cs index 150e0f94da9f63..04b03d55a697ae 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Guid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Guid.cs @@ -23,7 +23,7 @@ public readonly partial struct Guid IComparable, IEquatable, IComparisonOperators, - ISpanParseable + ISpanParsable { public static readonly Guid Empty; @@ -1466,23 +1466,23 @@ bool ISpanFormattable.TryFormat(Span destination, out int charsWritten, Re } // - // IParseable + // IParsable // - /// + /// public static Guid Parse(string s, IFormatProvider? provider) => Parse(s); - /// + /// public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); // - // ISpanParseable + // ISpanParsable // - /// + /// public static Guid Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Half.cs b/src/libraries/System.Private.CoreLib/src/System/Half.cs index 9d8ce8432140ef..de28b087231549 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Half.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Half.cs @@ -22,7 +22,7 @@ public readonly struct Half ISpanFormattable, IComparable, IEquatable, - IBinaryFloatingPoint, + IBinaryFloatingPointIeee754, IMinMaxValue { private const NumberStyles DefaultParseStyle = NumberStyles.Float | NumberStyles.AllowThousands; @@ -723,7 +723,7 @@ private static double CreateDoubleNaN(bool sign, ulong significand) // /// - public static Half AdditiveIdentity => new Half(PositiveZeroBits); + static Half IAdditiveIdentity.AdditiveIdentity => new Half(PositiveZeroBits); // // IBinaryNumber @@ -737,7 +737,7 @@ public static bool IsPow2(Half value) uint exponent = (bits >> ExponentShift) & ShiftedExponentMask; uint significand = bits & SignificandMask; - return (value > Zero) + return (value > default(Half)) && (exponent != MinExponent) && (exponent != MaxExponent) && (significand == MinSignificand); } @@ -808,211 +808,128 @@ public static bool IsPow2(Half value) // static Half IDivisionOperators.operator checked /(Half left, Half right) => checked((Half)((float)left / (float)right)); // - // IFloatingPoint + // IExponentialFunctions // - /// - public static Half E => new Half(EBits); - - /// - public static Half NegativeZero => new Half(NegativeZeroBits); - - /// - public static Half Pi => new Half(PiBits); - - /// - public static Half Tau => new Half(TauBits); - - /// - public static Half Acos(Half x) => (Half)MathF.Acos((float)x); - - /// - public static Half Acosh(Half x) => (Half)MathF.Acosh((float)x); - - /// - public static Half Asin(Half x) => (Half)MathF.Asin((float)x); - - /// - public static Half Asinh(Half x) => (Half)MathF.Asinh((float)x); + /// + public static Half Exp(Half x) => (Half)MathF.Exp((float)x); - /// - public static Half Atan(Half x) => (Half)MathF.Atan((float)x); + // /// + // public static Half ExpM1(Half x) => (Half)MathF.ExpM1((float)x); - /// - public static Half Atan2(Half y, Half x) => (Half)MathF.Atan2((float)y, (float)x); + // /// + // public static Half Exp2(Half x) => (Half)MathF.Exp2((float)x); - /// - public static Half Atanh(Half x) => (Half)MathF.Atanh((float)x); + // /// + // public static Half Exp2M1(Half x) => (Half)MathF.Exp2M1((float)x); - /// - public static Half BitIncrement(Half x) => (Half)MathF.BitIncrement((float)x); + // /// + // public static Half Exp10(Half x) => (Half)MathF.Exp10((float)x); - /// - public static Half BitDecrement(Half x) => (Half)MathF.BitDecrement((float)x); + // /// + // public static Half Exp10M1(Half x) => (Half)MathF.Exp10M1((float)x); - /// - public static Half Cbrt(Half x) => (Half)MathF.Cbrt((float)x); + // + // IFloatingPoint + // /// public static Half Ceiling(Half x) => (Half)MathF.Ceiling((float)x); - /// - public static Half CopySign(Half x, Half y) => (Half)MathF.CopySign((float)x, (float)y); - - /// - public static Half Cos(Half x) => (Half)MathF.Cos((float)x); - - /// - public static Half Cosh(Half x) => (Half)MathF.Cosh((float)x); - - /// - public static Half Exp(Half x) => (Half)MathF.Exp((float)x); - /// public static Half Floor(Half x) => (Half)MathF.Floor((float)x); - /// - public static Half FusedMultiplyAdd(Half left, Half right, Half addend) => (Half)MathF.FusedMultiplyAdd((float)left, (float)right, (float)addend); - - /// - public static Half IEEERemainder(Half left, Half right) => (Half)MathF.IEEERemainder((float)left, (float)right); - - /// - public static TInteger ILogB(Half x) - where TInteger : IBinaryInteger => TInteger.Create(MathF.ILogB((float)x)); - - /// - public static Half Log(Half x) => (Half)MathF.Log((float)x); - - /// - public static Half Log(Half x, Half newBase) => (Half)MathF.Log((float)x, (float)newBase); - - /// - public static Half Log10(Half x) => (Half)MathF.Log10((float)x); - - /// - public static Half MaxMagnitude(Half x, Half y) => (Half)MathF.MaxMagnitude((float)x, (float)y); - - /// - public static Half MinMagnitude(Half x, Half y) => (Half)MathF.MinMagnitude((float)x, (float)y); - - /// - public static Half Pow(Half x, Half y) => (Half)MathF.Pow((float)x, (float)y); - - /// - public static Half ReciprocalEstimate(Half x) => (Half)MathF.ReciprocalEstimate((float)x); - - /// - public static Half ReciprocalSqrtEstimate(Half x) => (Half)MathF.ReciprocalSqrtEstimate((float)x); - /// public static Half Round(Half x) => (Half)MathF.Round((float)x); - /// - public static Half Round(Half x, TInteger digits) - where TInteger : IBinaryInteger => (Half)MathF.Round((float)x, int.Create(digits)); + /// + public static Half Round(Half x, int digits) => (Half)MathF.Round((float)x, digits); /// public static Half Round(Half x, MidpointRounding mode) => (Half)MathF.Round((float)x, mode); - /// - public static Half Round(Half x, TInteger digits, MidpointRounding mode) - where TInteger : IBinaryInteger => (Half)MathF.Round((float)x, int.Create(digits), mode); - - /// - public static Half ScaleB(Half x, TInteger n) - where TInteger : IBinaryInteger => (Half)MathF.ScaleB((float)x, int.Create(n)); - - /// - public static Half Sin(Half x) => (Half)MathF.Sin((float)x); - - /// - public static (Half Sin, Half Cos) SinCos(Half x) - { - var (sin, cos) = MathF.SinCos((float)x); - return ((Half)sin, (Half)cos); - } - - /// - public static Half Sinh(Half x) => (Half)MathF.Sinh((float)x); - - /// - public static Half Sqrt(Half x) => (Half)MathF.Sqrt((float)x); - - /// - public static Half Tan(Half x) => (Half)MathF.Tan((float)x); - - /// - public static Half Tanh(Half x) => (Half)MathF.Tanh((float)x); + /// + public static Half Round(Half x, int digits, MidpointRounding mode) => (Half)MathF.Round((float)x, digits, mode); /// public static Half Truncate(Half x) => (Half)MathF.Truncate((float)x); - // /// - // public static Half AcosPi(Half x) => (Half)MathF.AcosPi((float)x); - - // /// - // public static Half AsinPi(Half x) => (Half)MathF.AsinPi((float)x); + // + // IFloatingPointIeee754 + // - // /// - // public static Half AtanPi(Half x) => (Half)MathF.AtanPi((float)x); + /// + public static Half E => new Half(EBits); - // /// - // public static Half Atan2Pi(Half y, Half x) => (Half)MathF.Atan2Pi((float)y, (float)x); + /// + public static Half NegativeZero => new Half(NegativeZeroBits); - // /// - // public static Half Compound(Half x, Half n) => (Half)MathF.Compound((float)x, (float)n); + /// + public static Half Pi => new Half(PiBits); - // /// - // public static Half CosPi(Half x) => (Half)MathF.CosPi((float)x); + /// + public static Half Tau => new Half(TauBits); - // /// - // public static Half ExpM1(Half x) => (Half)MathF.ExpM1((float)x); + /// + public static Half BitDecrement(Half x) => (Half)MathF.BitDecrement((float)x); - // /// - // public static Half Exp2(Half x) => (Half)MathF.Exp2((float)x); + /// + public static Half BitIncrement(Half x) => (Half)MathF.BitIncrement((float)x); - // /// - // public static Half Exp2M1(Half x) => (Half)MathF.Exp2M1((float)x); + /// + public static Half FusedMultiplyAdd(Half left, Half right, Half addend) => (Half)MathF.FusedMultiplyAdd((float)left, (float)right, (float)addend); - // /// - // public static Half Exp10(Half x) => (Half)MathF.Exp10((float)x); + /// + public static Half Ieee754Remainder(Half left, Half right) => (Half)MathF.IEEERemainder((float)left, (float)right); - // /// - // public static Half Exp10M1(Half x) => (Half)MathF.Exp10M1((float)x); + /// + public static int ILogB(Half x) => MathF.ILogB((float)x); - // /// - // public static Half Hypot(Half x, Half y) => (Half)MathF.Hypot((float)x, (float)y); + /// + public static Half ReciprocalEstimate(Half x) => (Half)MathF.ReciprocalEstimate((float)x); - // /// - // public static Half LogP1(Half x) => (Half)MathF.LogP1((float)x); + /// + public static Half ReciprocalSqrtEstimate(Half x) => (Half)MathF.ReciprocalSqrtEstimate((float)x); - // /// - // public static Half Log2P1(Half x) => (Half)MathF.Log2P1((float)x); + /// + public static Half ScaleB(Half x, int n) => (Half)MathF.ScaleB((float)x, n); - // /// - // public static Half Log10P1(Half x) => (Half)MathF.Log10P1((float)x); + // /// + // public static Half Compound(Half x, Half n) => (Half)MathF.Compound((float)x, (float)n); - // /// + // /// // public static Half MaxMagnitudeNumber(Half x, Half y) => (Half)MathF.MaxMagnitudeNumber((float)x, (float)y); - // /// + // /// // public static Half MaxNumber(Half x, Half y) => (Half)MathF.MaxNumber((float)x, (float)y); - // /// + // /// // public static Half MinMagnitudeNumber(Half x, Half y) => (Half)MathF.MinMagnitudeNumber((float)x, (float)y); - // /// + // /// // public static Half MinNumber(Half x, Half y) => (Half)MathF.MinNumber((float)x, (float)y); - // /// - // public static Half Root(Half x, Half n) => (Half)MathF.Root((float)x, (float)n); + // + // IHyperbolicFunctions + // - // /// - // public static Half SinPi(Half x) => (Half)MathF.SinPi((float)x, (float)y); + /// + public static Half Acosh(Half x) => (Half)MathF.Acosh((float)x); - // /// - // public static Half TanPi(Half x) => (Half)MathF.TanPi((float)x, (float)y); + /// + public static Half Asinh(Half x) => (Half)MathF.Asinh((float)x); + + /// + public static Half Atanh(Half x) => (Half)MathF.Atanh((float)x); + + /// + public static Half Cosh(Half x) => (Half)MathF.Cosh((float)x); + + /// + public static Half Sinh(Half x) => (Half)MathF.Sinh((float)x); + + /// + public static Half Tanh(Half x) => (Half)MathF.Tanh((float)x); // // IIncrementOperators @@ -1034,6 +951,28 @@ public static (Half Sin, Half Cos) SinCos(Half x) // return (Half)tmp; // } + // + // ILogarithmicFunctions + // + + /// + public static Half Log(Half x) => (Half)MathF.Log((float)x); + + /// + public static Half Log(Half x, Half newBase) => (Half)MathF.Log((float)x, (float)newBase); + + /// + public static Half Log10(Half x) => (Half)MathF.Log10((float)x); + + // /// + // public static Half LogP1(Half x) => (Half)MathF.LogP1((float)x); + + // /// + // public static Half Log2P1(Half x) => (Half)MathF.Log2P1((float)x); + + // /// + // public static Half Log10P1(Half x) => (Half)MathF.Log10P1((float)x); + // // IModulusOperators // @@ -1062,21 +1001,18 @@ public static (Half Sin, Half Cos) SinCos(Half x) // INumber // - /// - public static Half One => new Half(PositiveOneBits); - - /// - public static Half Zero => new Half(PositiveZeroBits); - /// public static Half Abs(Half value) => (Half)MathF.Abs((float)value); /// public static Half Clamp(Half value, Half min, Half max) => (Half)Math.Clamp((float)value, (float)min, (float)max); - /// + /// + public static Half CopySign(Half x, Half y) => (Half)MathF.CopySign((float)x, (float)y); + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Half Create(TOther value) + public static Half CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -1278,17 +1214,20 @@ public static Half CreateTruncating(TOther value) } } - /// - public static (Half Quotient, Half Remainder) DivRem(Half left, Half right) => ((Half, Half))((float)left / (float)right, (float)left % (float)right); - /// public static Half Max(Half x, Half y) => (Half)MathF.Max((float)x, (float)y); + /// + public static Half MaxMagnitude(Half x, Half y) => (Half)MathF.MaxMagnitude((float)x, (float)y); + /// public static Half Min(Half x, Half y) => (Half)MathF.Min((float)x, (float)y); + /// + public static Half MinMagnitude(Half x, Half y) => (Half)MathF.MinMagnitude((float)x, (float)y); + /// - public static Half Sign(Half value) => (Half)MathF.Sign((float)value); + public static int Sign(Half value) => MathF.Sign((float)value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1374,26 +1313,59 @@ public static bool TryCreate(TOther value, out Half result) } // - // IParseable + // INumberBase + // + + /// + static Half INumberBase.One => new Half(PositiveOneBits); + + /// + static Half INumberBase.Zero => new Half(PositiveZeroBits); + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Half result) => TryParse(s, DefaultParseStyle, provider, out result); + // + // IPowerFunctions + // + + /// + public static Half Pow(Half x, Half y) => (Half)MathF.Pow((float)x, (float)y); + + // + // IRootFunctions + // + + /// + public static Half Cbrt(Half x) => (Half)MathF.Cbrt((float)x); + + // /// + // public static Half Hypot(Half x, Half y) => (Half)MathF.Hypot((float)x, (float)y); + + /// + public static Half Sqrt(Half x) => (Half)MathF.Sqrt((float)x); + + // /// + // public static Half Root(Half x, Half n) => (Half)MathF.Root((float)x, (float)n); + // // ISignedNumber // /// - public static Half NegativeOne => new Half(NegativeOneBits); + static Half ISignedNumber.NegativeOne => new Half(NegativeOneBits); // - // ISpanParseable + // ISpanParsable // - /// + /// public static Half Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, DefaultParseStyle, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out Half result) => TryParse(s, DefaultParseStyle, provider, out result); // @@ -1406,6 +1378,59 @@ public static bool TryCreate(TOther value, out Half result) // /// // static Half ISubtractionOperators.operator checked -(Half left, Half right) => checked((Half)((float)left - (float)right)); + // + // ITrigonometricFunctions + // + + /// + public static Half Acos(Half x) => (Half)MathF.Acos((float)x); + + /// + public static Half Asin(Half x) => (Half)MathF.Asin((float)x); + + /// + public static Half Atan(Half x) => (Half)MathF.Atan((float)x); + + /// + public static Half Atan2(Half y, Half x) => (Half)MathF.Atan2((float)y, (float)x); + + /// + public static Half Cos(Half x) => (Half)MathF.Cos((float)x); + + /// + public static Half Sin(Half x) => (Half)MathF.Sin((float)x); + + /// + public static (Half Sin, Half Cos) SinCos(Half x) + { + var (sin, cos) = MathF.SinCos((float)x); + return ((Half)sin, (Half)cos); + } + + /// + public static Half Tan(Half x) => (Half)MathF.Tan((float)x); + + // /// + // public static Half AcosPi(Half x) => (Half)MathF.AcosPi((float)x); + + // /// + // public static Half AsinPi(Half x) => (Half)MathF.AsinPi((float)x); + + // /// + // public static Half AtanPi(Half x) => (Half)MathF.AtanPi((float)x); + + // /// + // public static Half Atan2Pi(Half y, Half x) => (Half)MathF.Atan2Pi((float)y, (float)x); + + // /// + // public static Half CosPi(Half x) => (Half)MathF.CosPi((float)x); + + // /// + // public static Half SinPi(Half x) => (Half)MathF.SinPi((float)x, (float)y); + + // /// + // public static Half TanPi(Half x) => (Half)MathF.TanPi((float)x, (float)y); + // // IUnaryNegationOperators // @@ -1422,8 +1447,5 @@ public static bool TryCreate(TOther value, out Half result) /// public static Half operator +(Half value) => value; - - // /// - // static Half IUnaryPlusOperators.operator checked +(Half value) => checked(value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs b/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs deleted file mode 100644 index 219e121009198d..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/IFloatingPoint.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System -{ - /// Defines a floating-point type. - /// The type that implements the interface. - public interface IFloatingPoint - : ISignedNumber - where TSelf : IFloatingPoint - { - /// Gets the mathematical constant e. - static abstract TSelf E { get; } - - /// Gets the smallest value such that can be added to 0 that does not result in 0. - static abstract TSelf Epsilon { get; } - - /// Gets a value that represents NaN. - static abstract TSelf NaN { get; } - - /// Gets a value that represents negative infinity. - static abstract TSelf NegativeInfinity { get; } - - /// Gets a value that represents negative zero. - static abstract TSelf NegativeZero { get; } - - /// Gets the mathematical constant pi. - static abstract TSelf Pi { get; } - - /// Gets a value that represents positive infinity. - static abstract TSelf PositiveInfinity { get; } - - /// Gets the mathematical constant tau. - static abstract TSelf Tau { get; } - - /// Computes the arc-cosine of a value. - /// The value, in radians, whose arc-cosine is to be computed. - /// The arc-cosine of . - static abstract TSelf Acos(TSelf x); - - /// Computes the hyperbolic arc-cosine of a value. - /// The value, in radians, whose hyperbolic arc-cosine is to be computed. - /// The hyperbolic arc-cosine of . - static abstract TSelf Acosh(TSelf x); - - /// Computes the arc-sine of a value. - /// The value, in radians, whose arc-sine is to be computed. - /// The arc-sine of . - static abstract TSelf Asin(TSelf x); - - /// Computes the hyperbolic arc-sine of a value. - /// The value, in radians, whose hyperbolic arc-sine is to be computed. - /// The hyperbolic arc-sine of . - static abstract TSelf Asinh(TSelf x); - - /// Computes the arc-tangent of a value. - /// The value, in radians, whose arc-tangent is to be computed. - /// The arc-tangent of . - static abstract TSelf Atan(TSelf x); - - /// Computes the arc-tangent of the quotient of two values. - /// The y-coordinate of a point. - /// The x-coordinate of a point. - /// The arc-tangent of divided-by . - static abstract TSelf Atan2(TSelf y, TSelf x); - - /// Computes the hyperbolic arc-tangent of a value. - /// The value, in radians, whose hyperbolic arc-tangent is to be computed. - /// The hyperbolic arc-tangent of . - static abstract TSelf Atanh(TSelf x); - - /// Decrements a value to the smallest value that compares less than a given value. - /// The value to be bitwise decremented. - /// The smallest value that compares less than . - static abstract TSelf BitDecrement(TSelf x); - - /// Increments a value to the smallest value that compares greater than a given value. - /// The value to be bitwise incremented. - /// The smallest value that compares greater than . - static abstract TSelf BitIncrement(TSelf x); - - /// Computes the cube-root of a value. - /// The value whose cube-root is to be computed. - /// The cube-root of . - static abstract TSelf Cbrt(TSelf x); - - /// Computes the ceiling of a value. - /// The value whose ceiling is to be computed. - /// The ceiling of . - static abstract TSelf Ceiling(TSelf x); - - /// Copies the sign of a value to the sign of another value.. - /// The value whose magnitude is used in the result. - /// The value whose sign is used in the result. - /// A value with the magnitude of and the sign of . - static abstract TSelf CopySign(TSelf x, TSelf y); - - /// Computes the cosine of a value. - /// The value, in radians, whose cosine is to be computed. - /// The cosine of . - static abstract TSelf Cos(TSelf x); - - /// Computes the hyperbolic cosine of a value. - /// The value, in radians, whose hyperbolic cosine is to be computed. - /// The hyperbolic cosine of . - static abstract TSelf Cosh(TSelf x); - - /// Computes raised to a given power. - /// The power to which is raised. - /// raised to the power of . - static abstract TSelf Exp(TSelf x); - - /// Computes the floor of a value. - /// The value whose floor is to be computed. - /// The floor of . - static abstract TSelf Floor(TSelf x); - - /// Computes the fused multiply-add of three values. - /// The value which multiplies. - /// The value which multiplies . - /// The value that is added to the product of and . - /// The result of times plus computed as one ternary operation. - static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend); - - /// Computes the remainder of two values as specified by IEEE 754. - /// The value which divides. - /// The value which divides . - /// The remainder of divided-by as specified by IEEE 754. - static abstract TSelf IEEERemainder(TSelf left, TSelf right); - - /// Computes the integer logarithm of a value. - /// The value whose integer logarithm is to be computed. - /// The integer logarithm of . - static abstract TInteger ILogB(TSelf x) - where TInteger : IBinaryInteger; - - /// Determines if a value is finite. - /// The value to be checked. - /// true if is finite; otherwise, false. - static abstract bool IsFinite(TSelf value); - - /// Determines if a value is infinite. - /// The value to be checked. - /// true if is infinite; otherwise, false. - static abstract bool IsInfinity(TSelf value); - - /// Determines if a value is NaN. - /// The value to be checked. - /// true if is NaN; otherwise, false. - static abstract bool IsNaN(TSelf value); - - /// Determines if a value is negative. - /// The value to be checked. - /// true if is negative; otherwise, false. - static abstract bool IsNegative(TSelf value); - - /// Determines if a value is negative infinity. - /// The value to be checked. - /// true if is negative infinity; otherwise, false. - static abstract bool IsNegativeInfinity(TSelf value); - - /// Determines if a value is normal. - /// The value to be checked. - /// true if is normal; otherwise, false. - static abstract bool IsNormal(TSelf value); - - /// Determines if a value is positive infinity. - /// The value to be checked. - /// true if is positive infinity; otherwise, false. - static abstract bool IsPositiveInfinity(TSelf value); - - /// Determines if a value is subnormal. - /// The value to be checked. - /// true if is subnormal; otherwise, false. - static abstract bool IsSubnormal(TSelf value); - - /// Computes the natural (base- logarithm of a value. - /// The value whose natural logarithm is to be computed. - /// The natural logarithm of . - static abstract TSelf Log(TSelf x); - - /// Computes the logarithm of a value in the specified base. - /// The value whose logarithm is to be computed. - /// The base in which the logarithm is to be computed. - /// The base- logarithm of . - static abstract TSelf Log(TSelf x, TSelf newBase); - - /// Computes the base-2 logarithm of a value. - /// The value whose base-2 logarithm is to be computed. - /// The base-2 logarithm of . - static abstract TSelf Log2(TSelf x); - - /// Computes the base-10 logarithm of a value. - /// The value whose base-10 logarithm is to be computed. - /// The base-10 logarithm of . - static abstract TSelf Log10(TSelf x); - - /// Compares two values to compute which is greater. - /// The value to compare with . - /// The value to compare with . - /// if it is greater than ; otherwise, . - /// For this method matches the IEEE 754:2019 maximumMagnitude function. This requires NaN inputs to not be propagated back to the caller and for -0.0 to be treated as less than +0.0. - static abstract TSelf MaxMagnitude(TSelf x, TSelf y); - - /// Compares two values to compute which is lesser. - /// The value to compare with . - /// The value to compare with . - /// if it is less than ; otherwise, . - /// For this method matches the IEEE 754:2019 minimumMagnitude function. This requires NaN inputs to not be propagated back to the caller and for -0.0 to be treated as less than +0.0. - static abstract TSelf MinMagnitude(TSelf x, TSelf y); - - /// Computes a value raised to a given power. - /// The value which is raised to the power of . - /// The power to which is raised. - /// raised to the power of . - static abstract TSelf Pow(TSelf x, TSelf y); - - /// Computes an estimate of the reciprocal of a value. - /// The value whose estimate of the reciprocal is to be computed. - /// An estimate of the reciprocal of . - static abstract TSelf ReciprocalEstimate(TSelf x); - - /// Computes an estimate of the reciprocal square root of a value. - /// The value whose estimate of the reciprocal square root is to be computed. - /// An estimate of the reciprocal square root of . - static abstract TSelf ReciprocalSqrtEstimate(TSelf x); - - /// Rounds a value to the nearest integer using the default rounding mode (). - /// The value to round. - /// The result of rounding to the nearest integer using the default rounding mode. - static abstract TSelf Round(TSelf x); - - /// Rounds a value to a specified number of fractional-digits using the default rounding mode (). - /// The value to round. - /// The number of fractional digits to which should be rounded. - /// The result of rounding to fractional-digits using the default rounding mode. - static abstract TSelf Round(TSelf x, TInteger digits) - where TInteger : IBinaryInteger; - - /// Rounds a value to the nearest integer using the specified rounding mode. - /// The value to round. - /// The mode under which should be rounded. - /// The result of rounding to the nearest integer using . - static abstract TSelf Round(TSelf x, MidpointRounding mode); - - /// Rounds a value to a specified number of fractional-digits using the default rounding mode (). - /// The value to round. - /// The number of fractional digits to which should be rounded. - /// The mode under which should be rounded. - /// The result of rounding to fractional-digits using . - static abstract TSelf Round(TSelf x, TInteger digits, MidpointRounding mode) - where TInteger : IBinaryInteger; - - /// Computes the product of a value and its base-radix raised to the specified power. - /// The value which base-radix raised to the power of multiplies. - /// The value to which base-radix is raised before multipliying . - /// The product of and base-radix raised to the power of . - static abstract TSelf ScaleB(TSelf x, TInteger n) - where TInteger : IBinaryInteger; - - /// Computes the sine of a value. - /// The value, in radians, whose sine is to be computed. - /// The sine of . - static abstract TSelf Sin(TSelf x); - - /// Computes the sine and cosine of a value. - /// The value, in radians, whose sine and cosine are to be computed. - /// The sine and cosine of . - static abstract (TSelf Sin, TSelf Cos) SinCos(TSelf x); - - /// Computes the hyperbolic sine of a value. - /// The value, in radians, whose hyperbolic sine is to be computed. - /// The hyperbolic sine of . - static abstract TSelf Sinh(TSelf x); - - /// Computes the square-root of a value. - /// The value whose square-root is to be computed. - /// The square-root of . - static abstract TSelf Sqrt(TSelf x); - - /// Computes the tangent of a value. - /// The value, in radians, whose tangent is to be computed. - /// The tangent of . - static abstract TSelf Tan(TSelf x); - - /// Computes the hyperbolic tangent of a value. - /// The value, in radians, whose hyperbolic tangent is to be computed. - /// The hyperbolic tangent of . - static abstract TSelf Tanh(TSelf x); - - /// Truncates a value. - /// The value to truncate. - /// The truncation of . - static abstract TSelf Truncate(TSelf x); - - // static abstract TSelf AcosPi(TSelf x); - // - // static abstract TSelf AsinPi(TSelf x); - // - // static abstract TSelf AtanPi(TSelf x); - // - // static abstract TSelf Atan2Pi(TSelf y, TSelf x); - // - // static abstract TSelf Compound(TSelf x, TSelf n); - // - // static abstract TSelf CosPi(TSelf x); - // - // static abstract TSelf ExpM1(TSelf x); - // - // static abstract TSelf Exp2(TSelf x); - // - // static abstract TSelf Exp2M1(TSelf x); - // - // static abstract TSelf Exp10(TSelf x); - // - // static abstract TSelf Exp10M1(TSelf x); - // - // static abstract TSelf Hypot(TSelf x, TSelf y); - // - // static abstract TSelf LogP1(TSelf x); - // - // static abstract TSelf Log2P1(TSelf x); - // - // static abstract TSelf Log10P1(TSelf x); - // - // static abstract TSelf MaxMagnitudeNumber(TSelf x, TSelf y); - // - // static abstract TSelf MaxNumber(TSelf x, TSelf y); - // - // static abstract TSelf MinMagnitudeNumber(TSelf x, TSelf y); - // - // static abstract TSelf MinNumber(TSelf x, TSelf y); - // - // static abstract TSelf Root(TSelf x, TSelf n); - // - // static abstract TSelf SinPi(TSelf x); - // - // static abstract TSelf TanPi(TSelf x); - } - - /// Defines a floating-point type that is represented in a base-2 format. - /// The type that implements the interface. - public interface IBinaryFloatingPoint - : IBinaryNumber, - IFloatingPoint - where TSelf : IBinaryFloatingPoint - { - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/IParseable.cs b/src/libraries/System.Private.CoreLib/src/System/IParsable.cs similarity index 95% rename from src/libraries/System.Private.CoreLib/src/System/IParseable.cs rename to src/libraries/System.Private.CoreLib/src/System/IParsable.cs index 8a043c14d32b77..be4b1e4aa58b69 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IParseable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IParsable.cs @@ -7,8 +7,8 @@ namespace System { /// Defines a mechanism for parsing a string to a value. /// The type that implements this interface. - public interface IParseable - where TSelf : IParseable + public interface IParsable + where TSelf : IParsable { /// Parses a string into a value. /// The string to parse. diff --git a/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs b/src/libraries/System.Private.CoreLib/src/System/ISpanParsable.cs similarity index 94% rename from src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs rename to src/libraries/System.Private.CoreLib/src/System/ISpanParsable.cs index d89ffcb344f9dd..56e7babde24647 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ISpanParseable.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ISpanParsable.cs @@ -5,8 +5,8 @@ namespace System { /// Defines a mechanism for parsing a span of characters to a value. /// The type that implements this interface. - public interface ISpanParseable : IParseable - where TSelf : ISpanParseable + public interface ISpanParsable : IParsable + where TSelf : ISpanParsable { /// Parses a span of characters into a value. /// The span of characters to parse. diff --git a/src/libraries/System.Private.CoreLib/src/System/Int16.cs b/src/libraries/System.Private.CoreLib/src/System/Int16.cs index 14fb86efb722f6..2f74b94871c839 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int16.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int16.cs @@ -29,19 +29,19 @@ public readonly struct Int16 public const short MinValue = unchecked((short)0x8000); /// Represents the additive identity (0). - public const short AdditiveIdentity = 0; + private const short AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const short MultiplicativeIdentity = 1; + private const short MultiplicativeIdentity = 1; /// Represents the number one (1). - public const short One = 1; + private const short One = 1; /// Represents the number zero (0). - public const short Zero = 0; + private const short Zero = 0; /// Represents the number negative one (-1). - public const short NegativeOne = -1; + private const short NegativeOne = -1; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -320,6 +320,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right); + /// public static short LeadingZeroCount(short value) => (short)(BitOperations.LeadingZeroCount((ushort)value) - 16); @@ -462,21 +465,38 @@ public static short Log2(short value) // INumber // - /// - static short INumber.One => One; - - /// - static short INumber.Zero => Zero; - /// public static short Abs(short value) => Math.Abs(value); /// public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max); - /// + /// + public static short CopySign(short value, short sign) + { + short absValue = value; + + if (absValue < 0) + { + absValue = (short)(-absValue); + } + + if (sign >= 0) + { + if (absValue < 0) + { + Math.ThrowNegateTwosCompOverflow(); + } + + return absValue; + } + + return (short)(-absValue); + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static short Create(TOther value) + public static short CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -695,17 +715,77 @@ public static short CreateTruncating(TOther value) } } - /// - public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right); + /// + public static bool IsNegative(short value) => value < 0; /// public static short Max(short x, short y) => Math.Max(x, y); + /// + public static short MaxMagnitude(short x, short y) + { + short absX = x; + + if (absX < 0) + { + absX = (short)(-absX); + + if (absX < 0) + { + return x; + } + } + + short absY = y; + + if (absY < 0) + { + absY = (short)(-absY); + + if (absY < 0) + { + return y; + } + } + + return (absX >= absY) ? x : y; + } + /// public static short Min(short x, short y) => Math.Min(x, y); + /// + public static short MinMagnitude(short x, short y) + { + short absX = x; + + if (absX < 0) + { + absX = (short)(-absX); + + if (absX < 0) + { + return y; + } + } + + short absY = y; + + if (absY < 0) + { + absY = (short)(-absY); + + if (absY < 0) + { + return x; + } + } + + return (absX <= absY) ? x : y; + } + /// - public static short Sign(short value) => (short)Math.Sign(value); + public static int Sign(short value) => Math.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -879,7 +959,17 @@ public static bool TryCreate(TOther value, out short result) } // - // IParseable + // INumberBase + // + + /// + static short INumberBase.One => One; + + /// + static short INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out short result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -905,13 +995,13 @@ public static bool TryCreate(TOther value, out short result) static short ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static short Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out short result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -940,8 +1030,5 @@ public static bool TryCreate(TOther value, out short result) /// static short IUnaryPlusOperators.operator +(short value) => (short)(+value); - - // /// - // static short IUnaryPlusOperators.operator checked +(short value) => checked((short)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Int32.cs b/src/libraries/System.Private.CoreLib/src/System/Int32.cs index 34350997b07d98..34b2ad530f26d6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int32.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int32.cs @@ -29,19 +29,19 @@ public readonly struct Int32 public const int MinValue = unchecked((int)0x80000000); /// Represents the additive identity (0). - public const int AdditiveIdentity = 0; + private const int AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const int MultiplicativeIdentity = 1; + private const int MultiplicativeIdentity = 1; /// Represents the number one (1). - public const int One = 1; + private const int One = 1; /// Represents the number zero (0). - public const int Zero = 0; + private const int Zero = 0; /// Represents the number negative one (-1). - public const int NegativeOne = -1; + private const int NegativeOne = -1; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -312,6 +312,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right); + /// public static int LeadingZeroCount(int value) => BitOperations.LeadingZeroCount((uint)value); @@ -454,21 +457,38 @@ public static int Log2(int value) // INumber // - /// - static int INumber.One => One; - - /// - static int INumber.Zero => Zero; - /// public static int Abs(int value) => Math.Abs(value); /// public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max); - /// + /// + public static int CopySign(int value, int sign) + { + int absValue = value; + + if (absValue < 0) + { + absValue = -absValue; + } + + if (sign >= 0) + { + if (absValue < 0) + { + Math.ThrowNegateTwosCompOverflow(); + } + + return absValue; + } + + return -absValue; + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int Create(TOther value) + public static int CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -683,15 +703,75 @@ public static int CreateTruncating(TOther value) } } - /// - public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right); + /// + public static bool IsNegative(int value) => value < 0; /// public static int Max(int x, int y) => Math.Max(x, y); + /// + public static int MaxMagnitude(int x, int y) + { + int absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return x; + } + } + + int absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return y; + } + } + + return (absX >= absY) ? x : y; + } + /// public static int Min(int x, int y) => Math.Min(x, y); + /// + public static int MinMagnitude(int x, int y) + { + int absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return y; + } + } + + int absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return x; + } + } + + return (absX <= absY) ? x : y; + } + /// public static int Sign(int value) => Math.Sign(value); @@ -843,7 +923,17 @@ public static bool TryCreate(TOther value, out int result) } // - // IParseable + // INumberBase + // + + /// + static int INumberBase.One => One; + + /// + static int INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out int result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -869,13 +959,13 @@ public static bool TryCreate(TOther value, out int result) static int ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static int Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out int result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -904,8 +994,5 @@ public static bool TryCreate(TOther value, out int result) /// static int IUnaryPlusOperators.operator +(int value) => +value; - - // /// - // static int IUnaryPlusOperators.operator checked +(int value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Int64.cs b/src/libraries/System.Private.CoreLib/src/System/Int64.cs index 2ac8381b3c581d..bc8c2f427d0dad 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int64.cs @@ -29,19 +29,19 @@ public readonly struct Int64 public const long MinValue = unchecked((long)0x8000000000000000L); /// Represents the additive identity (0). - public const long AdditiveIdentity = 0; + private const long AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const long MultiplicativeIdentity = 1; + private const long MultiplicativeIdentity = 1; /// Represents the number one (1). - public const long One = 1; + private const long One = 1; /// Represents the number zero (0). - public const long Zero = 0; + private const long Zero = 0; /// Represents the number negative one (-1). - public const long NegativeOne = -1; + private const long NegativeOne = -1; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -299,6 +299,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right); + /// public static long LeadingZeroCount(long value) => BitOperations.LeadingZeroCount((ulong)value); @@ -441,21 +444,38 @@ public static long Log2(long value) // INumber // - /// - static long INumber.One => One; - - /// - static long INumber.Zero => Zero; - /// public static long Abs(long value) => Math.Abs(value); /// public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max); - /// + /// + public static long CopySign(long value, long sign) + { + long absValue = value; + + if (absValue < 0) + { + absValue = -absValue; + } + + if (sign >= 0) + { + if (absValue < 0) + { + Math.ThrowNegateTwosCompOverflow(); + } + + return absValue; + } + + return -absValue; + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static long Create(TOther value) + public static long CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -665,17 +685,77 @@ public static long CreateTruncating(TOther value) } } - /// - public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right); + /// + public static bool IsNegative(long value) => value < 0; /// public static long Max(long x, long y) => Math.Max(x, y); + /// + public static long MaxMagnitude(long x, long y) + { + long absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return x; + } + } + + long absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return y; + } + } + + return (absX >= absY) ? x : y; + } + /// public static long Min(long x, long y) => Math.Min(x, y); + /// + public static long MinMagnitude(long x, long y) + { + long absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return y; + } + } + + long absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return x; + } + } + + return (absX <= absY) ? x : y; + } + /// - public static long Sign(long value) => Math.Sign(value); + public static int Sign(long value) => Math.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -801,7 +881,17 @@ public static bool TryCreate(TOther value, out long result) } // - // IParseable + // INumberBase + // + + /// + static long INumberBase.One => One; + + /// + static long INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out long result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -827,13 +917,13 @@ public static bool TryCreate(TOther value, out long result) static long ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static long Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out long result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -862,8 +952,5 @@ public static bool TryCreate(TOther value, out long result) /// static long IUnaryPlusOperators.operator +(long value) => +value; - - // /// - // static long IUnaryPlusOperators.operator checked +(long value) => checked((long)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs index 3ecc1972c79113..6ccf4aa3e17e00 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IntPtr.cs @@ -284,6 +284,9 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IBinaryInteger // + /// + static (nint Quotient, nint Remainder) IBinaryInteger.DivRem(nint left, nint right) => Math.DivRem(left, right); + /// static nint IBinaryInteger.LeadingZeroCount(nint value) { @@ -474,21 +477,38 @@ static nint IBinaryNumber.Log2(nint value) // INumber // - /// - static nint INumber.One => 1; - - /// - static nint INumber.Zero => 0; - /// static nint INumber.Abs(nint value) => Math.Abs(value); /// static nint INumber.Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max); - /// + /// + static nint INumber.CopySign(nint value, nint sign) + { + nint absValue = value; + + if (absValue < 0) + { + absValue = -absValue; + } + + if (sign >= 0) + { + if (absValue < 0) + { + Math.ThrowNegateTwosCompOverflow(); + } + + return absValue; + } + + return -absValue; + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - static nint INumber.Create(TOther value) + static nint INumber.CreateChecked(TOther value) { if (typeof(TOther) == typeof(byte)) { @@ -698,17 +718,77 @@ static nint INumber.CreateTruncating(TOther value) } } - /// - static (nint Quotient, nint Remainder) INumber.DivRem(nint left, nint right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(nint value) => value < 0; /// static nint INumber.Max(nint x, nint y) => Math.Max(x, y); + /// + static nint INumber.MaxMagnitude(nint x, nint y) + { + nint absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return x; + } + } + + nint absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return y; + } + } + + return (absX >= absY) ? x : y; + } + /// static nint INumber.Min(nint x, nint y) => Math.Min(x, y); + /// + static nint INumber.MinMagnitude(nint x, nint y) + { + nint absX = x; + + if (absX < 0) + { + absX = -absX; + + if (absX < 0) + { + return y; + } + } + + nint absY = y; + + if (absY < 0) + { + absY = -absY; + + if (absY < 0) + { + return x; + } + } + + return (absX <= absY) ? x : y; + } + /// - static nint INumber.Sign(nint value) => Math.Sign(value); + static int INumber.Sign(nint value) => Math.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -848,6 +928,16 @@ static bool INumber.TryCreate(TOther value, out nint result) } } + // + // INumberBase + // + + /// + static nint INumberBase.One => 1; + + /// + static nint INumberBase.Zero => 0; + // // IShiftOperators // @@ -894,8 +984,5 @@ static bool INumber.TryCreate(TOther value, out nint result) /// static nint IUnaryPlusOperators.operator +(nint value) => +value; - - // /// - // static nint IUnaryPlusOperators.operator checked +(nint value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Math.cs b/src/libraries/System.Private.CoreLib/src/System/Math.cs index 52f95fa347057f..94b30445d5fe77 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Math.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Math.cs @@ -61,7 +61,7 @@ public static short Abs(short value) value = (short)-value; if (value < 0) { - ThrowAbsOverflow(); + ThrowNegateTwosCompOverflow(); } } return value; @@ -75,7 +75,7 @@ public static int Abs(int value) value = -value; if (value < 0) { - ThrowAbsOverflow(); + ThrowNegateTwosCompOverflow(); } } return value; @@ -89,7 +89,7 @@ public static long Abs(long value) value = -value; if (value < 0) { - ThrowAbsOverflow(); + ThrowNegateTwosCompOverflow(); } } return value; @@ -106,7 +106,7 @@ public static nint Abs(nint value) value = -value; if (value < 0) { - ThrowAbsOverflow(); + ThrowNegateTwosCompOverflow(); } } return value; @@ -121,7 +121,7 @@ public static sbyte Abs(sbyte value) value = (sbyte)-value; if (value < 0) { - ThrowAbsOverflow(); + ThrowNegateTwosCompOverflow(); } } return value; @@ -155,7 +155,7 @@ public static float Abs(float value) [DoesNotReturn] [StackTraceHidden] - private static void ThrowAbsOverflow() + internal static void ThrowNegateTwosCompOverflow() { throw new OverflowException(SR.Overflow_NegateTwosCompNum); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs b/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs index 408c83cb050585..a1f377bf5fca7b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs @@ -353,7 +353,7 @@ internal static unsafe void DecimalToNumber(ref decimal d, ref NumberBuffer numb { byte* buffer = number.GetDigitsPointer(); number.DigitsCount = DecimalPrecision; - number.IsNegative = d.IsNegative; + number.IsNegative = decimal.IsNegative(d); byte* p = buffer + DecimalPrecision; while ((d.Mid | d.High) != 0) diff --git a/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditionOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditionOperators.cs index 5d071e0368f847..04634e242c7683 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IAdditionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditionOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the sum of two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditiveIdentity.cs similarity index 96% rename from src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditiveIdentity.cs index ae3d10844e34de..1e95b5fb35cc86 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IAdditiveIdentity.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IAdditiveIdentity.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for getting the additive identity of a given type. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryFloatingPointIeee754.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryFloatingPointIeee754.cs new file mode 100644 index 00000000000000..7e6565579d4ff0 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryFloatingPointIeee754.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines an IEEE 754 floating-point type that is represented in a base-2 format. + /// The type that implements the interface. + public interface IBinaryFloatingPointIeee754 + : IBinaryNumber, + IFloatingPointIeee754 + where TSelf : IBinaryFloatingPointIeee754 + { + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IInteger.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryInteger.cs similarity index 82% rename from src/libraries/System.Private.CoreLib/src/System/IInteger.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryInteger.cs index 864de5cf29c9d0..0a552f97523b88 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IInteger.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryInteger.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines an integer type that is represented in a base-2 format. /// The type that implements the interface. @@ -10,6 +10,12 @@ public interface IBinaryInteger IShiftOperators where TSelf : IBinaryInteger { + /// Computes the quotient and remainder of two values. + /// The value which divides. + /// The value which divides . + /// The quotient and remainder of divided-by . + static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right); + /// Computes the number of leading zeros in a value. /// The value whose leading zeroes are to be counted. /// The number of leading zeros in . diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryNumber.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryNumber.cs new file mode 100644 index 00000000000000..154a7f585698df --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBinaryNumber.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines a number that is represented in a base-2 format. + /// The type that implements the interface. + public interface IBinaryNumber + : IBitwiseOperators, + INumber + where TSelf : IBinaryNumber + { + /// Determines if a value is a power of two. + /// The value to be checked. + /// true if is a power of two; otherwise, false. + static abstract bool IsPow2(TSelf value); + + /// Computes the log2 of a value. + /// The value whose log2 is to be computed. + /// The log2 of . + static abstract TSelf Log2(TSelf value); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBitwiseOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IBitwiseOperators.cs index 13f34859e68738..15a7aa311f6427 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IBitwiseOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IBitwiseOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for performing bitwise operations over two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IComparisonOperators.cs similarity index 99% rename from src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IComparisonOperators.cs index 448b15c1dea46d..14cd3acddc9f72 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IComparisonOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IComparisonOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for comparing two values to determine relative order. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IDecrementOperators.cs similarity index 97% rename from src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IDecrementOperators.cs index 662e8cf14482ab..2071c47886bf46 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IDecrementOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IDecrementOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for decrementing a given value. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IDivisionOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IDivisionOperators.cs index 88c5429856c5db..bd5f8d8c8618c8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IDivisionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IDivisionOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the quotient of two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IEqualityOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IEqualityOperators.cs index ea21ca511fd5f9..31c4a466191571 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IEqualityOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IEqualityOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for comparing two values to determine equality. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IExponentialFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IExponentialFunctions.cs new file mode 100644 index 00000000000000..122fc8626e200b --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IExponentialFunctions.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for exponential functions. + /// The type that implements this interface. + public interface IExponentialFunctions + where TSelf : IExponentialFunctions + { + /// Computes E raised to a given power. + /// The power to which E is raised. + /// E raised to the power of . + static abstract TSelf Exp(TSelf x); + + // The following methods are approved but not yet implemented in the libraries + // * static abstract TSelf ExpM1(TSelf x); + // * static abstract TSelf Exp2(TSelf x); + // * static abstract TSelf Exp2M1(TSelf x); + // * static abstract TSelf Exp10(TSelf x); + // * static abstract TSelf Exp10M1(TSelf x); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPoint.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPoint.cs new file mode 100644 index 00000000000000..e9d13e9252e40e --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPoint.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines a floating-point type. + /// The type that implements the interface. + public interface IFloatingPoint + : INumber, + ISignedNumber + where TSelf : IFloatingPoint + { + /// Computes the ceiling of a value. + /// The value whose ceiling is to be computed. + /// The ceiling of . + static abstract TSelf Ceiling(TSelf x); + + /// Computes the floor of a value. + /// The value whose floor is to be computed. + /// The floor of . + static abstract TSelf Floor(TSelf x); + + /// Rounds a value to the nearest integer using the default rounding mode (). + /// The value to round. + /// The result of rounding to the nearest integer using the default rounding mode. + static abstract TSelf Round(TSelf x); + + /// Rounds a value to a specified number of fractional-digits using the default rounding mode (). + /// The value to round. + /// The number of fractional digits to which should be rounded. + /// The result of rounding to fractional-digits using the default rounding mode. + static abstract TSelf Round(TSelf x, int digits); + + /// Rounds a value to the nearest integer using the specified rounding mode. + /// The value to round. + /// The mode under which should be rounded. + /// The result of rounding to the nearest integer using . + static abstract TSelf Round(TSelf x, MidpointRounding mode); + + /// Rounds a value to a specified number of fractional-digits using the default rounding mode (). + /// The value to round. + /// The number of fractional digits to which should be rounded. + /// The mode under which should be rounded. + /// The result of rounding to fractional-digits using . + static abstract TSelf Round(TSelf x, int digits, MidpointRounding mode); + + /// Truncates a value. + /// The value to truncate. + /// The truncation of . + static abstract TSelf Truncate(TSelf x); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPointIeee754.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPointIeee754.cs new file mode 100644 index 00000000000000..4f8a42dbc06215 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IFloatingPointIeee754.cs @@ -0,0 +1,128 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines an IEEE 754 floating-point type. + /// The type that implements the interface. + public interface IFloatingPointIeee754 + : IExponentialFunctions, + IFloatingPoint, + IHyperbolicFunctions, + ILogarithmicFunctions, + IPowerFunctions, + IRootFunctions, + ITrigonometricFunctions + where TSelf : IFloatingPointIeee754 + { + /// Gets the mathematical constant e. + static abstract TSelf E { get; } + + /// Gets the smallest value such that can be added to 0 that does not result in 0. + static abstract TSelf Epsilon { get; } + + /// Gets a value that represents NaN. + static abstract TSelf NaN { get; } + + /// Gets a value that represents negative infinity. + static abstract TSelf NegativeInfinity { get; } + + /// Gets a value that represents negative zero. + static abstract TSelf NegativeZero { get; } + + /// Gets the mathematical constant pi. + static abstract TSelf Pi { get; } + + /// Gets a value that represents positive infinity. + static abstract TSelf PositiveInfinity { get; } + + /// Gets the mathematical constant tau. + static abstract TSelf Tau { get; } + + /// Decrements a value to the smallest value that compares less than a given value. + /// The value to be bitwise decremented. + /// The smallest value that compares less than . + static abstract TSelf BitDecrement(TSelf x); + + /// Increments a value to the smallest value that compares greater than a given value. + /// The value to be bitwise incremented. + /// The smallest value that compares greater than . + static abstract TSelf BitIncrement(TSelf x); + + /// Computes the fused multiply-add of three values. + /// The value which multiplies. + /// The value which multiplies . + /// The value that is added to the product of and . + /// The result of times plus computed as one ternary operation. + static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend); + + /// Computes the remainder of two values as specified by IEEE 754. + /// The value which divides. + /// The value which divides . + /// The remainder of divided-by as specified by IEEE 754. + static abstract TSelf Ieee754Remainder(TSelf left, TSelf right); + + /// Computes the integer logarithm of a value. + /// The value whose integer logarithm is to be computed. + /// The integer logarithm of . + static abstract int ILogB(TSelf x); + + /// Determines if a value is finite. + /// The value to be checked. + /// true if is finite; otherwise, false. + static abstract bool IsFinite(TSelf value); + + /// Determines if a value is infinite. + /// The value to be checked. + /// true if is infinite; otherwise, false. + static abstract bool IsInfinity(TSelf value); + + /// Determines if a value is NaN. + /// The value to be checked. + /// true if is NaN; otherwise, false. + static abstract bool IsNaN(TSelf value); + + /// Determines if a value is negative infinity. + /// The value to be checked. + /// true if is negative infinity; otherwise, false. + static abstract bool IsNegativeInfinity(TSelf value); + + /// Determines if a value is normal. + /// The value to be checked. + /// true if is normal; otherwise, false. + static abstract bool IsNormal(TSelf value); + + /// Determines if a value is positive infinity. + /// The value to be checked. + /// true if is positive infinity; otherwise, false. + static abstract bool IsPositiveInfinity(TSelf value); + + /// Determines if a value is subnormal. + /// The value to be checked. + /// true if is subnormal; otherwise, false. + static abstract bool IsSubnormal(TSelf value); + + /// Computes an estimate of the reciprocal of a value. + /// The value whose estimate of the reciprocal is to be computed. + /// An estimate of the reciprocal of . + static abstract TSelf ReciprocalEstimate(TSelf x); + + /// Computes an estimate of the reciprocal square root of a value. + /// The value whose estimate of the reciprocal square root is to be computed. + /// An estimate of the reciprocal square root of . + static abstract TSelf ReciprocalSqrtEstimate(TSelf x); + + /// Computes the product of a value and its base-radix raised to the specified power. + /// The value which base-radix raised to the power of multiplies. + /// The value to which base-radix is raised before multipliying . + /// The product of and base-radix raised to the power of . + static abstract TSelf ScaleB(TSelf x, int n); + + // The following methods are approved but not yet implemented in the libraries + // * static abstract TSelf Compound(TSelf x, TSelf n); + // * static abstract TSelf MaxMagnitudeNumber(TSelf x, TSelf y); + // * static abstract TSelf MaxNumber(TSelf x, TSelf y); + // * static abstract TSelf MinMagnitudeNumber(TSelf x, TSelf y); + // * static abstract TSelf MinNumber(TSelf x, TSelf y); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IHyperbolicFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IHyperbolicFunctions.cs new file mode 100644 index 00000000000000..d4b8f4a0115626 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IHyperbolicFunctions.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for hyperbolic functions. + /// The type that implements this interface. + public interface IHyperbolicFunctions + where TSelf : IHyperbolicFunctions + { + /// Computes the hyperbolic arc-cosine of a value. + /// The value, in radians, whose hyperbolic arc-cosine is to be computed. + /// The hyperbolic arc-cosine of . + static abstract TSelf Acosh(TSelf x); + + /// Computes the hyperbolic arc-sine of a value. + /// The value, in radians, whose hyperbolic arc-sine is to be computed. + /// The hyperbolic arc-sine of . + static abstract TSelf Asinh(TSelf x); + + /// Computes the hyperbolic arc-tangent of a value. + /// The value, in radians, whose hyperbolic arc-tangent is to be computed. + /// The hyperbolic arc-tangent of . + static abstract TSelf Atanh(TSelf x); + + /// Computes the hyperbolic cosine of a value. + /// The value, in radians, whose hyperbolic cosine is to be computed. + /// The hyperbolic cosine of . + static abstract TSelf Cosh(TSelf x); + + /// Computes the hyperbolic sine of a value. + /// The value, in radians, whose hyperbolic sine is to be computed. + /// The hyperbolic sine of . + static abstract TSelf Sinh(TSelf x); + + /// Computes the hyperbolic tangent of a value. + /// The value, in radians, whose hyperbolic tangent is to be computed. + /// The hyperbolic tangent of . + static abstract TSelf Tanh(TSelf x); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IIncrementOperators.cs similarity index 97% rename from src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IIncrementOperators.cs index cc1875e964715a..aec1348c0a9c9e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IIncrementOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IIncrementOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for incrementing a given value. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/ILogarithmicFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/ILogarithmicFunctions.cs new file mode 100644 index 00000000000000..1dd07003948c5e --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/ILogarithmicFunctions.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for logarithmic functions. + /// The type that implements this interface. + public interface ILogarithmicFunctions + where TSelf : ILogarithmicFunctions + { + /// Computes the natural (base-E logarithm of a value. + /// The value whose natural logarithm is to be computed. + /// The natural logarithm of . + static abstract TSelf Log(TSelf x); + + /// Computes the logarithm of a value in the specified base. + /// The value whose logarithm is to be computed. + /// The base in which the logarithm is to be computed. + /// The base- logarithm of . + static abstract TSelf Log(TSelf x, TSelf newBase); + + /// Computes the base-2 logarithm of a value. + /// The value whose base-2 logarithm is to be computed. + /// The base-2 logarithm of . + static abstract TSelf Log2(TSelf x); + + /// Computes the base-10 logarithm of a value. + /// The value whose base-10 logarithm is to be computed. + /// The base-10 logarithm of . + static abstract TSelf Log10(TSelf x); + + // The following methods are approved but not yet implemented in the libraries + // * static abstract TSelf LogP1(TSelf x); + // * static abstract TSelf Log2P1(TSelf x); + // * static abstract TSelf Log10P1(TSelf x); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMinMaxValue.cs similarity index 96% rename from src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IMinMaxValue.cs index 6eac482758dfee..fe424d1aa6733f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMinMaxValue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMinMaxValue.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for getting the minimum and maximum value of a type. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IModulusOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IModulusOperators.cs index 1c6a97f7bccb19..fae966ef0be180 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IModulusOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IModulusOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the modulus or remainder of two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplicativeIdentity.cs similarity index 96% rename from src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplicativeIdentity.cs index 1544db69780736..fa087d0d8a967b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMultiplicativeIdentity.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplicativeIdentity.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for getting the multiplicative identity of a given type. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplyOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplyOperators.cs index 5b5cafe4c38a5f..97efb32b55445c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IMultiplyOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IMultiplyOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the product of two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/INumber.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/INumber.cs similarity index 76% rename from src/libraries/System.Private.CoreLib/src/System/INumber.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/INumber.cs index 6cc7d90595ef26..fd6748e0fdf403 100644 --- a/src/libraries/System.Private.CoreLib/src/System/INumber.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/INumber.cs @@ -4,33 +4,17 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; -namespace System +namespace System.Numerics { /// Defines a number type. /// The type that implements the interface. public interface INumber - : IAdditionOperators, - IAdditiveIdentity, - IComparisonOperators, // implies IEquatableOperators - IDecrementOperators, - IDivisionOperators, - IIncrementOperators, + : IComparisonOperators, // implies IEqualityOperators IModulusOperators, - IMultiplicativeIdentity, - IMultiplyOperators, - ISpanFormattable, // implies IFormattable - ISpanParseable, // implies IParseable - ISubtractionOperators, - IUnaryNegationOperators, - IUnaryPlusOperators + INumberBase, + ISpanParsable // implies IParsable where TSelf : INumber { - /// Gets the value 1 for the type. - static abstract TSelf One { get; } - - /// Gets the value 0 for the type. - static abstract TSelf Zero { get; } - /// Computes the absolute of a value. /// The value for which to get its absolute. /// The absolute of . @@ -45,13 +29,19 @@ public interface INumber /// is greater than . static abstract TSelf Clamp(TSelf value, TSelf min, TSelf max); - /// Creates an instance of the current type from a value. + /// Copies the sign of a value to the sign of another value.. + /// The value whose magnitude is used in the result. + /// The value whose sign is used in the result. + /// A value with the magnitude of and the sign of . + static abstract TSelf CopySign(TSelf value, TSelf sign); + + /// Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type. /// The type of . /// The value which is used to create the instance of . /// An instance of created from . /// is not supported. /// is not representable by . - static abstract TSelf Create(TOther value) + static abstract TSelf CreateChecked(TOther value) where TOther : INumber; /// Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type. @@ -70,11 +60,10 @@ static abstract TSelf CreateSaturating(TOther value) static abstract TSelf CreateTruncating(TOther value) where TOther : INumber; - /// Computes the quotient and remainder of two values. - /// The value which divides. - /// The value which divides . - /// The quotient and remainder of divided-by . - static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right); + /// Determines if a value is negative. + /// The value to be checked. + /// true if is negative; otherwise, false. + static abstract bool IsNegative(TSelf value); /// Compares two values to compute which is greater. /// The value to compare with . @@ -83,6 +72,13 @@ static abstract TSelf CreateTruncating(TOther value) /// For this method matches the IEEE 754:2019 maximum function. This requires NaN inputs to be propagated back to the caller and for -0.0 to be treated as less than +0.0. static abstract TSelf Max(TSelf x, TSelf y); + /// Compares two values to compute which is greater. + /// The value to compare with . + /// The value to compare with . + /// if it is greater than ; otherwise, . + /// For this method matches the IEEE 754:2019 maximumMagnitude function. This requires NaN inputs to not be propagated back to the caller and for -0.0 to be treated as less than +0.0. + static abstract TSelf MaxMagnitude(TSelf x, TSelf y); + /// Compares two values to compute which is lesser. /// The value to compare with . /// The value to compare with . @@ -90,6 +86,13 @@ static abstract TSelf CreateTruncating(TOther value) /// For this method matches the IEEE 754:2019 minimum function. This requires NaN inputs to be propagated back to the caller and for -0.0 to be treated as less than +0.0. static abstract TSelf Min(TSelf x, TSelf y); + /// Compares two values to compute which is lesser. + /// The value to compare with . + /// The value to compare with . + /// if it is less than ; otherwise, . + /// For this method matches the IEEE 754:2019 minimumMagnitude function. This requires NaN inputs to not be propagated back to the caller and for -0.0 to be treated as less than +0.0. + static abstract TSelf MinMagnitude(TSelf x, TSelf y); + /// Parses a string into a value. /// The string to parse. /// A bitwise combination of number styles that can be present in . @@ -113,9 +116,9 @@ static abstract TSelf CreateTruncating(TOther value) /// Computes the sign of a value. /// The value whose sign is to be computed. - /// A positive value if is positive, if is zero, and a negative value if is negative. + /// A positive value if is positive, if is zero, and a negative value if is negative. /// It is recommended that a function return 1, 0, and -1, respectively. - static abstract TSelf Sign(TSelf value); + static abstract int Sign(TSelf value); /// Tries to create an instance of the current type from a value. /// The type of . @@ -144,40 +147,4 @@ static abstract bool TryCreate(TOther value, out TSelf result) /// is not a supported value. static abstract bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider? provider, out TSelf result); } - - /// Defines a number that is represented in a base-2 format. - /// The type that implements the interface. - public interface IBinaryNumber - : IBitwiseOperators, - INumber - where TSelf : IBinaryNumber - { - /// Determines if a value is a power of two. - /// The value to be checked. - /// true if is a power of two; otherwise, false. - static abstract bool IsPow2(TSelf value); - - /// Computes the log2 of a value. - /// The value whose log2 is to be computed. - /// The log2 of . - static abstract TSelf Log2(TSelf value); - } - - /// Defines a number type which can represent both positive and negative values. - /// The type that implements the interface. - public interface ISignedNumber - : INumber - where TSelf : ISignedNumber - { - /// Gets the value -1 for the type. - static abstract TSelf NegativeOne { get; } - } - - /// Defines a number type which can only represent positive values, that is it cannot represent negative values. - /// The type that implements the interface. - public interface IUnsignedNumber - : INumber - where TSelf : IUnsignedNumber - { - } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/INumberBase.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/INumberBase.cs new file mode 100644 index 00000000000000..c214ca0d7cce3b --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/INumberBase.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines the base of other number types. + /// The type that implements the interface. + public interface INumberBase + : IAdditionOperators, + IAdditiveIdentity, + IDecrementOperators, + IDivisionOperators, + IEqualityOperators, // implies IEquatable + IIncrementOperators, + IMultiplicativeIdentity, + IMultiplyOperators, + ISpanFormattable, // implies IFormattable + ISubtractionOperators, + IUnaryPlusOperators, + IUnaryNegationOperators + where TSelf : INumberBase + { + /// Gets the value 1 for the type. + static abstract TSelf One { get; } + + /// Gets the value 0 for the type. + static abstract TSelf Zero { get; } + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IPowerFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IPowerFunctions.cs new file mode 100644 index 00000000000000..5b31fa9e5f49ab --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IPowerFunctions.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for power functions. + /// The type that implements this interface. + public interface IPowerFunctions + where TSelf : IPowerFunctions + { + /// Computes a value raised to a given power. + /// The value which is raised to the power of . + /// The power to which is raised. + /// raised to the power of . + static abstract TSelf Pow(TSelf x, TSelf y); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IRootFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IRootFunctions.cs new file mode 100644 index 00000000000000..7a84aefcba7edb --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IRootFunctions.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for root functions. + /// The type that implements this interface. + public interface IRootFunctions + where TSelf : IRootFunctions + { + /// Computes the cube-root of a value. + /// The value whose cube-root is to be computed. + /// The cube-root of . + static abstract TSelf Cbrt(TSelf x); + + /// Computes the square-root of a value. + /// The value whose square-root is to be computed. + /// The square-root of . + static abstract TSelf Sqrt(TSelf x); + + // The following methods are approved but not yet implemented in the libraries + // * static abstract TSelf Hypot(TSelf x, TSelf y); + // * static abstract TSelf Root(TSelf x, TSelf n); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IShiftOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IShiftOperators.cs index ed3f7a1cf61077..f7994afa139e61 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IShiftOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IShiftOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for shifting a value by another value. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/ISignedNumber.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/ISignedNumber.cs new file mode 100644 index 00000000000000..45759c01b3d42f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/ISignedNumber.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines a number type which can represent both positive and negative values. + /// The type that implements the interface. + public interface ISignedNumber + where TSelf : INumberBase, ISignedNumber + { + /// Gets the value -1 for the type. + static abstract TSelf NegativeOne { get; } + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/ISubtractionOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/ISubtractionOperators.cs index e1af6c97826f78..488b164d462a22 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ISubtractionOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/ISubtractionOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the difference of two values. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/ITrigonometricFunctions.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/ITrigonometricFunctions.cs new file mode 100644 index 00000000000000..734d5554d6edc8 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/ITrigonometricFunctions.cs @@ -0,0 +1,61 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines support for trigonometric functions. + /// The type that implements this interface. + public interface ITrigonometricFunctions + where TSelf : ITrigonometricFunctions + { + /// Computes the arc-cosine of a value. + /// The value, in radians, whose arc-cosine is to be computed. + /// The arc-cosine of . + static abstract TSelf Acos(TSelf x); + + /// Computes the arc-sine of a value. + /// The value, in radians, whose arc-sine is to be computed. + /// The arc-sine of . + static abstract TSelf Asin(TSelf x); + + /// Computes the arc-tangent of a value. + /// The value, in radians, whose arc-tangent is to be computed. + /// The arc-tangent of . + static abstract TSelf Atan(TSelf x); + + /// Computes the arc-tangent of the quotient of two values. + /// The y-coordinate of a point. + /// The x-coordinate of a point. + /// The arc-tangent of divided-by . + static abstract TSelf Atan2(TSelf y, TSelf x); + + /// Computes the cosine of a value. + /// The value, in radians, whose cosine is to be computed. + /// The cosine of . + static abstract TSelf Cos(TSelf x); + + /// Computes the sine of a value. + /// The value, in radians, whose sine is to be computed. + /// The sine of . + static abstract TSelf Sin(TSelf x); + + /// Computes the sine and cosine of a value. + /// The value, in radians, whose sine and cosine are to be computed. + /// The sine and cosine of . + static abstract (TSelf Sin, TSelf Cos) SinCos(TSelf x); + + /// Computes the tangent of a value. + /// The value, in radians, whose tangent is to be computed. + /// The tangent of . + static abstract TSelf Tan(TSelf x); + + // The following methods are approved but not yet implemented in the libraries + // * static abstract TSelf AcosPi(TSelf x); + // * static abstract TSelf AsinPi(TSelf x); + // * static abstract TSelf AtanPi(TSelf x); + // * static abstract TSelf Atan2Pi(TSelf y, TSelf x); + // * static abstract TSelf CosPi(TSelf x); + // * static abstract TSelf SinPi(TSelf x); + // * static abstract TSelf TanPi(TSelf x); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryNegationOperators.cs similarity index 98% rename from src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryNegationOperators.cs index 1a8c756b57ccd8..fb34b44c20e0eb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IUnaryNegationOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryNegationOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the unary negation of a value. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryPlusOperators.cs similarity index 97% rename from src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs rename to src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryPlusOperators.cs index 02dcfd19c58890..916c5f13fc5b19 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IUnaryPlusOperators.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnaryPlusOperators.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace System +namespace System.Numerics { /// Defines a mechanism for computing the unary plus of a value. /// The type that implements this interface. diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnsignedNumber.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnsignedNumber.cs new file mode 100644 index 00000000000000..4bafb9fd3fdd4f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/IUnsignedNumber.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Numerics +{ + /// Defines a number type which can only represent positive values, that is it cannot represent negative values. + /// The type that implements the interface. + public interface IUnsignedNumber + where TSelf : INumberBase, IUnsignedNumber + { + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System/SByte.cs b/src/libraries/System.Private.CoreLib/src/System/SByte.cs index 5d16e1be4f73e4..a8f6b357e521d9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SByte.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SByte.cs @@ -33,19 +33,19 @@ public readonly struct SByte public const sbyte MinValue = unchecked((sbyte)0x80); /// Represents the additive identity (0). - public const sbyte AdditiveIdentity = 0; + private const sbyte AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const sbyte MultiplicativeIdentity = 1; + private const sbyte MultiplicativeIdentity = 1; /// Represents the number one (1). - public const sbyte One = 1; + private const sbyte One = 1; /// Represents the number zero (0). - public const sbyte Zero = 0; + private const sbyte Zero = 0; /// Represents the number negative one (-1). - public const sbyte NegativeOne = -1; + private const sbyte NegativeOne = -1; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -328,6 +328,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right); + /// public static sbyte LeadingZeroCount(sbyte value) => (sbyte)(BitOperations.LeadingZeroCount((byte)value) - 24); @@ -470,21 +473,38 @@ public static sbyte Log2(sbyte value) // INumber // - /// - static sbyte INumber.One => One; - - /// - static sbyte INumber.Zero => Zero; - /// public static sbyte Abs(sbyte value) => Math.Abs(value); /// public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max); - /// + /// + public static sbyte CopySign(sbyte value, sbyte sign) + { + sbyte absValue = value; + + if (absValue < 0) + { + absValue = (sbyte)(-absValue); + } + + if (sign >= 0) + { + if (absValue < 0) + { + Math.ThrowNegateTwosCompOverflow(); + } + + return absValue; + } + + return (sbyte)(-absValue); + } + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static sbyte Create(TOther value) + public static sbyte CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -706,17 +726,77 @@ public static sbyte CreateTruncating(TOther value) } } - /// - public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right); + /// + public static bool IsNegative(sbyte value) => value < 0; /// public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y); + /// + public static sbyte MaxMagnitude(sbyte x, sbyte y) + { + sbyte absX = x; + + if (absX < 0) + { + absX = (sbyte)(-absX); + + if (absX < 0) + { + return x; + } + } + + sbyte absY = y; + + if (absY < 0) + { + absY = (sbyte)(-absY); + + if (absY < 0) + { + return y; + } + } + + return (absX >= absY) ? x : y; + } + /// public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y); + /// + public static sbyte MinMagnitude(sbyte x, sbyte y) + { + sbyte absX = x; + + if (absX < 0) + { + absX = (sbyte)(-absX); + + if (absX < 0) + { + return y; + } + } + + sbyte absY = y; + + if (absY < 0) + { + absY = (sbyte)(-absY); + + if (absY < 0) + { + return x; + } + } + + return (absX <= absY) ? x : y; + } + /// - public static sbyte Sign(sbyte value) => (sbyte)Math.Sign(value); + public static int Sign(sbyte value) => Math.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -906,7 +986,17 @@ public static bool TryCreate(TOther value, out sbyte result) } // - // IParseable + // INumberBase + // + + /// + static sbyte INumberBase.One => One; + + /// + static sbyte INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out sbyte result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -932,13 +1022,13 @@ public static bool TryCreate(TOther value, out sbyte result) static sbyte ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static sbyte Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out sbyte result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -967,8 +1057,5 @@ public static bool TryCreate(TOther value, out sbyte result) /// static sbyte IUnaryPlusOperators.operator +(sbyte value) => (sbyte)(+value); - - // /// - // static sbyte IUnaryPlusOperators.operator checked +(sbyte value) => checked((sbyte)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Single.cs b/src/libraries/System.Private.CoreLib/src/System/Single.cs index f241dbd1b07550..c1b7c7968e0583 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Single.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Single.cs @@ -12,6 +12,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -27,7 +28,7 @@ public readonly struct Single ISpanFormattable, IComparable, IEquatable, - IBinaryFloatingPoint, + IBinaryFloatingPointIeee754, IMinMaxValue { private readonly float m_value; // Do not rename (binary serialization) @@ -46,19 +47,19 @@ public readonly struct Single public const float NaN = (float)0.0 / (float)0.0; /// Represents the additive identity (0). - public const float AdditiveIdentity = 0.0f; + private const float AdditiveIdentity = 0.0f; /// Represents the multiplicative identity (1). - public const float MultiplicativeIdentity = 1.0f; + private const float MultiplicativeIdentity = 1.0f; /// Represents the number one (1). - public const float One = 1.0f; + private const float One = 1.0f; /// Represents the number zero (0). - public const float Zero = 0.0f; + private const float Zero = 0.0f; /// Represents the number negative one (-1). - public const float NegativeOne = -1.0f; + private const float NegativeOne = -1.0f; /// Represents the number negative zero (-0). public const float NegativeZero = -0.0f; @@ -568,219 +569,140 @@ public static bool IsPow2(float value) // static float IDivisionOperators.operator checked /(float left, float right) => checked(left / right); // - // IFloatingPoint + // IExponentialFunctions // - /// - static float IFloatingPoint.E => E; - - /// - static float IFloatingPoint.Epsilon => Epsilon; - - /// - static float IFloatingPoint.NaN => NaN; - - /// - static float IFloatingPoint.NegativeInfinity => NegativeInfinity; - - /// - static float IFloatingPoint.NegativeZero => NegativeZero; - - /// - static float IFloatingPoint.Pi => Pi; - - /// - static float IFloatingPoint.PositiveInfinity => PositiveInfinity; - - /// - static float IFloatingPoint.Tau => Tau; - - /// - public static float Acos(float x) => MathF.Acos(x); - - /// - public static float Acosh(float x) => MathF.Acosh(x); - - /// - public static float Asin(float x) => MathF.Asin(x); - - /// - public static float Asinh(float x) => MathF.Asinh(x); + /// + public static float Exp(float x) => MathF.Exp(x); - /// - public static float Atan(float x) => MathF.Atan(x); + // /// + // public static float ExpM1(float x) => MathF.ExpM1(x); - /// - public static float Atan2(float y, float x) => MathF.Atan2(y, x); + // /// + // public static float Exp2(float x) => MathF.Exp2(x); - /// - public static float Atanh(float x) => MathF.Atanh(x); + // /// + // public static float Exp2M1(float x) => MathF.Exp2M1(x); - /// - public static float BitIncrement(float x) => MathF.BitIncrement(x); + // /// + // public static float Exp10(float x) => MathF.Exp10(x); - /// - public static float BitDecrement(float x) => MathF.BitDecrement(x); + // /// + // public static float Exp10M1(float x) => MathF.Exp10M1(x); - /// - public static float Cbrt(float x) => MathF.Cbrt(x); + // + // IFloatingPoint + // /// public static float Ceiling(float x) => MathF.Ceiling(x); - /// - public static float CopySign(float x, float y) => MathF.CopySign(x, y); - - /// - public static float Cos(float x) => MathF.Cos(x); - - /// - public static float Cosh(float x) => MathF.Cosh(x); - - /// - public static float Exp(float x) => MathF.Exp(x); - /// public static float Floor(float x) => MathF.Floor(x); - /// - public static float FusedMultiplyAdd(float left, float right, float addend) => MathF.FusedMultiplyAdd(left, right, addend); - - /// - public static float IEEERemainder(float left, float right) => MathF.IEEERemainder(left, right); - - /// - public static TInteger ILogB(float x) - where TInteger : IBinaryInteger => TInteger.Create(MathF.ILogB(x)); - - /// - public static float Log(float x) => MathF.Log(x); - - /// - public static float Log(float x, float newBase) => MathF.Log(x, newBase); - - /// - public static float Log10(float x) => MathF.Log10(x); - - /// - public static float MaxMagnitude(float x, float y) => MathF.MaxMagnitude(x, y); - - /// - public static float MinMagnitude(float x, float y) => MathF.MinMagnitude(x, y); - - /// - public static float Pow(float x, float y) => MathF.Pow(x, y); - - /// - public static float ReciprocalEstimate(float x) => MathF.ReciprocalEstimate(x); - - /// - public static float ReciprocalSqrtEstimate(float x) => MathF.ReciprocalSqrtEstimate(x); - /// public static float Round(float x) => MathF.Round(x); - /// - public static float Round(float x, TInteger digits) - where TInteger : IBinaryInteger => MathF.Round(x, int.Create(digits)); + /// + public static float Round(float x, int digits) => MathF.Round(x, digits); /// public static float Round(float x, MidpointRounding mode) => MathF.Round(x, mode); - /// - public static float Round(float x, TInteger digits, MidpointRounding mode) - where TInteger : IBinaryInteger => MathF.Round(x, int.Create(digits), mode); + /// + public static float Round(float x, int digits, MidpointRounding mode) => MathF.Round(x, digits, mode); - /// - public static float ScaleB(float x, TInteger n) - where TInteger : IBinaryInteger => MathF.ScaleB(x, int.Create(n)); + /// + public static float Truncate(float x) => MathF.Truncate(x); - /// - public static float Sin(float x) => MathF.Sin(x); + // + // IFloatingPointIeee754 + // - /// - public static (float Sin, float Cos) SinCos(float x) => MathF.SinCos(x); + /// + static float IFloatingPointIeee754.E => E; - /// - public static float Sinh(float x) => MathF.Sinh(x); + /// + static float IFloatingPointIeee754.Epsilon => Epsilon; - /// - public static float Sqrt(float x) => MathF.Sqrt(x); + /// + static float IFloatingPointIeee754.NaN => NaN; - /// - public static float Tan(float x) => MathF.Tan(x); + /// + static float IFloatingPointIeee754.NegativeInfinity => NegativeInfinity; - /// - public static float Tanh(float x) => MathF.Tanh(x); + /// + static float IFloatingPointIeee754.NegativeZero => NegativeZero; - /// - public static float Truncate(float x) => MathF.Truncate(x); + /// + static float IFloatingPointIeee754.Pi => Pi; - // /// - // public static float AcosPi(float x) => MathF.AcosPi(x); + /// + static float IFloatingPointIeee754.PositiveInfinity => PositiveInfinity; - // /// - // public static float AsinPi(float x) => MathF.AsinPi(x); - - // /// - // public static float AtanPi(float x) => MathF.AtanPi(x); - - // /// - // public static float Atan2Pi(float y, float x) => MathF.Atan2Pi(y, x); - - // /// - // public static float Compound(float x, float n) => MathF.Compound(x, n); - - // /// - // public static float CosPi(float x) => MathF.CosPi(x); + /// + static float IFloatingPointIeee754.Tau => Tau; - // /// - // public static float ExpM1(float x) => MathF.ExpM1(x); + /// + public static float BitDecrement(float x) => MathF.BitDecrement(x); - // /// - // public static float Exp2(float x) => MathF.Exp2(x); + /// + public static float BitIncrement(float x) => MathF.BitIncrement(x); - // /// - // public static float Exp2M1(float x) => MathF.Exp2M1(x); + /// + public static float FusedMultiplyAdd(float left, float right, float addend) => MathF.FusedMultiplyAdd(left, right, addend); - // /// - // public static float Exp10(float x) => MathF.Exp10(x); + /// + public static float Ieee754Remainder(float left, float right) => MathF.IEEERemainder(left, right); - // /// - // public static float Exp10M1(float x) => MathF.Exp10M1(x); + /// + public static int ILogB(float x) => MathF.ILogB(x); - // /// - // public static float Hypot(float x, float y) => MathF.Hypot(x, y); + /// + public static float ReciprocalEstimate(float x) => MathF.ReciprocalEstimate(x); - // /// - // public static float LogP1(float x) => MathF.LogP1(x); + /// + public static float ReciprocalSqrtEstimate(float x) => MathF.ReciprocalSqrtEstimate(x); - // /// - // public static float Log2P1(float x) => MathF.Log2P1(x); + /// + public static float ScaleB(float x, int n) => MathF.ScaleB(x, n); - // /// - // public static float Log10P1(float x) => MathF.Log10P1(x); + // /// + // public static float Compound(float x, float n) => MathF.Compound(x, n); - // /// + // /// // public static float MaxMagnitudeNumber(float x, float y) => MathF.MaxMagnitudeNumber(x, y); - // /// + // /// // public static float MaxNumber(float x, float y) => MathF.MaxNumber(x, y); - // /// + // /// // public static float MinMagnitudeNumber(float x, float y) => MathF.MinMagnitudeNumber(x, y); - // /// + // /// // public static float MinNumber(float x, float y) => MathF.MinNumber(x, y); - // /// - // public static float Root(float x, float n) => MathF.Root(x, n); + // + // IHyperbolicFunctions + // - // /// - // public static float SinPi(float x) => MathF.SinPi(x, y); + /// + public static float Acosh(float x) => MathF.Acosh(x); - // /// - // public static float TanPi(float x) => MathF.TanPi(x, y); + /// + public static float Asinh(float x) => MathF.Asinh(x); + + /// + public static float Atanh(float x) => MathF.Atanh(x); + + /// + public static float Cosh(float x) => MathF.Cosh(x); + + /// + public static float Sinh(float x) => MathF.Sinh(x); + + /// + public static float Tanh(float x) => MathF.Tanh(x); // // IIncrementOperators @@ -792,6 +714,28 @@ public static float ScaleB(float x, TInteger n) // /// // static float IIncrementOperators.operator checked ++(float value) => checked(++value); + // + // ILogarithmicFunctions + // + + /// + public static float Log(float x) => MathF.Log(x); + + /// + public static float Log(float x, float newBase) => MathF.Log(x, newBase); + + /// + public static float Log10(float x) => MathF.Log10(x); + + // /// + // public static float LogP1(float x) => MathF.LogP1(x); + + // /// + // public static float Log2P1(float x) => MathF.Log2P1(x); + + // /// + // public static float Log10P1(float x) => MathF.Log10P1(x); + // // IMinMaxValue // @@ -832,21 +776,18 @@ public static float ScaleB(float x, TInteger n) // INumber // - /// - static float INumber.One => One; - - /// - static float INumber.Zero => Zero; - /// public static float Abs(float value) => MathF.Abs(value); /// public static float Clamp(float value, float min, float max) => Math.Clamp(value, min, max); - /// + /// + public static float CopySign(float x, float y) => MathF.CopySign(x, y); + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Create(TOther value) + public static float CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -1048,17 +989,20 @@ public static float CreateTruncating(TOther value) } } - /// - public static (float Quotient, float Remainder) DivRem(float left, float right) => (left / right, left % right); - /// public static float Max(float x, float y) => MathF.Max(x, y); + /// + public static float MaxMagnitude(float x, float y) => MathF.MaxMagnitude(x, y); + /// public static float Min(float x, float y) => MathF.Min(x, y); + /// + public static float MinMagnitude(float x, float y) => MathF.MinMagnitude(x, y); + /// - public static float Sign(float value) => MathF.Sign(value); + public static int Sign(float value) => MathF.Sign(value); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1144,11 +1088,44 @@ public static bool TryCreate(TOther value, out float result) } // - // IParseable + // INumberBase + // + + /// + static float INumberBase.One => One; + + /// + static float INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out float result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); + // + // IPowerFunctions + // + + /// + public static float Pow(float x, float y) => MathF.Pow(x, y); + + // + // IRootFunctions + // + + /// + public static float Cbrt(float x) => MathF.Cbrt(x); + + // /// + // public static float Hypot(float x, float y) => MathF.Hypot(x, y); + + /// + public static float Sqrt(float x) => MathF.Sqrt(x); + + // /// + // public static float Root(float x, float n) => MathF.Root(x, n); + // // ISignedNumber // @@ -1157,13 +1134,13 @@ public static bool TryCreate(TOther value, out float result) static float ISignedNumber.NegativeOne => NegativeOne; // - // ISpanParseable + // ISpanParsable // - /// + /// public static float Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out float result) => TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, provider, out result); // @@ -1176,6 +1153,55 @@ public static bool TryCreate(TOther value, out float result) // /// // static float ISubtractionOperators.operator checked -(float left, float right) => checked((float)(left - right)); + // + // ITrigonometricFunctions + // + + /// + public static float Acos(float x) => MathF.Acos(x); + + /// + public static float Asin(float x) => MathF.Asin(x); + + /// + public static float Atan(float x) => MathF.Atan(x); + + /// + public static float Atan2(float y, float x) => MathF.Atan2(y, x); + + /// + public static float Cos(float x) => MathF.Cos(x); + + /// + public static float Sin(float x) => MathF.Sin(x); + + /// + public static (float Sin, float Cos) SinCos(float x) => MathF.SinCos(x); + + /// + public static float Tan(float x) => MathF.Tan(x); + + // /// + // public static float AcosPi(float x) => MathF.AcosPi(x); + + // /// + // public static float AsinPi(float x) => MathF.AsinPi(x); + + // /// + // public static float AtanPi(float x) => MathF.AtanPi(x); + + // /// + // public static float Atan2Pi(float y, float x) => MathF.Atan2Pi(y, x); + + // /// + // public static float CosPi(float x) => MathF.CosPi(x); + + // /// + // public static float SinPi(float x) => MathF.SinPi(x, y); + + // /// + // public static float TanPi(float x) => MathF.TanPi(x, y); + // // IUnaryNegationOperators // @@ -1192,8 +1218,5 @@ public static bool TryCreate(TOther value, out float result) /// static float IUnaryPlusOperators.operator +(float value) => (float)(+value); - - // /// - // static float IUnaryPlusOperators.operator checked +(float value) => checked(value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs b/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs index 560b145c81e771..9169cdcae0bb7a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeOnly.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Numerics; using System.Globalization; using System.Runtime.Versioning; @@ -18,7 +19,7 @@ public readonly struct TimeOnly ISpanFormattable, IComparisonOperators, IMinMaxValue, - ISpanParseable, + ISpanParsable, ISubtractionOperators { // represent the number of ticks map to the time of the day. 1 ticks = 100-nanosecond in time measurements. @@ -351,7 +352,7 @@ public override int GetHashCode() /// An object that supplies culture-specific format information about s. /// A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None. /// An object that is equivalent to the time contained in s, as specified by provider and styles. - /// + /// public static TimeOnly Parse(ReadOnlySpan s, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None) { ParseFailureKind result = TryParseInternal(s, provider, style, out TimeOnly timeOnly); @@ -500,7 +501,7 @@ public static TimeOnly ParseExact(string s, string[] formats, IFormatProvider? p /// A bitwise combination of enumeration values that indicates the permitted format of s. A typical value to specify is None. /// When this method returns, contains the TimeOnly value equivalent to the time contained in s, if the conversion succeeded, or MinValue if the conversion failed. The conversion fails if the s parameter is empty string, or does not contain a valid string representation of a date. This parameter is passed uninitialized. /// true if the s parameter was converted successfully; otherwise, false. - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) => TryParseInternal(s, provider, style, out result) == ParseFailureKind.None; private static ParseFailureKind TryParseInternal(ReadOnlySpan s, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result) @@ -915,15 +916,7 @@ public string ToString(string? format, IFormatProvider? provider) } // - // IMinMaxValue - // - - static TimeOnly IMinMaxValue.MinValue => MinValue; - - static TimeOnly IMinMaxValue.MaxValue => MaxValue; - - // - // IParseable + // IParsable // public static TimeOnly Parse(string s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); @@ -931,13 +924,13 @@ public string ToString(string? format, IFormatProvider? provider) public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); // - // ISpanParseable + // ISpanParsable // - /// + /// public static TimeOnly Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, provider, DateTimeStyles.None); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out TimeOnly result) => TryParse(s, provider, DateTimeStyles.None, out result); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs b/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs index 3c8b2b47bb2945..346f7c36670bdb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs +++ b/src/libraries/System.Private.CoreLib/src/System/TimeSpan.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Versioning; @@ -39,7 +40,7 @@ public readonly struct TimeSpan IMinMaxValue, IMultiplyOperators, IMultiplicativeIdentity, - ISpanParseable, + ISpanParsable, ISubtractionOperators, IUnaryNegationOperators, IUnaryPlusOperators @@ -526,7 +527,7 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // /// - public static TimeSpan AdditiveIdentity => default; + static TimeSpan IAdditiveIdentity.AdditiveIdentity => default; // // IDivisionOperators @@ -551,7 +552,7 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // /// - public static double MultiplicativeIdentity => 1.0; + static double IMultiplicativeIdentity.MultiplicativeIdentity => 1.0; // // IMultiplyOperators @@ -573,11 +574,5 @@ public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan // /// // static TimeSpan IUnaryNegationOperators.operator checked -(TimeSpan value) => checked(-value); - - // - // IUnaryPlusOperators - // - - // static checked TimeSpan IUnaryPlusOperators.operator +(TimeSpan value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt16.cs b/src/libraries/System.Private.CoreLib/src/System/UInt16.cs index f3e5eff294df04..a0693d237024f6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt16.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt16.cs @@ -30,16 +30,16 @@ public readonly struct UInt16 public const ushort MinValue = 0; /// Represents the additive identity (0). - public const ushort AdditiveIdentity = 0; + private const ushort AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const ushort MultiplicativeIdentity = 1; + private const ushort MultiplicativeIdentity = 1; /// Represents the number one (1). - public const ushort One = 1; + private const ushort One = 1; /// Represents the number zero (0). - public const ushort Zero = 0; + private const ushort Zero = 0; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -308,6 +308,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right); + /// public static ushort LeadingZeroCount(ushort value) => (ushort)(BitOperations.LeadingZeroCount(value) - 16); @@ -443,21 +446,18 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - /// - static ushort INumber.One => One; - - /// - static ushort INumber.Zero => Zero; - /// - public static ushort Abs(ushort value) => value; + static ushort INumber.Abs(ushort value) => value; /// public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max); - /// + /// + static ushort INumber.CopySign(ushort value, ushort sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ushort Create(TOther value) + public static ushort CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -676,17 +676,23 @@ public static ushort CreateTruncating(TOther value) } } - /// - public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(ushort value) => false; /// public static ushort Max(ushort x, ushort y) => Math.Max(x, y); + /// + static ushort INumber.MaxMagnitude(ushort x, ushort y) => Max(x, y); + /// public static ushort Min(ushort x, ushort y) => Math.Min(x, y); + /// + static ushort INumber.MinMagnitude(ushort x, ushort y) => Min(x, y); + /// - public static ushort Sign(ushort value) => (ushort)((value == 0) ? 0 : 1); + public static int Sign(ushort value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -860,7 +866,17 @@ public static bool TryCreate(TOther value, out ushort result) } // - // IParseable + // INumberBase + // + + /// + static ushort INumberBase.One => One; + + /// + static ushort INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out ushort result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -879,13 +895,13 @@ public static bool TryCreate(TOther value, out ushort result) // static ushort IShiftOperators.operator >>>(ushort value, int shiftAmount) => (ushort)(value >> shiftAmount); // - // ISpanParseable + // ISpanParsable // - /// + /// public static ushort Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out ushort result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -914,8 +930,5 @@ public static bool TryCreate(TOther value, out ushort result) /// static ushort IUnaryPlusOperators.operator +(ushort value) => (ushort)(+value); - - // /// - // static ushort IUnaryPlusOperators.operator checked +(ushort value) => checked((ushort)(+value)); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt32.cs b/src/libraries/System.Private.CoreLib/src/System/UInt32.cs index 743c12a8426f61..351f00b7694be8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt32.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt32.cs @@ -30,16 +30,16 @@ public readonly struct UInt32 public const uint MinValue = 0U; /// Represents the additive identity (0). - public const uint AdditiveIdentity = 0; + private const uint AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const uint MultiplicativeIdentity = 1; + private const uint MultiplicativeIdentity = 1; /// Represents the number one (1). - public const uint One = 1; + private const uint One = 1; /// Represents the number zero (0). - public const uint Zero = 0; + private const uint Zero = 0; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -294,6 +294,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right); + /// public static uint LeadingZeroCount(uint value) => (uint)BitOperations.LeadingZeroCount(value); @@ -429,21 +432,18 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - /// - static uint INumber.One => One; - - /// - static uint INumber.Zero => Zero; - /// - public static uint Abs(uint value) => value; + static uint INumber.Abs(uint value) => value; /// public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max); - /// + /// + static uint INumber.CopySign(uint value, uint sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static uint Create(TOther value) + public static uint CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -660,17 +660,23 @@ public static uint CreateTruncating(TOther value) } } - /// - public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(uint value) => false; /// public static uint Max(uint x, uint y) => Math.Max(x, y); + /// + static uint INumber.MaxMagnitude(uint x, uint y) => Max(x, y); + /// public static uint Min(uint x, uint y) => Math.Min(x, y); + /// + static uint INumber.MinMagnitude(uint x, uint y) => Min(x, y); + /// - public static uint Sign(uint value) => (uint)((value == 0) ? 0 : 1); + public static int Sign(uint value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -836,7 +842,17 @@ public static bool TryCreate(TOther value, out uint result) } // - // IParseable + // INumberBase + // + + /// + static uint INumberBase.One => One; + + /// + static uint INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out uint result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -855,13 +871,13 @@ public static bool TryCreate(TOther value, out uint result) // static uint IShiftOperators.operator >>>(uint value, int shiftAmount) => value >> (int)shiftAmount; // - // ISpanParseable + // ISpanParsable // - /// + /// public static uint Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out uint result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -890,8 +906,5 @@ public static bool TryCreate(TOther value, out uint result) /// static uint IUnaryPlusOperators.operator +(uint value) => +value; - - // /// - // static uint IUnaryPlusOperators.operator checked +(uint value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt64.cs b/src/libraries/System.Private.CoreLib/src/System/UInt64.cs index fad6377fd41ace..9c17cfeb105bf4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt64.cs @@ -30,16 +30,16 @@ public readonly struct UInt64 public const ulong MinValue = 0x0; /// Represents the additive identity (0). - public const ulong AdditiveIdentity = 0; + private const ulong AdditiveIdentity = 0; /// Represents the multiplicative identity (1). - public const ulong MultiplicativeIdentity = 1; + private const ulong MultiplicativeIdentity = 1; /// Represents the number one (1). - public const ulong One = 1; + private const ulong One = 1; /// Represents the number zero (0). - public const ulong Zero = 0; + private const ulong Zero = 0; // Compares this object to another object, returning an integer that // indicates the relationship. @@ -293,6 +293,9 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // IBinaryInteger // + /// + public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right); + /// public static ulong LeadingZeroCount(ulong value) => (ulong)BitOperations.LeadingZeroCount(value); @@ -428,21 +431,18 @@ object IConvertible.ToType(Type type, IFormatProvider? provider) // INumber // - /// - static ulong INumber.One => One; - - /// - static ulong INumber.Zero => Zero; - /// - public static ulong Abs(ulong value) => value; + static ulong INumber.Abs(ulong value) => value; /// public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max); - /// + /// + static ulong INumber.CopySign(ulong value, ulong sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ulong Create(TOther value) + public static ulong CreateChecked(TOther value) where TOther : INumber { if (typeof(TOther) == typeof(byte)) @@ -655,17 +655,23 @@ public static ulong CreateTruncating(TOther value) } } - /// - public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(ulong value) => false; /// public static ulong Max(ulong x, ulong y) => Math.Max(x, y); + /// + static ulong INumber.MaxMagnitude(ulong x, ulong y) => Max(x, y); + /// public static ulong Min(ulong x, ulong y) => Math.Min(x, y); + /// + static ulong INumber.MinMagnitude(ulong x, ulong y) => Min(x, y); + /// - public static ulong Sign(ulong value) => (ulong)((value == 0) ? 0 : 1); + public static int Sign(ulong value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -815,7 +821,17 @@ public static bool TryCreate(TOther value, out ulong result) } // - // IParseable + // INumberBase + // + + /// + static ulong INumberBase.One => One; + + /// + static ulong INumberBase.Zero => Zero; + + // + // IParsable // public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out ulong result) => TryParse(s, NumberStyles.Integer, provider, out result); @@ -834,13 +850,13 @@ public static bool TryCreate(TOther value, out ulong result) // static ulong IShiftOperators.operator >>>(ulong value, int shiftAmount) => value >> (int)shiftAmount; // - // ISpanParseable + // ISpanParsable // - /// + /// public static ulong Parse(ReadOnlySpan s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider); - /// + /// public static bool TryParse(ReadOnlySpan s, IFormatProvider? provider, out ulong result) => TryParse(s, NumberStyles.Integer, provider, out result); // @@ -869,8 +885,5 @@ public static bool TryCreate(TOther value, out ulong result) /// static ulong IUnaryPlusOperators.operator +(ulong value) => +value; - - // /// - // static ulong IUnaryPlusOperators.operator checked +(ulong value) => checked(+value); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs index 80d5237d3f3fac..22253dc5ea659e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs @@ -276,6 +276,9 @@ public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatPro // IBinaryInteger // + /// + static (nuint Quotient, nuint Remainder) IBinaryInteger.DivRem(nuint left, nuint right) => Math.DivRem(left, right); + /// static nuint IBinaryInteger.LeadingZeroCount(nuint value) { @@ -471,21 +474,18 @@ static nuint IBinaryNumber.Log2(nuint value) // INumber // - /// - static nuint INumber.One => 1; - - /// - static nuint INumber.Zero => 0; - /// static nuint INumber.Abs(nuint value) => value; /// static nuint INumber.Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max); - /// + /// + static nuint INumber.CopySign(nuint value, nuint sign) => value; + + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - static nuint INumber.Create(TOther value) + static nuint INumber.CreateChecked(TOther value) { if (typeof(TOther) == typeof(byte)) { @@ -698,17 +698,23 @@ static nuint INumber.CreateTruncating(TOther value) } } - /// - static (nuint Quotient, nuint Remainder) INumber.DivRem(nuint left, nuint right) => Math.DivRem(left, right); + /// + static bool INumber.IsNegative(nuint value) => false; /// static nuint INumber.Max(nuint x, nuint y) => Math.Max(x, y); + /// + static nuint INumber.MaxMagnitude(nuint x, nuint y) => Math.Max(x, y); + /// static nuint INumber.Min(nuint x, nuint y) => Math.Min(x, y); + /// + static nuint INumber.MinMagnitude(nuint x, nuint y) => Math.Min(x, y); + /// - static nuint INumber.Sign(nuint value) => (nuint)((value == 0) ? 0 : 1); + static int INumber.Sign(nuint value) => (value == 0) ? 0 : 1; /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -864,6 +870,16 @@ static bool INumber.TryCreate(TOther value, out nuint result) } } + // + // INumberBase + // + + /// + static nuint INumberBase.One => 1; + + /// + static nuint INumberBase.Zero => 0; + // // IShiftOperators // @@ -903,8 +919,5 @@ static bool INumber.TryCreate(TOther value, out nuint result) /// static nuint IUnaryPlusOperators.operator +(nuint value) => +value; - - // /// - // static nuint IUnaryPlusOperators.operator checked +(nuint value) => checked(+value); } } diff --git a/src/libraries/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs b/src/libraries/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs index a3276c43f60fdd..a622d1ff6f6194 100644 --- a/src/libraries/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs +++ b/src/libraries/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs @@ -6,7 +6,7 @@ namespace System.Numerics { - public readonly partial struct BigInteger : System.IComparable, System.IComparable, System.IEquatable, System.ISpanFormattable + public readonly partial struct BigInteger : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.ISpanFormattable { private readonly object _dummy; private readonly int _dummyPrimitive; diff --git a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs index 1546c4efbc65f8..c3d92eecdbd103 100644 --- a/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs +++ b/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs @@ -5,12 +5,19 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Runtime.CompilerServices; namespace System.Numerics { [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("System.Numerics, Version=4.0.0.0, PublicKeyToken=b77a5c561934e089")] - public readonly struct BigInteger : ISpanFormattable, IComparable, IComparable, IEquatable + [TypeForwardedFrom("System.Numerics, Version=4.0.0.0, PublicKeyToken=b77a5c561934e089")] + public readonly struct BigInteger + : ISpanFormattable, + IComparable, + IComparable, + IEquatable + // IBinaryInteger, + // ISignedNumber { private const uint kuMaskHighBit = unchecked((uint)int.MinValue); private const int kcbitUint = 32; diff --git a/src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs b/src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs index 094fb28d9ff110..f57b1327d67fab 100644 --- a/src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs +++ b/src/libraries/System.Runtime.Numerics/src/System/Numerics/Complex.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; namespace System.Numerics { @@ -11,7 +12,7 @@ namespace System.Numerics /// are real numbers, and i is the imaginary unit, with the property i2= -1. /// [Serializable] - [System.Runtime.CompilerServices.TypeForwardedFrom("System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + [TypeForwardedFrom("System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public readonly struct Complex : IEquatable, IFormattable { public static readonly Complex Zero = new Complex(0.0, 0.0); @@ -314,7 +315,6 @@ private static double Hypot(double a, double b) } - private static double Log1P(double x) { // Compute log(1 + x) without loss of accuracy when x is small. diff --git a/src/libraries/System.Runtime/System.Runtime.sln b/src/libraries/System.Runtime/System.Runtime.sln index cde81eb9df32e1..e3638b9893826b 100644 --- a/src/libraries/System.Runtime/System.Runtime.sln +++ b/src/libraries/System.Runtime/System.Runtime.sln @@ -1,4 +1,8 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32319.34 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.CoreLib", "..\..\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj", "{71AB8240-F179-4B21-A8BE-8BE6CD774ED9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities.Unicode", "..\Common\tests\TestUtilities.Unicode\TestUtilities.Unicode.csproj", "{9DF0247E-5B81-4EF3-82CA-3E70B3A56742}" @@ -58,18 +62,27 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{F362E63A-2B1A-445B-B198-3071D7DDE8CF}" EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems*{71ab8240-f179-4b21-a8be-8be6cd774ed9}*SharedItemsImports = 5 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution + Checked|Any CPU = Checked|Any CPU + Checked|x64 = Checked|x64 + Checked|x86 = Checked|x86 Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 - Checked|Any CPU = Checked|Any CPU - Checked|x64 = Checked|x64 - Checked|x86 = Checked|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|Any CPU.ActiveCfg = Checked|x64 + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|Any CPU.Build.0 = Checked|x64 + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x64.ActiveCfg = Checked|x64 + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x64.Build.0 = Checked|x64 + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x86.ActiveCfg = Checked|x86 + {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x86.Build.0 = Checked|x86 {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Debug|Any CPU.ActiveCfg = Debug|x64 {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Debug|Any CPU.Build.0 = Debug|x64 {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Debug|x64.ActiveCfg = Debug|x64 @@ -82,12 +95,12 @@ Global {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Release|x64.Build.0 = Release|x64 {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Release|x86.ActiveCfg = Release|x86 {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Release|x86.Build.0 = Release|x86 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|Any CPU.ActiveCfg = Checked|x64 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|Any CPU.Build.0 = Checked|x64 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x64.ActiveCfg = Checked|x64 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x64.Build.0 = Checked|x64 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x86.ActiveCfg = Checked|x86 - {71AB8240-F179-4B21-A8BE-8BE6CD774ED9}.Checked|x86.Build.0 = Checked|x86 + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|Any CPU.Build.0 = Debug|Any CPU + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x64.ActiveCfg = Debug|Any CPU + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x64.Build.0 = Debug|Any CPU + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x86.ActiveCfg = Debug|Any CPU + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x86.Build.0 = Debug|Any CPU {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Debug|Any CPU.Build.0 = Debug|Any CPU {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -100,12 +113,12 @@ Global {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Release|x64.Build.0 = Release|Any CPU {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Release|x86.ActiveCfg = Release|Any CPU {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Release|x86.Build.0 = Release|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|Any CPU.Build.0 = Debug|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x64.ActiveCfg = Debug|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x64.Build.0 = Debug|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x86.ActiveCfg = Debug|Any CPU - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742}.Checked|x86.Build.0 = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|Any CPU.Build.0 = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x64.ActiveCfg = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x64.Build.0 = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x86.ActiveCfg = Debug|Any CPU + {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x86.Build.0 = Debug|Any CPU {FB17AC52-1633-4845-932B-9218DF895957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FB17AC52-1633-4845-932B-9218DF895957}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB17AC52-1633-4845-932B-9218DF895957}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -118,12 +131,12 @@ Global {FB17AC52-1633-4845-932B-9218DF895957}.Release|x64.Build.0 = Release|Any CPU {FB17AC52-1633-4845-932B-9218DF895957}.Release|x86.ActiveCfg = Release|Any CPU {FB17AC52-1633-4845-932B-9218DF895957}.Release|x86.Build.0 = Release|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|Any CPU.Build.0 = Debug|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x64.ActiveCfg = Debug|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x64.Build.0 = Debug|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x86.ActiveCfg = Debug|Any CPU - {FB17AC52-1633-4845-932B-9218DF895957}.Checked|x86.Build.0 = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|Any CPU.Build.0 = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x64.ActiveCfg = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x64.Build.0 = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x86.ActiveCfg = Debug|Any CPU + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x86.Build.0 = Debug|Any CPU {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -136,12 +149,12 @@ Global {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Release|x64.Build.0 = Release|Any CPU {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Release|x86.ActiveCfg = Release|Any CPU {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Release|x86.Build.0 = Release|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|Any CPU.Build.0 = Debug|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x64.ActiveCfg = Debug|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x64.Build.0 = Debug|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x86.ActiveCfg = Debug|Any CPU - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9}.Checked|x86.Build.0 = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|Any CPU.Build.0 = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x64.ActiveCfg = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x64.Build.0 = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x86.ActiveCfg = Debug|Any CPU + {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x86.Build.0 = Debug|Any CPU {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Debug|Any CPU.Build.0 = Debug|Any CPU {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -154,12 +167,12 @@ Global {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Release|x64.Build.0 = Release|Any CPU {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Release|x86.ActiveCfg = Release|Any CPU {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Release|x86.Build.0 = Release|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|Any CPU.Build.0 = Debug|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x64.ActiveCfg = Debug|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x64.Build.0 = Debug|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x86.ActiveCfg = Debug|Any CPU - {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD}.Checked|x86.Build.0 = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|Any CPU.Build.0 = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x64.ActiveCfg = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x64.Build.0 = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x86.ActiveCfg = Debug|Any CPU + {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x86.Build.0 = Debug|Any CPU {9C41B325-1225-43CA-9436-549AFF6D90A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C41B325-1225-43CA-9436-549AFF6D90A1}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C41B325-1225-43CA-9436-549AFF6D90A1}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -172,12 +185,12 @@ Global {9C41B325-1225-43CA-9436-549AFF6D90A1}.Release|x64.Build.0 = Release|Any CPU {9C41B325-1225-43CA-9436-549AFF6D90A1}.Release|x86.ActiveCfg = Release|Any CPU {9C41B325-1225-43CA-9436-549AFF6D90A1}.Release|x86.Build.0 = Release|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|Any CPU.Build.0 = Debug|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x64.ActiveCfg = Debug|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x64.Build.0 = Debug|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x86.ActiveCfg = Debug|Any CPU - {9C41B325-1225-43CA-9436-549AFF6D90A1}.Checked|x86.Build.0 = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|Any CPU.Build.0 = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x64.ActiveCfg = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x64.Build.0 = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x86.ActiveCfg = Debug|Any CPU + {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x86.Build.0 = Debug|Any CPU {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Debug|Any CPU.Build.0 = Debug|Any CPU {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -190,12 +203,12 @@ Global {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Release|x64.Build.0 = Release|Any CPU {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Release|x86.ActiveCfg = Release|Any CPU {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Release|x86.Build.0 = Release|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|Any CPU.Build.0 = Debug|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x64.ActiveCfg = Debug|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x64.Build.0 = Debug|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x86.ActiveCfg = Debug|Any CPU - {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B}.Checked|x86.Build.0 = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|Any CPU.Build.0 = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x64.ActiveCfg = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x64.Build.0 = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x86.ActiveCfg = Debug|Any CPU + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x86.Build.0 = Debug|Any CPU {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -208,12 +221,12 @@ Global {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Release|x64.Build.0 = Release|Any CPU {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Release|x86.ActiveCfg = Release|Any CPU {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Release|x86.Build.0 = Release|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|Any CPU.Build.0 = Debug|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x64.ActiveCfg = Debug|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x64.Build.0 = Debug|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x86.ActiveCfg = Debug|Any CPU - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3}.Checked|x86.Build.0 = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|Any CPU.Build.0 = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x64.ActiveCfg = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x64.Build.0 = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x86.ActiveCfg = Debug|Any CPU + {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x86.Build.0 = Debug|Any CPU {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Debug|Any CPU.Build.0 = Debug|Any CPU {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -226,12 +239,12 @@ Global {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Release|x64.Build.0 = Release|Any CPU {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Release|x86.ActiveCfg = Release|Any CPU {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Release|x86.Build.0 = Release|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|Any CPU.Build.0 = Debug|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x64.ActiveCfg = Debug|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x64.Build.0 = Debug|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x86.ActiveCfg = Debug|Any CPU - {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC}.Checked|x86.Build.0 = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|Any CPU.Build.0 = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x64.ActiveCfg = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x64.Build.0 = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x86.ActiveCfg = Debug|Any CPU + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x86.Build.0 = Debug|Any CPU {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -244,12 +257,12 @@ Global {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Release|x64.Build.0 = Release|Any CPU {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Release|x86.ActiveCfg = Release|Any CPU {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Release|x86.Build.0 = Release|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|Any CPU.Build.0 = Debug|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x64.ActiveCfg = Debug|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x64.Build.0 = Debug|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x86.ActiveCfg = Debug|Any CPU - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9}.Checked|x86.Build.0 = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|Any CPU.Build.0 = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x64.ActiveCfg = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x64.Build.0 = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x86.ActiveCfg = Debug|Any CPU + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x86.Build.0 = Debug|Any CPU {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Debug|Any CPU.Build.0 = Debug|Any CPU {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -262,12 +275,12 @@ Global {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Release|x64.Build.0 = Release|Any CPU {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Release|x86.ActiveCfg = Release|Any CPU {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Release|x86.Build.0 = Release|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|Any CPU.Build.0 = Debug|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x64.ActiveCfg = Debug|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x64.Build.0 = Debug|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x86.ActiveCfg = Debug|Any CPU - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37}.Checked|x86.Build.0 = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|Any CPU.Build.0 = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x64.ActiveCfg = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x64.Build.0 = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x86.ActiveCfg = Debug|Any CPU + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x86.Build.0 = Debug|Any CPU {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -280,12 +293,12 @@ Global {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Release|x64.Build.0 = Release|Any CPU {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Release|x86.ActiveCfg = Release|Any CPU {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Release|x86.Build.0 = Release|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|Any CPU.Build.0 = Debug|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x64.ActiveCfg = Debug|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x64.Build.0 = Debug|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x86.ActiveCfg = Debug|Any CPU - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C}.Checked|x86.Build.0 = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|Any CPU.Build.0 = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x64.ActiveCfg = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x64.Build.0 = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x86.ActiveCfg = Debug|Any CPU + {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x86.Build.0 = Debug|Any CPU {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -298,12 +311,12 @@ Global {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Release|x64.Build.0 = Release|Any CPU {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Release|x86.ActiveCfg = Release|Any CPU {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Release|x86.Build.0 = Release|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|Any CPU.Build.0 = Debug|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x64.ActiveCfg = Debug|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x64.Build.0 = Debug|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x86.ActiveCfg = Debug|Any CPU - {A83A8520-F5E2-49B4-83BC-0F82A412951D}.Checked|x86.Build.0 = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|Any CPU.Build.0 = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x64.ActiveCfg = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x64.Build.0 = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x86.ActiveCfg = Debug|Any CPU + {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x86.Build.0 = Debug|Any CPU {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -316,12 +329,12 @@ Global {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Release|x64.Build.0 = Release|Any CPU {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Release|x86.ActiveCfg = Release|Any CPU {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Release|x86.Build.0 = Release|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|Any CPU.Build.0 = Debug|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x64.ActiveCfg = Debug|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x64.Build.0 = Debug|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x86.ActiveCfg = Debug|Any CPU - {3B79DD71-8C2F-41BC-A1A7-86A490D6C726}.Checked|x86.Build.0 = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|Any CPU.Build.0 = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x64.ActiveCfg = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x64.Build.0 = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x86.ActiveCfg = Debug|Any CPU + {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x86.Build.0 = Debug|Any CPU {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -334,12 +347,12 @@ Global {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Release|x64.Build.0 = Release|Any CPU {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Release|x86.ActiveCfg = Release|Any CPU {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Release|x86.Build.0 = Release|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|Any CPU.Build.0 = Debug|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x64.ActiveCfg = Debug|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x64.Build.0 = Debug|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x86.ActiveCfg = Debug|Any CPU - {4EE36055-AD7C-4779-B3F6-08687960DCC3}.Checked|x86.Build.0 = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|Any CPU.Build.0 = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x64.ActiveCfg = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x64.Build.0 = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x86.ActiveCfg = Debug|Any CPU + {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x86.Build.0 = Debug|Any CPU {C230AC88-A377-4BEB-824F-AB174C14DC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C230AC88-A377-4BEB-824F-AB174C14DC86}.Debug|Any CPU.Build.0 = Debug|Any CPU {C230AC88-A377-4BEB-824F-AB174C14DC86}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -352,12 +365,12 @@ Global {C230AC88-A377-4BEB-824F-AB174C14DC86}.Release|x64.Build.0 = Release|Any CPU {C230AC88-A377-4BEB-824F-AB174C14DC86}.Release|x86.ActiveCfg = Release|Any CPU {C230AC88-A377-4BEB-824F-AB174C14DC86}.Release|x86.Build.0 = Release|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|Any CPU.Build.0 = Debug|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x64.ActiveCfg = Debug|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x64.Build.0 = Debug|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x86.ActiveCfg = Debug|Any CPU - {C230AC88-A377-4BEB-824F-AB174C14DC86}.Checked|x86.Build.0 = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|Any CPU.Build.0 = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x64.ActiveCfg = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x64.Build.0 = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x86.ActiveCfg = Debug|Any CPU + {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x86.Build.0 = Debug|Any CPU {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -370,12 +383,12 @@ Global {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Release|x64.Build.0 = Release|Any CPU {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Release|x86.ActiveCfg = Release|Any CPU {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Release|x86.Build.0 = Release|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|Any CPU.Build.0 = Debug|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x64.ActiveCfg = Debug|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x64.Build.0 = Debug|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x86.ActiveCfg = Debug|Any CPU - {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC}.Checked|x86.Build.0 = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|Any CPU.Build.0 = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x64.ActiveCfg = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x64.Build.0 = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x86.ActiveCfg = Debug|Any CPU + {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x86.Build.0 = Debug|Any CPU {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Debug|Any CPU.Build.0 = Debug|Any CPU {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -388,12 +401,12 @@ Global {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Release|x64.Build.0 = Release|Any CPU {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Release|x86.ActiveCfg = Release|Any CPU {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Release|x86.Build.0 = Release|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|Any CPU.Build.0 = Debug|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x64.ActiveCfg = Debug|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x64.Build.0 = Debug|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x86.ActiveCfg = Debug|Any CPU - {0F83B07B-2E3F-4708-BE6D-7A8DA8168803}.Checked|x86.Build.0 = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|Any CPU.Build.0 = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x64.ActiveCfg = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x64.Build.0 = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x86.ActiveCfg = Debug|Any CPU + {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x86.Build.0 = Debug|Any CPU {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -406,12 +419,12 @@ Global {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Release|x64.Build.0 = Release|Any CPU {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Release|x86.ActiveCfg = Release|Any CPU {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Release|x86.Build.0 = Release|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|Any CPU.Build.0 = Debug|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x64.ActiveCfg = Debug|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x64.Build.0 = Debug|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x86.ActiveCfg = Debug|Any CPU - {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD}.Checked|x86.Build.0 = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|Any CPU.Build.0 = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x64.ActiveCfg = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x64.Build.0 = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x86.ActiveCfg = Debug|Any CPU + {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x86.Build.0 = Debug|Any CPU {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Debug|Any CPU.Build.0 = Debug|Any CPU {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -424,12 +437,12 @@ Global {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Release|x64.Build.0 = Release|Any CPU {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Release|x86.ActiveCfg = Release|Any CPU {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Release|x86.Build.0 = Release|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|Any CPU.Build.0 = Debug|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x64.ActiveCfg = Debug|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x64.Build.0 = Debug|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x86.ActiveCfg = Debug|Any CPU - {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F}.Checked|x86.Build.0 = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|Any CPU.Build.0 = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x64.ActiveCfg = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x64.Build.0 = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x86.ActiveCfg = Debug|Any CPU + {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x86.Build.0 = Debug|Any CPU {F6A8185B-07C6-401D-9B40-3C560239E05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F6A8185B-07C6-401D-9B40-3C560239E05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F6A8185B-07C6-401D-9B40-3C560239E05F}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -442,12 +455,12 @@ Global {F6A8185B-07C6-401D-9B40-3C560239E05F}.Release|x64.Build.0 = Release|Any CPU {F6A8185B-07C6-401D-9B40-3C560239E05F}.Release|x86.ActiveCfg = Release|Any CPU {F6A8185B-07C6-401D-9B40-3C560239E05F}.Release|x86.Build.0 = Release|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|Any CPU.Build.0 = Debug|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x64.ActiveCfg = Debug|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x64.Build.0 = Debug|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x86.ActiveCfg = Debug|Any CPU - {F6A8185B-07C6-401D-9B40-3C560239E05F}.Checked|x86.Build.0 = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|Any CPU.Build.0 = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x64.ActiveCfg = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x64.Build.0 = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x86.ActiveCfg = Debug|Any CPU + {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x86.Build.0 = Debug|Any CPU {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Debug|Any CPU.Build.0 = Debug|Any CPU {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -460,12 +473,12 @@ Global {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Release|x64.Build.0 = Release|Any CPU {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Release|x86.ActiveCfg = Release|Any CPU {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Release|x86.Build.0 = Release|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|Any CPU.Build.0 = Debug|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x64.ActiveCfg = Debug|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x64.Build.0 = Debug|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x86.ActiveCfg = Debug|Any CPU - {25E8AB9D-2D10-44F5-9F83-5A5134526771}.Checked|x86.Build.0 = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|Any CPU.Build.0 = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x64.ActiveCfg = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x64.Build.0 = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x86.ActiveCfg = Debug|Any CPU + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x86.Build.0 = Debug|Any CPU {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Debug|Any CPU.Build.0 = Debug|Any CPU {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -478,12 +491,12 @@ Global {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Release|x64.Build.0 = Release|Any CPU {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Release|x86.ActiveCfg = Release|Any CPU {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Release|x86.Build.0 = Release|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|Any CPU.Build.0 = Debug|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x64.ActiveCfg = Debug|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x64.Build.0 = Debug|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x86.ActiveCfg = Debug|Any CPU - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13}.Checked|x86.Build.0 = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|Any CPU.Build.0 = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x64.ActiveCfg = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x64.Build.0 = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x86.ActiveCfg = Debug|Any CPU + {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x86.Build.0 = Debug|Any CPU {82728202-1098-4E16-B598-5762EAF67D08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {82728202-1098-4E16-B598-5762EAF67D08}.Debug|Any CPU.Build.0 = Debug|Any CPU {82728202-1098-4E16-B598-5762EAF67D08}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -496,12 +509,12 @@ Global {82728202-1098-4E16-B598-5762EAF67D08}.Release|x64.Build.0 = Release|Any CPU {82728202-1098-4E16-B598-5762EAF67D08}.Release|x86.ActiveCfg = Release|Any CPU {82728202-1098-4E16-B598-5762EAF67D08}.Release|x86.Build.0 = Release|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|Any CPU.Build.0 = Debug|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x64.ActiveCfg = Debug|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x64.Build.0 = Debug|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x86.ActiveCfg = Debug|Any CPU - {82728202-1098-4E16-B598-5762EAF67D08}.Checked|x86.Build.0 = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|Any CPU.Build.0 = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x64.ActiveCfg = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x64.Build.0 = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x86.ActiveCfg = Debug|Any CPU + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x86.Build.0 = Debug|Any CPU {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -514,42 +527,36 @@ Global {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Release|x64.Build.0 = Release|Any CPU {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Release|x86.ActiveCfg = Release|Any CPU {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Release|x86.Build.0 = Release|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|Any CPU.ActiveCfg = Debug|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|Any CPU.Build.0 = Debug|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x64.ActiveCfg = Debug|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x64.Build.0 = Debug|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x86.ActiveCfg = Debug|Any CPU - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA}.Checked|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {71AB8240-F179-4B21-A8BE-8BE6CD774ED9} = {28140562-A65A-48E9-ABAB-53BA939084F0} + {9DF0247E-5B81-4EF3-82CA-3E70B3A56742} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} + {FB17AC52-1633-4845-932B-9218DF895957} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} + {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} {B41CB4AB-CDF6-4BB0-B826-D4BAE41411BD} = {28140562-A65A-48E9-ABAB-53BA939084F0} + {9C41B325-1225-43CA-9436-549AFF6D90A1} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} {F27DC16B-64F4-4BD7-AF9C-1C76F7ACC88B} = {28140562-A65A-48E9-ABAB-53BA939084F0} + {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} {E7A05515-DABE-4C09-83CB-CE84EFDCD4CC} = {28140562-A65A-48E9-ABAB-53BA939084F0} + {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} + {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} + {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} {A83A8520-F5E2-49B4-83BC-0F82A412951D} = {28140562-A65A-48E9-ABAB-53BA939084F0} - {F6A8185B-07C6-401D-9B40-3C560239E05F} = {28140562-A65A-48E9-ABAB-53BA939084F0} - {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13} = {28140562-A65A-48E9-ABAB-53BA939084F0} - {069C2B51-069A-4FBB-BFE9-42D573F1CEEA} = {28140562-A65A-48E9-ABAB-53BA939084F0} - {9DF0247E-5B81-4EF3-82CA-3E70B3A56742} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} - {FB17AC52-1633-4845-932B-9218DF895957} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {3B79DD71-8C2F-41BC-A1A7-86A490D6C726} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {4EE36055-AD7C-4779-B3F6-08687960DCC3} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {C230AC88-A377-4BEB-824F-AB174C14DC86} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {1BCCD2F5-A561-4641-8A0B-51F3EDCA35DC} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {0F83B07B-2E3F-4708-BE6D-7A8DA8168803} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} {833C1D45-9BBB-4A92-93B7-4EFFD9E945AD} = {FD72C125-C10D-457B-8AFC-6B4E5237AF6A} - {62C2AC8A-7410-4E06-B94E-43BF2DCFBDE9} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} - {9C41B325-1225-43CA-9436-549AFF6D90A1} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} - {F39E2C7E-5FE1-460C-AC2C-7E2B50955F2C} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} {1B4552A4-91FD-4C6F-9EB4-3454C4BE428F} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} + {F6A8185B-07C6-401D-9B40-3C560239E05F} = {28140562-A65A-48E9-ABAB-53BA939084F0} {25E8AB9D-2D10-44F5-9F83-5A5134526771} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} + {9CF6C6E6-0E9F-4A95-84B5-6083EAB6FA13} = {28140562-A65A-48E9-ABAB-53BA939084F0} {82728202-1098-4E16-B598-5762EAF67D08} = {5B2B5E7E-A2FB-4095-9E79-404BF53E0133} - {CF79B5AE-38CB-4B80-BF92-CF634C0B7EC3} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} - {4FA4A9A6-1D38-414B-96F0-3CFB63C687C9} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} - {A7B7DE04-7261-4D4C-AA78-9F2D9B5A1C37} = {F362E63A-2B1A-445B-B198-3071D7DDE8CF} + {069C2B51-069A-4FBB-BFE9-42D573F1CEEA} = {28140562-A65A-48E9-ABAB-53BA939084F0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {19706846-1F47-42ED-B649-B0982EE96E6B} diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index b3ae854842fc39..2db4a634b18383 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -713,28 +713,23 @@ public unsafe static void MemoryCopy(void* source, void* destination, long desti public unsafe static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { } public static void SetByte(System.Array array, int index, byte value) { } } - public readonly partial struct Byte : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber + public readonly partial struct Byte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber { private readonly byte _dummyPrimitive; - public const byte AdditiveIdentity = (byte)0; public const byte MaxValue = (byte)255; public const byte MinValue = (byte)0; - public const byte MultiplicativeIdentity = (byte)1; - public const byte One = (byte)1; - public const byte Zero = (byte)0; - static byte System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static byte System.IMinMaxValue.MaxValue { get { throw null; } } - static byte System.IMinMaxValue.MinValue { get { throw null; } } - static byte System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static byte System.INumber.One { get { throw null; } } - static byte System.INumber.Zero { get { throw null; } } - public static System.Byte Abs(System.Byte value) { throw null; } + static byte System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static byte System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static byte System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static byte System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static byte System.Numerics.INumberBase.One { get { throw null; } } + static byte System.Numerics.INumberBase.Zero { get { throw null; } } public static System.Byte Clamp(System.Byte value, System.Byte min, System.Byte max) { throw null; } public int CompareTo(System.Byte value) { throw null; } public int CompareTo(object? value) { throw null; } - public static System.Byte CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Byte CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Byte Create(TOther value) where TOther : INumber { throw null; } + public static System.Byte CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Byte CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Byte CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (byte Quotient, byte Remainder) DivRem(System.Byte left, System.Byte right) { throw null; } public bool Equals(System.Byte obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } @@ -754,16 +749,7 @@ public static void SetByte(System.Array array, int index, byte value) { } public static System.Byte PopCount(System.Byte value) { throw null; } public static System.Byte RotateLeft(System.Byte value, int rotateAmount) { throw null; } public static System.Byte RotateRight(System.Byte value, int rotateAmount) { throw null; } - public static System.Byte Sign(System.Byte value) { throw null; } - static System.Byte System.IAdditionOperators.operator +(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IBitwiseOperators.operator &(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IBitwiseOperators.operator |(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IBitwiseOperators.operator ^(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IBitwiseOperators.operator ~(System.Byte value) { throw null; } - static bool System.IComparisonOperators.operator >(System.Byte left, System.Byte right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.Byte left, System.Byte right) { throw null; } - static bool System.IComparisonOperators.operator <(System.Byte left, System.Byte right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.Byte left, System.Byte right) { throw null; } + public static int Sign(System.Byte value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } System.Byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -779,24 +765,38 @@ public static void SetByte(System.Array array, int index, byte value) { } ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Byte System.IDecrementOperators.operator --(System.Byte value) { throw null; } - static System.Byte System.IDivisionOperators.operator /(System.Byte left, System.Byte right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.Byte left, System.Byte right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IIncrementOperators.operator ++(System.Byte value) { throw null; } - static System.Byte System.IModulusOperators.operator %(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IMultiplyOperators.operator *(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IShiftOperators.operator <<(System.Byte value, int shiftAmount) { throw null; } - static System.Byte System.IShiftOperators.operator >>(System.Byte value, int shiftAmount) { throw null; } - static System.Byte System.ISubtractionOperators.operator -(System.Byte left, System.Byte right) { throw null; } - static System.Byte System.IUnaryNegationOperators.operator -(System.Byte value) { throw null; } - static System.Byte System.IUnaryPlusOperators.operator +(System.Byte value) { throw null; } + static System.Byte System.Numerics.IAdditionOperators.operator +(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IBitwiseOperators.operator &(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IBitwiseOperators.operator |(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IBitwiseOperators.operator ^(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IBitwiseOperators.operator ~(System.Byte value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.Byte left, System.Byte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.Byte left, System.Byte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.Byte left, System.Byte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IDecrementOperators.operator --(System.Byte value) { throw null; } + static System.Byte System.Numerics.IDivisionOperators.operator /(System.Byte left, System.Byte right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.Byte left, System.Byte right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IIncrementOperators.operator ++(System.Byte value) { throw null; } + static System.Byte System.Numerics.IModulusOperators.operator %(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IMultiplyOperators.operator *(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.INumber.Abs(System.Byte value) { throw null; } + static System.Byte System.Numerics.INumber.CopySign(System.Byte value, System.Byte sign) { throw null; } + static bool System.Numerics.INumber.IsNegative(System.Byte value) { throw null; } + static System.Byte System.Numerics.INumber.MaxMagnitude(System.Byte x, System.Byte y) { throw null; } + static System.Byte System.Numerics.INumber.MinMagnitude(System.Byte x, System.Byte y) { throw null; } + static System.Byte System.Numerics.IShiftOperators.operator <<(System.Byte value, int shiftAmount) { throw null; } + static System.Byte System.Numerics.IShiftOperators.operator >>(System.Byte value, int shiftAmount) { throw null; } + static System.Byte System.Numerics.ISubtractionOperators.operator -(System.Byte left, System.Byte right) { throw null; } + static System.Byte System.Numerics.IUnaryNegationOperators.operator -(System.Byte value) { throw null; } + static System.Byte System.Numerics.IUnaryPlusOperators.operator +(System.Byte value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Byte TrailingZeroCount(System.Byte value) { throw null; } - public static bool TryCreate(TOther value, out System.Byte result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Byte result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, out System.Byte result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; } @@ -812,27 +812,26 @@ protected CannotUnloadAppDomainException(System.Runtime.Serialization.Serializat public CannotUnloadAppDomainException(string? message) { } public CannotUnloadAppDomainException(string? message, System.Exception? innerException) { } } - public readonly partial struct Char : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber + public readonly partial struct Char : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber { private readonly char _dummyPrimitive; public const char MaxValue = '\uFFFF'; public const char MinValue = '\0'; - static char System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static char System.IMinMaxValue.MaxValue { get { throw null; } } - static char System.IMinMaxValue.MinValue { get { throw null; } } - static char System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static char System.INumber.One { get { throw null; } } - static char System.INumber.Zero { get { throw null; } } - public static System.Char Abs(System.Char value) { throw null; } + static char System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static char System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static char System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static char System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static char System.Numerics.INumberBase.One { get { throw null; } } + static char System.Numerics.INumberBase.Zero { get { throw null; } } public static System.Char Clamp(System.Char value, System.Char min, System.Char max) { throw null; } public int CompareTo(System.Char value) { throw null; } public int CompareTo(object? value) { throw null; } public static string ConvertFromUtf32(int utf32) { throw null; } public static int ConvertToUtf32(System.Char highSurrogate, System.Char lowSurrogate) { throw null; } public static int ConvertToUtf32(string s, int index) { throw null; } - public static System.Char CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Char CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Char Create(TOther value) where TOther : INumber { throw null; } + public static System.Char CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Char CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Char CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (char Quotient, char Remainder) DivRem(System.Char left, System.Char right) { throw null; } public bool Equals(System.Char obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } @@ -882,16 +881,7 @@ public CannotUnloadAppDomainException(string? message, System.Exception? innerEx public static System.Char PopCount(System.Char value) { throw null; } public static System.Char RotateLeft(System.Char value, int rotateAmount) { throw null; } public static System.Char RotateRight(System.Char value, int rotateAmount) { throw null; } - public static System.Char Sign(System.Char value) { throw null; } - static System.Char System.IAdditionOperators.operator +(System.Char left, System.Char right) { throw null; } - static System.Char System.IBitwiseOperators.operator &(System.Char left, System.Char right) { throw null; } - static System.Char System.IBitwiseOperators.operator |(System.Char left, System.Char right) { throw null; } - static System.Char System.IBitwiseOperators.operator ^(System.Char left, System.Char right) { throw null; } - static System.Char System.IBitwiseOperators.operator ~(System.Char value) { throw null; } - static bool System.IComparisonOperators.operator >(System.Char left, System.Char right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.Char left, System.Char right) { throw null; } - static bool System.IComparisonOperators.operator <(System.Char left, System.Char right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.Char left, System.Char right) { throw null; } + public static int Sign(System.Char value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } System.Char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -907,28 +897,42 @@ public CannotUnloadAppDomainException(string? message, System.Exception? innerEx ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Char System.IDecrementOperators.operator --(System.Char value) { throw null; } - static System.Char System.IDivisionOperators.operator /(System.Char left, System.Char right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.Char left, System.Char right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.Char left, System.Char right) { throw null; } string System.IFormattable.ToString(string? format, System.IFormatProvider? formatProvider) { throw null; } - static System.Char System.IIncrementOperators.operator ++(System.Char value) { throw null; } - static System.Char System.IModulusOperators.operator %(System.Char left, System.Char right) { throw null; } - static System.Char System.IMultiplyOperators.operator *(System.Char left, System.Char right) { throw null; } - static System.Char System.INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - static System.Char System.INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } - static bool System.INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Char result) { throw null; } - static bool System.INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Char result) { throw null; } - static System.Char System.IParseable.Parse(string s, System.IFormatProvider? provider) { throw null; } - static bool System.IParseable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Char result) { throw null; } - static System.Char System.IShiftOperators.operator <<(System.Char value, int shiftAmount) { throw null; } - static System.Char System.IShiftOperators.operator >>(System.Char value, int shiftAmount) { throw null; } + static System.Char System.IParsable.Parse(string s, System.IFormatProvider? provider) { throw null; } + static bool System.IParsable.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Char result) { throw null; } bool System.ISpanFormattable.TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider) { throw null; } - static System.Char System.ISpanParseable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } - static bool System.ISpanParseable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Char result) { throw null; } - static System.Char System.ISubtractionOperators.operator -(System.Char left, System.Char right) { throw null; } - static System.Char System.IUnaryNegationOperators.operator -(System.Char value) { throw null; } - static System.Char System.IUnaryPlusOperators.operator +(System.Char value) { throw null; } + static System.Char System.ISpanParsable.Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } + static bool System.ISpanParsable.TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Char result) { throw null; } + static System.Char System.Numerics.IAdditionOperators.operator +(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IBitwiseOperators.operator &(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IBitwiseOperators.operator |(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IBitwiseOperators.operator ^(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IBitwiseOperators.operator ~(System.Char value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.Char left, System.Char right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.Char left, System.Char right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.Char left, System.Char right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IDecrementOperators.operator --(System.Char value) { throw null; } + static System.Char System.Numerics.IDivisionOperators.operator /(System.Char left, System.Char right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.Char left, System.Char right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IIncrementOperators.operator ++(System.Char value) { throw null; } + static System.Char System.Numerics.IModulusOperators.operator %(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IMultiplyOperators.operator *(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.INumber.Abs(System.Char value) { throw null; } + static System.Char System.Numerics.INumber.CopySign(System.Char value, System.Char sign) { throw null; } + static bool System.Numerics.INumber.IsNegative(System.Char value) { throw null; } + static System.Char System.Numerics.INumber.MaxMagnitude(System.Char x, System.Char y) { throw null; } + static System.Char System.Numerics.INumber.MinMagnitude(System.Char x, System.Char y) { throw null; } + static System.Char System.Numerics.INumber.Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } + static System.Char System.Numerics.INumber.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } + static bool System.Numerics.INumber.TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Char result) { throw null; } + static bool System.Numerics.INumber.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Char result) { throw null; } + static System.Char System.Numerics.IShiftOperators.operator <<(System.Char value, int shiftAmount) { throw null; } + static System.Char System.Numerics.IShiftOperators.operator >>(System.Char value, int shiftAmount) { throw null; } + static System.Char System.Numerics.ISubtractionOperators.operator -(System.Char left, System.Char right) { throw null; } + static System.Char System.Numerics.IUnaryNegationOperators.operator -(System.Char value) { throw null; } + static System.Char System.Numerics.IUnaryPlusOperators.operator +(System.Char value) { throw null; } public static System.Char ToLower(System.Char c) { throw null; } public static System.Char ToLower(System.Char c, System.Globalization.CultureInfo culture) { throw null; } public static System.Char ToLowerInvariant(System.Char c) { throw null; } @@ -939,7 +943,7 @@ public CannotUnloadAppDomainException(string? message, System.Exception? innerEx public static System.Char ToUpper(System.Char c, System.Globalization.CultureInfo culture) { throw null; } public static System.Char ToUpperInvariant(System.Char c) { throw null; } public static System.Char TrailingZeroCount(System.Char value) { throw null; } - public static bool TryCreate(TOther value, out System.Char result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Char result) where TOther : System.Numerics.INumber { throw null; } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Char result) { throw null; } } public sealed partial class CharEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.ICloneable, System.IDisposable @@ -1429,7 +1433,7 @@ public static partial class Convert public static bool TryToBase64Chars(System.ReadOnlySpan bytes, System.Span chars, out int charsWritten, System.Base64FormattingOptions options = System.Base64FormattingOptions.None) { throw null; } } public delegate TOutput Converter(TInput input); - public readonly partial struct DateOnly : System.IComparable, System.IComparable, System.IComparisonOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IMinMaxValue, System.IParseable, System.ISpanFormattable, System.ISpanParseable + public readonly partial struct DateOnly : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IComparisonOperators, System.Numerics.IEqualityOperators, System.Numerics.IMinMaxValue { private readonly int _dummyPrimitive; public DateOnly(int year, int month, int day) { throw null; } @@ -1494,7 +1498,7 @@ public static partial class Convert public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.DateOnly result) { throw null; } public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; } } - public readonly partial struct DateTime : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IMinMaxValue, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.ISubtractionOperators, System.Runtime.Serialization.ISerializable + public readonly partial struct DateTime : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IEqualityOperators, System.Numerics.IMinMaxValue, System.Numerics.ISubtractionOperators, System.Numerics.ISubtractionOperators, System.Runtime.Serialization.ISerializable { private readonly int _dummyPrimitive; public static readonly System.DateTime MaxValue; @@ -1511,7 +1515,6 @@ public static partial class Convert public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.DateTimeKind kind) { throw null; } public DateTime(long ticks) { throw null; } public DateTime(long ticks, System.DateTimeKind kind) { throw null; } - public static System.TimeSpan AdditiveIdentity { get { throw null; } } public System.DateTime Date { get { throw null; } } public int Day { get { throw null; } } public System.DayOfWeek DayOfWeek { get { throw null; } } @@ -1523,8 +1526,9 @@ public static partial class Convert public int Month { get { throw null; } } public static System.DateTime Now { get { throw null; } } public int Second { get { throw null; } } - static System.DateTime System.IMinMaxValue.MaxValue { get { throw null; } } - static System.DateTime System.IMinMaxValue.MinValue { get { throw null; } } + static System.TimeSpan System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static System.DateTime System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static System.DateTime System.Numerics.IMinMaxValue.MinValue { get { throw null; } } public long Ticks { get { throw null; } } public System.TimeSpan TimeOfDay { get { throw null; } } public static System.DateTime Today { get { throw null; } } @@ -1628,7 +1632,7 @@ public enum DateTimeKind Utc = 1, Local = 2, } - public readonly partial struct DateTimeOffset : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IMinMaxValue, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.ISubtractionOperators, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable + public readonly partial struct DateTimeOffset : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IEqualityOperators, System.Numerics.IMinMaxValue, System.Numerics.ISubtractionOperators, System.Numerics.ISubtractionOperators, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { private readonly int _dummyPrimitive; public static readonly System.DateTimeOffset MaxValue; @@ -1640,7 +1644,6 @@ public enum DateTimeKind public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.TimeSpan offset) { throw null; } public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, System.TimeSpan offset) { throw null; } public DateTimeOffset(long ticks, System.TimeSpan offset) { throw null; } - public static System.TimeSpan AdditiveIdentity { get { throw null; } } public System.DateTime Date { get { throw null; } } public System.DateTime DateTime { get { throw null; } } public int Day { get { throw null; } } @@ -1654,8 +1657,9 @@ public enum DateTimeKind public static System.DateTimeOffset Now { get { throw null; } } public System.TimeSpan Offset { get { throw null; } } public int Second { get { throw null; } } - static System.DateTimeOffset System.IMinMaxValue.MaxValue { get { throw null; } } - static System.DateTimeOffset System.IMinMaxValue.MinValue { get { throw null; } } + static System.TimeSpan System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static System.DateTimeOffset System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static System.DateTimeOffset System.Numerics.IMinMaxValue.MinValue { get { throw null; } } public long Ticks { get { throw null; } } public System.TimeSpan TimeOfDay { get { throw null; } } public System.DateTime UtcDateTime { get { throw null; } } @@ -1762,11 +1766,9 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } } - public readonly partial struct Decimal : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable + public readonly partial struct Decimal : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IFloatingPoint, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { private readonly int _dummyPrimitive; - [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)0)] - public static readonly decimal AdditiveIdentity; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)4294967295, (uint)4294967295, (uint)4294967295)] public static readonly decimal MaxValue; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)] @@ -1774,10 +1776,6 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)4294967295, (uint)4294967295, (uint)4294967295)] public static readonly decimal MinValue; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)1)] - public static readonly decimal MultiplicativeIdentity; - [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)] - public static readonly decimal NegativeOne; - [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)1)] public static readonly decimal One; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)0)] public static readonly decimal Zero; @@ -1793,13 +1791,13 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S [System.CLSCompliantAttribute(false)] public Decimal(ulong value) { throw null; } public byte Scale { get { throw null; } } - static decimal System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static decimal System.IMinMaxValue.MaxValue { get { throw null; } } - static decimal System.IMinMaxValue.MinValue { get { throw null; } } - static decimal System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static decimal System.INumber.One { get { throw null; } } - static decimal System.INumber.Zero { get { throw null; } } - static decimal System.ISignedNumber.NegativeOne { get { throw null; } } + static decimal System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static decimal System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static decimal System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static decimal System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static decimal System.Numerics.INumberBase.One { get { throw null; } } + static decimal System.Numerics.INumberBase.Zero { get { throw null; } } + static decimal System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Decimal Abs(System.Decimal value) { throw null; } public static System.Decimal Add(System.Decimal d1, System.Decimal d2) { throw null; } public static System.Decimal Ceiling(System.Decimal d) { throw null; } @@ -1807,11 +1805,11 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static int Compare(System.Decimal d1, System.Decimal d2) { throw null; } public int CompareTo(System.Decimal value) { throw null; } public int CompareTo(object? value) { throw null; } - public static System.Decimal CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Decimal CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Decimal Create(TOther value) where TOther : INumber { throw null; } + public static System.Decimal CopySign(System.Decimal value, System.Decimal sign) { throw null; } + public static System.Decimal CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Decimal CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Decimal CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static System.Decimal Divide(System.Decimal d1, System.Decimal d2) { throw null; } - public static (decimal Quotient, decimal Remainder) DivRem(System.Decimal left, System.Decimal right) { throw null; } public bool Equals(System.Decimal value) { throw null; } public static bool Equals(System.Decimal d1, System.Decimal d2) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; } @@ -1821,8 +1819,11 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static int GetBits(System.Decimal d, System.Span destination) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } + public static bool IsNegative(System.Decimal value) { throw null; } public static System.Decimal Max(System.Decimal x, System.Decimal y) { throw null; } + public static System.Decimal MaxMagnitude(System.Decimal x, System.Decimal y) { throw null; } public static System.Decimal Min(System.Decimal x, System.Decimal y) { throw null; } + public static System.Decimal MinMagnitude(System.Decimal x, System.Decimal y) { throw null; } public static System.Decimal Multiply(System.Decimal d1, System.Decimal d2) { throw null; } public static System.Decimal Negate(System.Decimal d) { throw null; } public static System.Decimal operator +(System.Decimal d1, System.Decimal d2) { throw null; } @@ -1881,6 +1882,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static System.Decimal Round(System.Decimal d, int decimals) { throw null; } public static System.Decimal Round(System.Decimal d, int decimals, System.MidpointRounding mode) { throw null; } public static System.Decimal Round(System.Decimal d, System.MidpointRounding mode) { throw null; } + public static int Sign(System.Decimal d) { throw null; } public static System.Decimal Subtract(System.Decimal d1, System.Decimal d2) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } @@ -1897,7 +1899,6 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Decimal System.INumber.Sign(System.Decimal value) { throw null; } void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public static byte ToByte(System.Decimal value) { throw null; } @@ -1920,7 +1921,7 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser [System.CLSCompliantAttribute(false)] public static ulong ToUInt64(System.Decimal d) { throw null; } public static System.Decimal Truncate(System.Decimal d) { throw null; } - public static bool TryCreate(TOther value, out System.Decimal result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Decimal result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryGetBits(System.Decimal d, System.Span destination, out int valuesWritten) { throw null; } public static bool TryParse(System.ReadOnlySpan s, out System.Decimal result) { throw null; } @@ -1976,39 +1977,34 @@ protected DivideByZeroException(System.Runtime.Serialization.SerializationInfo i public DivideByZeroException(string? message) { } public DivideByZeroException(string? message, System.Exception? innerException) { } } - public readonly partial struct Double : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryFloatingPoint, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFloatingPoint, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Double : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryFloatingPointIeee754, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IExponentialFunctions, System.Numerics.IFloatingPoint, System.Numerics.IFloatingPointIeee754, System.Numerics.IHyperbolicFunctions, System.Numerics.IIncrementOperators, System.Numerics.ILogarithmicFunctions, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IPowerFunctions, System.Numerics.IRootFunctions, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.ITrigonometricFunctions, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly double _dummyPrimitive; - public const double AdditiveIdentity = 0; public const double E = 2.718281828459045; public const double Epsilon = 5E-324; public const double MaxValue = 1.7976931348623157E+308; public const double MinValue = -1.7976931348623157E+308; - public const double MultiplicativeIdentity = 1; public const double NaN = 0.0 / 0.0; public const double NegativeInfinity = -1.0 / 0.0; - public const double NegativeOne = -1; public const double NegativeZero = -0; - public const double One = 1; public const double Pi = 3.141592653589793; public const double PositiveInfinity = 1.0 / 0.0; public const double Tau = 6.283185307179586; - public const double Zero = 0; - static double System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static double System.IFloatingPoint.E { get { throw null; } } - static double System.IFloatingPoint.Epsilon { get { throw null; } } - static double System.IFloatingPoint.NaN { get { throw null; } } - static double System.IFloatingPoint.NegativeInfinity { get { throw null; } } - static double System.IFloatingPoint.NegativeZero { get { throw null; } } - static double System.IFloatingPoint.Pi { get { throw null; } } - static double System.IFloatingPoint.PositiveInfinity { get { throw null; } } - static double System.IFloatingPoint.Tau { get { throw null; } } - static double System.IMinMaxValue.MaxValue { get { throw null; } } - static double System.IMinMaxValue.MinValue { get { throw null; } } - static double System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static double System.INumber.One { get { throw null; } } - static double System.INumber.Zero { get { throw null; } } - static double System.ISignedNumber.NegativeOne { get { throw null; } } + static double System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.E { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.Epsilon { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.NaN { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.NegativeInfinity { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.NegativeZero { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.Pi { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.PositiveInfinity { get { throw null; } } + static double System.Numerics.IFloatingPointIeee754.Tau { get { throw null; } } + static double System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static double System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static double System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static double System.Numerics.INumberBase.One { get { throw null; } } + static double System.Numerics.INumberBase.Zero { get { throw null; } } + static double System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Double Abs(System.Double value) { throw null; } public static System.Double Acos(System.Double x) { throw null; } public static System.Double Acosh(System.Double x) { throw null; } @@ -2027,10 +2023,9 @@ public DivideByZeroException(string? message, System.Exception? innerException) public static System.Double CopySign(System.Double x, System.Double y) { throw null; } public static System.Double Cos(System.Double x) { throw null; } public static System.Double Cosh(System.Double x) { throw null; } - public static System.Double CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Double CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Double Create(TOther value) where TOther : INumber { throw null; } - public static (double Quotient, double Remainder) DivRem(System.Double left, System.Double right) { throw null; } + public static System.Double CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Double CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Double CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public bool Equals(System.Double obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public static System.Double Exp(System.Double x) { throw null; } @@ -2038,8 +2033,8 @@ public DivideByZeroException(string? message, System.Exception? innerException) public static System.Double FusedMultiplyAdd(System.Double left, System.Double right, System.Double addend) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } - public static System.Double IEEERemainder(System.Double left, System.Double right) { throw null; } - public static TInteger ILogB(System.Double x) where TInteger : IBinaryInteger { throw null; } + public static System.Double Ieee754Remainder(System.Double left, System.Double right) { throw null; } + public static int ILogB(System.Double x) { throw null; } public static bool IsFinite(System.Double d) { throw null; } public static bool IsInfinity(System.Double d) { throw null; } public static bool IsNaN(System.Double d) { throw null; } @@ -2073,20 +2068,15 @@ public DivideByZeroException(string? message, System.Exception? innerException) public static System.Double ReciprocalEstimate(System.Double x) { throw null; } public static System.Double ReciprocalSqrtEstimate(System.Double x) { throw null; } public static System.Double Round(System.Double x) { throw null; } + public static System.Double Round(System.Double x, int digits) { throw null; } + public static System.Double Round(System.Double x, int digits, System.MidpointRounding mode) { throw null; } public static System.Double Round(System.Double x, System.MidpointRounding mode) { throw null; } - public static System.Double Round(System.Double x, TInteger digits) where TInteger : IBinaryInteger { throw null; } - public static System.Double Round(System.Double x, TInteger digits, System.MidpointRounding mode) where TInteger : IBinaryInteger { throw null; } - public static System.Double ScaleB(System.Double x, TInteger n) where TInteger : IBinaryInteger { throw null; } - public static System.Double Sign(System.Double value) { throw null; } + public static System.Double ScaleB(System.Double x, int n) { throw null; } + public static int Sign(System.Double value) { throw null; } public static System.Double Sin(System.Double x) { throw null; } public static (System.Double Sin, System.Double Cos) SinCos(System.Double x) { throw null; } public static System.Double Sinh(System.Double x) { throw null; } public static System.Double Sqrt(System.Double x) { throw null; } - static System.Double System.IAdditionOperators.operator +(System.Double left, System.Double right) { throw null; } - static System.Double System.IBitwiseOperators.operator &(System.Double left, System.Double right) { throw null; } - static System.Double System.IBitwiseOperators.operator |(System.Double left, System.Double right) { throw null; } - static System.Double System.IBitwiseOperators.operator ^(System.Double left, System.Double right) { throw null; } - static System.Double System.IBitwiseOperators.operator ~(System.Double value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -2102,14 +2092,19 @@ public DivideByZeroException(string? message, System.Exception? innerException) ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Double System.IDecrementOperators.operator --(System.Double value) { throw null; } - static System.Double System.IDivisionOperators.operator /(System.Double left, System.Double right) { throw null; } - static System.Double System.IIncrementOperators.operator ++(System.Double value) { throw null; } - static System.Double System.IModulusOperators.operator %(System.Double left, System.Double right) { throw null; } - static System.Double System.IMultiplyOperators.operator *(System.Double left, System.Double right) { throw null; } - static System.Double System.ISubtractionOperators.operator -(System.Double left, System.Double right) { throw null; } - static System.Double System.IUnaryNegationOperators.operator -(System.Double value) { throw null; } - static System.Double System.IUnaryPlusOperators.operator +(System.Double value) { throw null; } + static System.Double System.Numerics.IAdditionOperators.operator +(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IBitwiseOperators.operator &(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IBitwiseOperators.operator |(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IBitwiseOperators.operator ^(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IBitwiseOperators.operator ~(System.Double value) { throw null; } + static System.Double System.Numerics.IDecrementOperators.operator --(System.Double value) { throw null; } + static System.Double System.Numerics.IDivisionOperators.operator /(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IIncrementOperators.operator ++(System.Double value) { throw null; } + static System.Double System.Numerics.IModulusOperators.operator %(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IMultiplyOperators.operator *(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.ISubtractionOperators.operator -(System.Double left, System.Double right) { throw null; } + static System.Double System.Numerics.IUnaryNegationOperators.operator -(System.Double value) { throw null; } + static System.Double System.Numerics.IUnaryPlusOperators.operator +(System.Double value) { throw null; } public static System.Double Tan(System.Double x) { throw null; } public static System.Double Tanh(System.Double x) { throw null; } public override string ToString() { throw null; } @@ -2117,7 +2112,7 @@ public DivideByZeroException(string? message, System.Exception? innerException) public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Double Truncate(System.Double x) { throw null; } - public static bool TryCreate(TOther value, out System.Double result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Double result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, out System.Double result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; } @@ -2520,7 +2515,7 @@ public partial class GopherStyleUriParser : System.UriParser { public GopherStyleUriParser() { } } - public readonly partial struct Guid : System.IComparable, System.IComparable, System.IComparisonOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IParseable, System.ISpanFormattable, System.ISpanParseable + public readonly partial struct Guid : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IComparisonOperators, System.Numerics.IEqualityOperators { private readonly int _dummyPrimitive; public static readonly System.Guid Empty; @@ -2563,10 +2558,9 @@ public GopherStyleUriParser() { } public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.Guid result) { throw null; } public bool TryWriteBytes(System.Span destination) { throw null; } } - public readonly partial struct Half : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryFloatingPoint, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFloatingPoint, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Half : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryFloatingPointIeee754, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IExponentialFunctions, System.Numerics.IFloatingPoint, System.Numerics.IFloatingPointIeee754, System.Numerics.IHyperbolicFunctions, System.Numerics.IIncrementOperators, System.Numerics.ILogarithmicFunctions, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IPowerFunctions, System.Numerics.IRootFunctions, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.ITrigonometricFunctions, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly int _dummyPrimitive; - public static System.Half AdditiveIdentity { get { throw null; } } public static System.Half E { get { throw null; } } public static System.Half Epsilon { get { throw null; } } public static System.Half MaxValue { get { throw null; } } @@ -2574,13 +2568,14 @@ public GopherStyleUriParser() { } public static System.Half MultiplicativeIdentity { get { throw null; } } public static System.Half NaN { get { throw null; } } public static System.Half NegativeInfinity { get { throw null; } } - public static System.Half NegativeOne { get { throw null; } } public static System.Half NegativeZero { get { throw null; } } - public static System.Half One { get { throw null; } } public static System.Half Pi { get { throw null; } } public static System.Half PositiveInfinity { get { throw null; } } + static System.Half System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static System.Half System.Numerics.INumberBase.One { get { throw null; } } + static System.Half System.Numerics.INumberBase.Zero { get { throw null; } } + static System.Half System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Half Tau { get { throw null; } } - public static System.Half Zero { get { throw null; } } public static System.Half Abs(System.Half value) { throw null; } public static System.Half Acos(System.Half x) { throw null; } public static System.Half Acosh(System.Half x) { throw null; } @@ -2599,18 +2594,17 @@ public GopherStyleUriParser() { } public static System.Half CopySign(System.Half x, System.Half y) { throw null; } public static System.Half Cos(System.Half x) { throw null; } public static System.Half Cosh(System.Half x) { throw null; } - public static System.Half CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Half CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Half Create(TOther value) where TOther : INumber { throw null; } - public static (System.Half Quotient, System.Half Remainder) DivRem(System.Half left, System.Half right) { throw null; } + public static System.Half CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Half CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Half CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public bool Equals(System.Half other) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public static System.Half Exp(System.Half x) { throw null; } public static System.Half Floor(System.Half x) { throw null; } public static System.Half FusedMultiplyAdd(System.Half left, System.Half right, System.Half addend) { throw null; } public override int GetHashCode() { throw null; } - public static System.Half IEEERemainder(System.Half left, System.Half right) { throw null; } - public static TInteger ILogB(System.Half x) where TInteger : IBinaryInteger { throw null; } + public static System.Half Ieee754Remainder(System.Half left, System.Half right) { throw null; } + public static int ILogB(System.Half x) { throw null; } public static bool IsFinite(System.Half value) { throw null; } public static bool IsInfinity(System.Half value) { throw null; } public static bool IsNaN(System.Half value) { throw null; } @@ -2657,19 +2651,19 @@ public GopherStyleUriParser() { } public static System.Half ReciprocalEstimate(System.Half x) { throw null; } public static System.Half ReciprocalSqrtEstimate(System.Half x) { throw null; } public static System.Half Round(System.Half x) { throw null; } + public static System.Half Round(System.Half x, int digits) { throw null; } + public static System.Half Round(System.Half x, int digits, System.MidpointRounding mode) { throw null; } public static System.Half Round(System.Half x, System.MidpointRounding mode) { throw null; } - public static System.Half Round(System.Half x, TInteger digits) where TInteger : IBinaryInteger { throw null; } - public static System.Half Round(System.Half x, TInteger digits, System.MidpointRounding mode) where TInteger : IBinaryInteger { throw null; } - public static System.Half ScaleB(System.Half x, TInteger n) where TInteger : IBinaryInteger { throw null; } - public static System.Half Sign(System.Half value) { throw null; } + public static System.Half ScaleB(System.Half x, int n) { throw null; } + public static int Sign(System.Half value) { throw null; } public static System.Half Sin(System.Half x) { throw null; } public static (System.Half Sin, System.Half Cos) SinCos(System.Half x) { throw null; } public static System.Half Sinh(System.Half x) { throw null; } public static System.Half Sqrt(System.Half x) { throw null; } - static System.Half System.IBitwiseOperators.operator &(System.Half left, System.Half right) { throw null; } - static System.Half System.IBitwiseOperators.operator |(System.Half left, System.Half right) { throw null; } - static System.Half System.IBitwiseOperators.operator ^(System.Half left, System.Half right) { throw null; } - static System.Half System.IBitwiseOperators.operator ~(System.Half value) { throw null; } + static System.Half System.Numerics.IBitwiseOperators.operator &(System.Half left, System.Half right) { throw null; } + static System.Half System.Numerics.IBitwiseOperators.operator |(System.Half left, System.Half right) { throw null; } + static System.Half System.Numerics.IBitwiseOperators.operator ^(System.Half left, System.Half right) { throw null; } + static System.Half System.Numerics.IBitwiseOperators.operator ~(System.Half value) { throw null; } public static System.Half Tan(System.Half x) { throw null; } public static System.Half Tanh(System.Half x) { throw null; } public override string ToString() { throw null; } @@ -2677,7 +2671,7 @@ public GopherStyleUriParser() { } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Half Truncate(System.Half x) { throw null; } - public static bool TryCreate(TOther value, out System.Half result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Half result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, out System.Half result) { throw null; } @@ -2712,215 +2706,6 @@ public partial class HttpStyleUriParser : System.UriParser { public HttpStyleUriParser() { } } - public partial interface IAdditionOperators - where TSelf : System.IAdditionOperators - { - static abstract TResult operator +(TSelf left, TOther right); - } - public partial interface IAdditiveIdentity - where TSelf : System.IAdditiveIdentity - { - static abstract TResult AdditiveIdentity { get; } - } - public partial interface IBinaryFloatingPoint : System.IBinaryNumber, System.IFloatingPoint - where TSelf : IBinaryFloatingPoint - { - } - public partial interface IBinaryInteger : System.IBinaryNumber, System.IShiftOperators - where TSelf : IBinaryInteger - { - static abstract TSelf LeadingZeroCount(TSelf value); - static abstract TSelf PopCount(TSelf value); - static abstract TSelf RotateLeft(TSelf value, int rotateAmount); - static abstract TSelf RotateRight(TSelf value, int rotateAmount); - static abstract TSelf TrailingZeroCount(TSelf value); - } - public partial interface IBinaryNumber : System.IBitwiseOperators, System.INumber - where TSelf : IBinaryNumber - { - static abstract bool IsPow2(TSelf value); - static abstract TSelf Log2(TSelf value); - } - public partial interface IBitwiseOperators - where TSelf : System.IBitwiseOperators - { - static abstract TResult operator &(TSelf left, TOther right); - static abstract TResult operator |(TSelf left, TOther right); - static abstract TResult operator ^(TSelf left, TOther right); - static abstract TResult operator ~(TSelf value); - } - public partial interface IComparisonOperators : System.IComparable, System.IComparable, System.IEqualityOperators - where TSelf : IComparisonOperators - { - static abstract bool operator <(TSelf left, TOther right); - static abstract bool operator <=(TSelf left, TOther right); - static abstract bool operator >(TSelf left, TOther right); - static abstract bool operator >=(TSelf left, TOther right); - } - public partial interface IDecrementOperators - where TSelf : System.IDecrementOperators - { - static abstract TSelf operator --(TSelf value); - } - public partial interface IDivisionOperators - where TSelf : System.IDivisionOperators - { - static abstract TResult operator /(TSelf left, TOther right); - } - public partial interface IEqualityOperators : IEquatable - where TSelf : System.IEqualityOperators - { - static abstract bool operator ==(TSelf left, TOther right); - static abstract bool operator !=(TSelf left, TOther right); - } - public partial interface IFloatingPoint : System.ISignedNumber - where TSelf : System.IFloatingPoint - { - static abstract TSelf E { get; } - static abstract TSelf Epsilon { get; } - static abstract TSelf NaN { get; } - static abstract TSelf NegativeInfinity { get; } - static abstract TSelf NegativeZero { get; } - static abstract TSelf Pi { get; } - static abstract TSelf PositiveInfinity { get; } - static abstract TSelf Tau { get; } - static abstract TSelf Acos(TSelf x); - static abstract TSelf Acosh(TSelf x); - static abstract TSelf Asin(TSelf x); - static abstract TSelf Asinh(TSelf x); - static abstract TSelf Atan(TSelf x); - static abstract TSelf Atan2(TSelf y, TSelf x); - static abstract TSelf Atanh(TSelf x); - static abstract TSelf BitIncrement(TSelf x); - static abstract TSelf BitDecrement(TSelf x); - static abstract TSelf Cbrt(TSelf x); - static abstract TSelf Ceiling(TSelf x); - static abstract TSelf CopySign(TSelf x, TSelf y); - static abstract TSelf Cos(TSelf x); - static abstract TSelf Cosh(TSelf x); - static abstract TSelf Exp(TSelf x); - static abstract TSelf Floor(TSelf x); - static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend); - static abstract TSelf IEEERemainder(TSelf left, TSelf right); - static abstract TInteger ILogB(TSelf x) where TInteger : IBinaryInteger; - static abstract bool IsFinite(TSelf value); - static abstract bool IsInfinity(TSelf value); - static abstract bool IsNaN(TSelf value); - static abstract bool IsNegative(TSelf value); - static abstract bool IsNegativeInfinity(TSelf value); - static abstract bool IsNormal(TSelf value); - static abstract bool IsPositiveInfinity(TSelf value); - static abstract bool IsSubnormal(TSelf value); - static abstract TSelf Log(TSelf x); - static abstract TSelf Log(TSelf x, TSelf newBase); - static abstract TSelf Log2(TSelf x); - static abstract TSelf Log10(TSelf x); - static abstract TSelf MaxMagnitude(TSelf x, TSelf y); - static abstract TSelf MinMagnitude(TSelf x, TSelf y); - static abstract TSelf Pow(TSelf x, TSelf y); - static abstract TSelf ReciprocalEstimate(TSelf x); - static abstract TSelf ReciprocalSqrtEstimate(TSelf x); - static abstract TSelf Round(TSelf x); - static abstract TSelf Round(TSelf x, TInteger digits) where TInteger : IBinaryInteger; - static abstract TSelf Round(TSelf x, MidpointRounding mode); - static abstract TSelf Round(TSelf x, TInteger digits, MidpointRounding mode) where TInteger : IBinaryInteger; - static abstract TSelf ScaleB(TSelf x, TInteger n) where TInteger : IBinaryInteger; - static abstract TSelf Sin(TSelf x); - static abstract (TSelf Sin, TSelf Cos) SinCos(TSelf x); - static abstract TSelf Sinh(TSelf x); - static abstract TSelf Sqrt(TSelf x); - static abstract TSelf Tan(TSelf x); - static abstract TSelf Tanh(TSelf x); - static abstract TSelf Truncate(TSelf x); - } - public partial interface IIncrementOperators - where TSelf : System.IIncrementOperators - { - static abstract TSelf operator ++(TSelf value); - } - public partial interface IMinMaxValue - where TSelf : System.IMinMaxValue - { - static abstract TSelf MinValue { get; } - static abstract TSelf MaxValue { get; } - } - public partial interface IModulusOperators - where TSelf : System.IModulusOperators - { - static abstract TResult operator %(TSelf left, TOther right); - } - public partial interface IMultiplicativeIdentity - where TSelf : System.IMultiplicativeIdentity - { - static abstract TResult MultiplicativeIdentity { get; } - } - public partial interface IMultiplyOperators - where TSelf : System.IMultiplyOperators - { - static abstract TResult operator *(TSelf left, TOther right); - } - public partial interface INumber : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDecrementOperators, System.IDivisionOperators, System.IEquatable, System.IEqualityOperators, System.IFormattable, System.IIncrementOperators, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators - where TSelf : System.INumber - { - static abstract TSelf One { get; } - static abstract TSelf Zero { get; } - static abstract TSelf Abs(TSelf value); - static abstract TSelf Clamp(TSelf value, TSelf min, TSelf max); - static abstract TSelf Create(TOther value) where TOther : INumber; - static abstract TSelf CreateSaturating(TOther value) where TOther : INumber; - static abstract TSelf CreateTruncating(TOther value) where TOther : INumber; - static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right); - static abstract TSelf Max(TSelf x, TSelf y); - static abstract TSelf Min(TSelf x, TSelf y); - static abstract TSelf Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider); - static abstract TSelf Parse(ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider); - static abstract TSelf Sign(TSelf value); - static abstract bool TryCreate(TOther value, out TSelf result) where TOther : INumber; - static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out TSelf result); - static abstract bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result); - } - public partial interface IParseable - where TSelf : System.IParseable - { - static abstract TSelf Parse(string s, System.IFormatProvider? provider); - static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out TSelf result); - } - public partial interface IShiftOperators - where TSelf : System.IShiftOperators - { - static abstract TResult operator <<(TSelf value, int shiftAmount); - static abstract TResult operator >>(TSelf value, int shiftAmount); - } - public partial interface ISignedNumber : System.INumber, System.IUnaryNegationOperators - where TSelf : System.ISignedNumber - { - static abstract TSelf NegativeOne { get; } - } - public partial interface ISpanParseable : System.IParseable - where TSelf : System.ISpanParseable - { - static abstract TSelf Parse(System.ReadOnlySpan s, System.IFormatProvider? provider); - static abstract bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out TSelf result); - } - public partial interface ISubtractionOperators - where TSelf : System.ISubtractionOperators - { - static abstract TResult operator -(TSelf left, TOther right); - } - public partial interface IUnaryNegationOperators - where TSelf : System.IUnaryNegationOperators - { - static abstract TResult operator -(TSelf value); - } - public partial interface IUnaryPlusOperators - where TSelf : System.IUnaryPlusOperators - { - static abstract TResult operator +(TSelf value); - } - public partial interface IUnsignedNumber : System.INumber - where TSelf : IUnsignedNumber - { - } public partial interface IAsyncDisposable { System.Threading.Tasks.ValueTask DisposeAsync(); @@ -3020,40 +2805,39 @@ public InsufficientMemoryException() { } public InsufficientMemoryException(string? message) { } public InsufficientMemoryException(string? message, System.Exception? innerException) { } } - public readonly partial struct Int16 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Int16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly short _dummyPrimitive; - public const short AdditiveIdentity = (short)0; public const short MaxValue = (short)32767; public const short MinValue = (short)-32768; - public const short MultiplicativeIdentity = (short)1; - public const short NegativeOne = (short)-1; - public const short One = (short)1; - public const short Zero = (short)0; - static short System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static short System.IMinMaxValue.MaxValue { get { throw null; } } - static short System.IMinMaxValue.MinValue { get { throw null; } } - static short System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static short System.INumber.One { get { throw null; } } - static short System.INumber.Zero { get { throw null; } } - static short System.ISignedNumber.NegativeOne { get { throw null; } } + static short System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static short System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static short System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static short System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static short System.Numerics.INumberBase.One { get { throw null; } } + static short System.Numerics.INumberBase.Zero { get { throw null; } } + static short System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Int16 Abs(System.Int16 value) { throw null; } public static System.Int16 Clamp(System.Int16 value, System.Int16 min, System.Int16 max) { throw null; } public int CompareTo(System.Int16 value) { throw null; } public int CompareTo(object? value) { throw null; } - public static System.Int16 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Int16 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Int16 Create(TOther value) where TOther : INumber { throw null; } + public static System.Int16 CopySign(System.Int16 value, System.Int16 sign) { throw null; } + public static System.Int16 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int16 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int16 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (short Quotient, short Remainder) DivRem(System.Int16 left, System.Int16 right) { throw null; } public bool Equals(System.Int16 obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } + public static bool IsNegative(System.Int16 value) { throw null; } public static bool IsPow2(System.Int16 value) { throw null; } public static System.Int16 LeadingZeroCount(System.Int16 value) { throw null; } public static System.Int16 Log2(System.Int16 value) { throw null; } public static System.Int16 Max(System.Int16 x, System.Int16 y) { throw null; } + public static System.Int16 MaxMagnitude(System.Int16 x, System.Int16 y) { throw null; } public static System.Int16 Min(System.Int16 x, System.Int16 y) { throw null; } + public static System.Int16 MinMagnitude(System.Int16 x, System.Int16 y) { throw null; } public static System.Int16 Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; } public static System.Int16 Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } public static System.Int16 Parse(string s) { throw null; } @@ -3063,16 +2847,7 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static System.Int16 PopCount(System.Int16 value) { throw null; } public static System.Int16 RotateLeft(System.Int16 value, int rotateAmount) { throw null; } public static System.Int16 RotateRight(System.Int16 value, int rotateAmount) { throw null; } - public static System.Int16 Sign(System.Int16 value) { throw null; } - static System.Int16 System.IAdditionOperators.operator +(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IBitwiseOperators.operator &(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IBitwiseOperators.operator |(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IBitwiseOperators.operator ^(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IBitwiseOperators.operator ~(System.Int16 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.Int16 left, System.Int16 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.Int16 left, System.Int16 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.Int16 left, System.Int16 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.Int16 left, System.Int16 right) { throw null; } + public static int Sign(System.Int16 value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -3088,24 +2863,33 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Int16 System.IDecrementOperators.operator --(System.Int16 value) { throw null; } - static System.Int16 System.IDivisionOperators.operator /(System.Int16 left, System.Int16 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.Int16 left, System.Int16 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IIncrementOperators.operator ++(System.Int16 value) { throw null; } - static System.Int16 System.IModulusOperators.operator %(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IMultiplyOperators.operator *(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IShiftOperators.operator <<(System.Int16 value, int shiftAmount) { throw null; } - static System.Int16 System.IShiftOperators.operator >>(System.Int16 value, int shiftAmount) { throw null; } - static System.Int16 System.ISubtractionOperators.operator -(System.Int16 left, System.Int16 right) { throw null; } - static System.Int16 System.IUnaryNegationOperators.operator -(System.Int16 value) { throw null; } - static System.Int16 System.IUnaryPlusOperators.operator +(System.Int16 value) { throw null; } + static System.Int16 System.Numerics.IAdditionOperators.operator +(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IBitwiseOperators.operator &(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IBitwiseOperators.operator |(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IBitwiseOperators.operator ^(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IBitwiseOperators.operator ~(System.Int16 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.Int16 left, System.Int16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.Int16 left, System.Int16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.Int16 left, System.Int16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IDecrementOperators.operator --(System.Int16 value) { throw null; } + static System.Int16 System.Numerics.IDivisionOperators.operator /(System.Int16 left, System.Int16 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.Int16 left, System.Int16 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IIncrementOperators.operator ++(System.Int16 value) { throw null; } + static System.Int16 System.Numerics.IModulusOperators.operator %(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IMultiplyOperators.operator *(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IShiftOperators.operator <<(System.Int16 value, int shiftAmount) { throw null; } + static System.Int16 System.Numerics.IShiftOperators.operator >>(System.Int16 value, int shiftAmount) { throw null; } + static System.Int16 System.Numerics.ISubtractionOperators.operator -(System.Int16 left, System.Int16 right) { throw null; } + static System.Int16 System.Numerics.IUnaryNegationOperators.operator -(System.Int16 value) { throw null; } + static System.Int16 System.Numerics.IUnaryPlusOperators.operator +(System.Int16 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Int16 TrailingZeroCount(System.Int16 value) { throw null; } - public static bool TryCreate(TOther value, out System.Int16 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Int16 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int16 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Int16 result) { throw null; } @@ -3114,40 +2898,39 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Int16 result) { throw null; } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int16 result) { throw null; } } - public readonly partial struct Int32 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Int32 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly int _dummyPrimitive; - public const int AdditiveIdentity = 0; public const int MaxValue = 2147483647; public const int MinValue = -2147483648; - public const int MultiplicativeIdentity = 1; - public const int NegativeOne = -1; - public const int One = 1; - public const int Zero = 0; - static int System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static int System.IMinMaxValue.MaxValue { get { throw null; } } - static int System.IMinMaxValue.MinValue { get { throw null; } } - static int System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static int System.INumber.One { get { throw null; } } - static int System.INumber.Zero { get { throw null; } } - static int System.ISignedNumber.NegativeOne { get { throw null; } } + static int System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static int System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static int System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static int System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static int System.Numerics.INumberBase.One { get { throw null; } } + static int System.Numerics.INumberBase.Zero { get { throw null; } } + static int System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Int32 Abs(System.Int32 value) { throw null; } public static System.Int32 Clamp(System.Int32 value, System.Int32 min, System.Int32 max) { throw null; } public System.Int32 CompareTo(System.Int32 value) { throw null; } public System.Int32 CompareTo(object? value) { throw null; } - public static System.Int32 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Int32 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Int32 Create(TOther value) where TOther : INumber { throw null; } + public static System.Int32 CopySign(System.Int32 value, System.Int32 sign) { throw null; } + public static System.Int32 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int32 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int32 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (int Quotient, int Remainder) DivRem(System.Int32 left, System.Int32 right) { throw null; } public bool Equals(System.Int32 obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override System.Int32 GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } + public static bool IsNegative(System.Int32 value) { throw null; } public static bool IsPow2(System.Int32 value) { throw null; } public static System.Int32 LeadingZeroCount(System.Int32 value) { throw null; } public static System.Int32 Log2(System.Int32 value) { throw null; } public static System.Int32 Max(System.Int32 x, System.Int32 y) { throw null; } + public static System.Int32 MaxMagnitude(System.Int32 x, System.Int32 y) { throw null; } public static System.Int32 Min(System.Int32 x, System.Int32 y) { throw null; } + public static System.Int32 MinMagnitude(System.Int32 x, System.Int32 y) { throw null; } public static System.Int32 Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; } public static System.Int32 Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } public static System.Int32 Parse(string s) { throw null; } @@ -3158,15 +2941,6 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static System.Int32 RotateLeft(System.Int32 value, System.Int32 rotateAmount) { throw null; } public static System.Int32 RotateRight(System.Int32 value, System.Int32 rotateAmount) { throw null; } public static System.Int32 Sign(System.Int32 value) { throw null; } - static System.Int32 System.IAdditionOperators.operator +(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IBitwiseOperators.operator &(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IBitwiseOperators.operator |(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IBitwiseOperators.operator ^(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IBitwiseOperators.operator ~(System.Int32 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.Int32 left, System.Int32 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.Int32 left, System.Int32 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.Int32 left, System.Int32 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.Int32 left, System.Int32 right) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -3182,24 +2956,33 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Int32 System.IDecrementOperators.operator --(System.Int32 value) { throw null; } - static System.Int32 System.IDivisionOperators.operator /(System.Int32 left, System.Int32 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.Int32 left, System.Int32 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IIncrementOperators.operator ++(System.Int32 value) { throw null; } - static System.Int32 System.IModulusOperators.operator %(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IMultiplyOperators.operator *(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IShiftOperators.operator <<(System.Int32 value, System.Int32 shiftAmount) { throw null; } - static System.Int32 System.IShiftOperators.operator >>(System.Int32 value, System.Int32 shiftAmount) { throw null; } - static System.Int32 System.ISubtractionOperators.operator -(System.Int32 left, System.Int32 right) { throw null; } - static System.Int32 System.IUnaryNegationOperators.operator -(System.Int32 value) { throw null; } - static System.Int32 System.IUnaryPlusOperators.operator +(System.Int32 value) { throw null; } + static System.Int32 System.Numerics.IAdditionOperators.operator +(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IBitwiseOperators.operator &(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IBitwiseOperators.operator |(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IBitwiseOperators.operator ^(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IBitwiseOperators.operator ~(System.Int32 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.Int32 left, System.Int32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.Int32 left, System.Int32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.Int32 left, System.Int32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IDecrementOperators.operator --(System.Int32 value) { throw null; } + static System.Int32 System.Numerics.IDivisionOperators.operator /(System.Int32 left, System.Int32 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.Int32 left, System.Int32 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IIncrementOperators.operator ++(System.Int32 value) { throw null; } + static System.Int32 System.Numerics.IModulusOperators.operator %(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IMultiplyOperators.operator *(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IShiftOperators.operator <<(System.Int32 value, System.Int32 shiftAmount) { throw null; } + static System.Int32 System.Numerics.IShiftOperators.operator >>(System.Int32 value, System.Int32 shiftAmount) { throw null; } + static System.Int32 System.Numerics.ISubtractionOperators.operator -(System.Int32 left, System.Int32 right) { throw null; } + static System.Int32 System.Numerics.IUnaryNegationOperators.operator -(System.Int32 value) { throw null; } + static System.Int32 System.Numerics.IUnaryPlusOperators.operator +(System.Int32 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Int32 TrailingZeroCount(System.Int32 value) { throw null; } - public static bool TryCreate(TOther value, out System.Int32 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Int32 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out System.Int32 charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int32 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Int32 result) { throw null; } @@ -3208,40 +2991,39 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Int32 result) { throw null; } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int32 result) { throw null; } } - public readonly partial struct Int64 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Int64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly long _dummyPrimitive; - public const long AdditiveIdentity = (long)0; public const long MaxValue = (long)9223372036854775807; public const long MinValue = (long)-9223372036854775808; - public const long MultiplicativeIdentity = (long)1; - public const long NegativeOne = (long)-1; - public const long One = (long)1; - public const long Zero = (long)0; - static long System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static long System.IMinMaxValue.MaxValue { get { throw null; } } - static long System.IMinMaxValue.MinValue { get { throw null; } } - static long System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static long System.INumber.One { get { throw null; } } - static long System.INumber.Zero { get { throw null; } } - static long System.ISignedNumber.NegativeOne { get { throw null; } } + static long System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static long System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static long System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static long System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static long System.Numerics.INumberBase.One { get { throw null; } } + static long System.Numerics.INumberBase.Zero { get { throw null; } } + static long System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Int64 Abs(System.Int64 value) { throw null; } public static System.Int64 Clamp(System.Int64 value, System.Int64 min, System.Int64 max) { throw null; } public int CompareTo(System.Int64 value) { throw null; } public int CompareTo(object? value) { throw null; } - public static System.Int64 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Int64 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Int64 Create(TOther value) where TOther : INumber { throw null; } + public static System.Int64 CopySign(System.Int64 value, System.Int64 sign) { throw null; } + public static System.Int64 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int64 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Int64 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (long Quotient, long Remainder) DivRem(System.Int64 left, System.Int64 right) { throw null; } public bool Equals(System.Int64 obj) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } + public static bool IsNegative(System.Int64 value) { throw null; } public static bool IsPow2(System.Int64 value) { throw null; } public static System.Int64 LeadingZeroCount(System.Int64 value) { throw null; } public static System.Int64 Log2(System.Int64 value) { throw null; } public static System.Int64 Max(System.Int64 x, System.Int64 y) { throw null; } + public static System.Int64 MaxMagnitude(System.Int64 x, System.Int64 y) { throw null; } public static System.Int64 Min(System.Int64 x, System.Int64 y) { throw null; } + public static System.Int64 MinMagnitude(System.Int64 x, System.Int64 y) { throw null; } public static System.Int64 Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; } public static System.Int64 Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } public static System.Int64 Parse(string s) { throw null; } @@ -3251,16 +3033,7 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static System.Int64 PopCount(System.Int64 value) { throw null; } public static System.Int64 RotateLeft(System.Int64 value, int rotateAmount) { throw null; } public static System.Int64 RotateRight(System.Int64 value, int rotateAmount) { throw null; } - public static System.Int64 Sign(System.Int64 value) { throw null; } - static System.Int64 System.IAdditionOperators.operator +(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IBitwiseOperators.operator &(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IBitwiseOperators.operator |(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IBitwiseOperators.operator ^(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IBitwiseOperators.operator ~(System.Int64 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.Int64 left, System.Int64 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.Int64 left, System.Int64 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.Int64 left, System.Int64 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.Int64 left, System.Int64 right) { throw null; } + public static int Sign(System.Int64 value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -3276,24 +3049,33 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Int64 System.IDecrementOperators.operator --(System.Int64 value) { throw null; } - static System.Int64 System.IDivisionOperators.operator /(System.Int64 left, System.Int64 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.Int64 left, System.Int64 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IIncrementOperators.operator ++(System.Int64 value) { throw null; } - static System.Int64 System.IModulusOperators.operator %(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IMultiplyOperators.operator *(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IShiftOperators.operator <<(System.Int64 value, int shiftAmount) { throw null; } - static System.Int64 System.IShiftOperators.operator >>(System.Int64 value, int shiftAmount) { throw null; } - static System.Int64 System.ISubtractionOperators.operator -(System.Int64 left, System.Int64 right) { throw null; } - static System.Int64 System.IUnaryNegationOperators.operator -(System.Int64 value) { throw null; } - static System.Int64 System.IUnaryPlusOperators.operator +(System.Int64 value) { throw null; } + static System.Int64 System.Numerics.IAdditionOperators.operator +(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IBitwiseOperators.operator &(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IBitwiseOperators.operator |(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IBitwiseOperators.operator ^(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IBitwiseOperators.operator ~(System.Int64 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.Int64 left, System.Int64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.Int64 left, System.Int64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.Int64 left, System.Int64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IDecrementOperators.operator --(System.Int64 value) { throw null; } + static System.Int64 System.Numerics.IDivisionOperators.operator /(System.Int64 left, System.Int64 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.Int64 left, System.Int64 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IIncrementOperators.operator ++(System.Int64 value) { throw null; } + static System.Int64 System.Numerics.IModulusOperators.operator %(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IMultiplyOperators.operator *(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IShiftOperators.operator <<(System.Int64 value, int shiftAmount) { throw null; } + static System.Int64 System.Numerics.IShiftOperators.operator >>(System.Int64 value, int shiftAmount) { throw null; } + static System.Int64 System.Numerics.ISubtractionOperators.operator -(System.Int64 left, System.Int64 right) { throw null; } + static System.Int64 System.Numerics.IUnaryNegationOperators.operator -(System.Int64 value) { throw null; } + static System.Int64 System.Numerics.IUnaryPlusOperators.operator +(System.Int64 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Int64 TrailingZeroCount(System.Int64 value) { throw null; } - public static bool TryCreate(TOther value, out System.Int64 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Int64 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int64 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Int64 result) { throw null; } @@ -3302,7 +3084,7 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Int64 result) { throw null; } public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int64 result) { throw null; } } - public readonly partial struct IntPtr : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.Runtime.Serialization.ISerializable + public readonly partial struct IntPtr : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Runtime.Serialization.ISerializable { private readonly int _dummyPrimitive; public static readonly System.IntPtr Zero; @@ -3313,13 +3095,13 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static System.IntPtr MaxValue { get { throw null; } } public static System.IntPtr MinValue { get { throw null; } } public static int Size { get { throw null; } } - static nint System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static nint System.IMinMaxValue.MaxValue { get { throw null; } } - static nint System.IMinMaxValue.MinValue { get { throw null; } } - static nint System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static nint System.INumber.One { get { throw null; } } - static nint System.INumber.Zero { get { throw null; } } - static nint System.ISignedNumber.NegativeOne { get { throw null; } } + static nint System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static nint System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static nint System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static nint System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static nint System.Numerics.INumberBase.One { get { throw null; } } + static nint System.Numerics.INumberBase.Zero { get { throw null; } } + static nint System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.IntPtr Add(System.IntPtr pointer, int offset) { throw null; } public int CompareTo(System.IntPtr value) { throw null; } public int CompareTo(object? value) { throw null; } @@ -3345,42 +3127,46 @@ public InsufficientMemoryException(string? message, System.Exception? innerExcep public static System.IntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } public static System.IntPtr Parse(string s, System.IFormatProvider? provider) { throw null; } public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; } - static nint System.IAdditionOperators.operator +(nint left, nint right) { throw null; } - static nint System.IBinaryInteger.LeadingZeroCount(nint value) { throw null; } - static nint System.IBinaryInteger.PopCount(nint value) { throw null; } - static nint System.IBinaryInteger.RotateLeft(nint value, int rotateAmount) { throw null; } - static nint System.IBinaryInteger.RotateRight(nint value, int rotateAmount) { throw null; } - static nint System.IBinaryInteger.TrailingZeroCount(nint value) { throw null; } - static bool System.IBinaryNumber.IsPow2(nint value) { throw null; } - static nint System.IBinaryNumber.Log2(nint value) { throw null; } - static nint System.IBitwiseOperators.operator &(nint left, nint right) { throw null; } - static nint System.IBitwiseOperators.operator |(nint left, nint right) { throw null; } - static nint System.IBitwiseOperators.operator ^(nint left, nint right) { throw null; } - static nint System.IBitwiseOperators.operator ~(nint value) { throw null; } - static bool System.IComparisonOperators.operator >(nint left, nint right) { throw null; } - static bool System.IComparisonOperators.operator >=(nint left, nint right) { throw null; } - static bool System.IComparisonOperators.operator <(nint left, nint right) { throw null; } - static bool System.IComparisonOperators.operator <=(nint left, nint right) { throw null; } - static nint System.IDecrementOperators.operator --(nint value) { throw null; } - static nint System.IDivisionOperators.operator /(nint left, nint right) { throw null; } - static nint System.IIncrementOperators.operator ++(nint value) { throw null; } - static nint System.IModulusOperators.operator %(nint left, nint right) { throw null; } - static nint System.IMultiplyOperators.operator *(nint left, nint right) { throw null; } - static nint System.INumber.Abs(nint value) { throw null; } - static nint System.INumber.Clamp(nint value, nint min, nint max) { throw null; } - static nint System.INumber.CreateSaturating(TOther value) { throw null; } - static nint System.INumber.CreateTruncating(TOther value) { throw null; } - static nint System.INumber.Create(TOther value) { throw null; } - static (nint Quotient, nint Remainder) System.INumber.DivRem(nint left, nint right) { throw null; } - static nint System.INumber.Max(nint x, nint y) { throw null; } - static nint System.INumber.Min(nint x, nint y) { throw null; } - static nint System.INumber.Sign(nint value) { throw null; } - static bool System.INumber.TryCreate(TOther value, out nint result) { throw null; } - static nint System.IShiftOperators.operator <<(nint value, int shiftAmount) { throw null; } - static nint System.IShiftOperators.operator >>(nint value, int shiftAmount) { throw null; } - static nint System.ISubtractionOperators.operator -(nint left, nint right) { throw null; } - static nint System.IUnaryNegationOperators.operator -(nint value) { throw null; } - static nint System.IUnaryPlusOperators.operator +(nint value) { throw null; } + static nint System.Numerics.IAdditionOperators.operator +(nint left, nint right) { throw null; } + static (nint Quotient, nint Remainder) System.Numerics.IBinaryInteger.DivRem(nint left, nint right) { throw null; } + static nint System.Numerics.IBinaryInteger.LeadingZeroCount(nint value) { throw null; } + static nint System.Numerics.IBinaryInteger.PopCount(nint value) { throw null; } + static nint System.Numerics.IBinaryInteger.RotateLeft(nint value, int rotateAmount) { throw null; } + static nint System.Numerics.IBinaryInteger.RotateRight(nint value, int rotateAmount) { throw null; } + static nint System.Numerics.IBinaryInteger.TrailingZeroCount(nint value) { throw null; } + static bool System.Numerics.IBinaryNumber.IsPow2(nint value) { throw null; } + static nint System.Numerics.IBinaryNumber.Log2(nint value) { throw null; } + static nint System.Numerics.IBitwiseOperators.operator &(nint left, nint right) { throw null; } + static nint System.Numerics.IBitwiseOperators.operator |(nint left, nint right) { throw null; } + static nint System.Numerics.IBitwiseOperators.operator ^(nint left, nint right) { throw null; } + static nint System.Numerics.IBitwiseOperators.operator ~(nint value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(nint left, nint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(nint left, nint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(nint left, nint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(nint left, nint right) { throw null; } + static nint System.Numerics.IDecrementOperators.operator --(nint value) { throw null; } + static nint System.Numerics.IDivisionOperators.operator /(nint left, nint right) { throw null; } + static nint System.Numerics.IIncrementOperators.operator ++(nint value) { throw null; } + static nint System.Numerics.IModulusOperators.operator %(nint left, nint right) { throw null; } + static nint System.Numerics.IMultiplyOperators.operator *(nint left, nint right) { throw null; } + static nint System.Numerics.INumber.Abs(nint value) { throw null; } + static nint System.Numerics.INumber.Clamp(nint value, nint min, nint max) { throw null; } + static nint System.Numerics.INumber.CopySign(nint value, nint sign) { throw null; } + static nint System.Numerics.INumber.CreateChecked(TOther value) { throw null; } + static nint System.Numerics.INumber.CreateSaturating(TOther value) { throw null; } + static nint System.Numerics.INumber.CreateTruncating(TOther value) { throw null; } + static bool System.Numerics.INumber.IsNegative(nint value) { throw null; } + static nint System.Numerics.INumber.Max(nint x, nint y) { throw null; } + static nint System.Numerics.INumber.MaxMagnitude(nint x, nint y) { throw null; } + static nint System.Numerics.INumber.Min(nint x, nint y) { throw null; } + static nint System.Numerics.INumber.MinMagnitude(nint x, nint y) { throw null; } + static int System.Numerics.INumber.Sign(nint value) { throw null; } + static bool System.Numerics.INumber.TryCreate(TOther value, out nint result) { throw null; } + static nint System.Numerics.IShiftOperators.operator <<(nint value, int shiftAmount) { throw null; } + static nint System.Numerics.IShiftOperators.operator >>(nint value, int shiftAmount) { throw null; } + static nint System.Numerics.ISubtractionOperators.operator -(nint left, nint right) { throw null; } + static nint System.Numerics.IUnaryNegationOperators.operator -(nint value) { throw null; } + static nint System.Numerics.IUnaryPlusOperators.operator +(nint value) { throw null; } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public int ToInt32() { throw null; } public long ToInt64() { throw null; } @@ -3436,13 +3222,23 @@ public partial interface IObserver void OnError(System.Exception error); void OnNext(T value); } + public partial interface IParsable where TSelf : System.IParsable + { + static abstract TSelf Parse(string s, System.IFormatProvider? provider); + static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out TSelf result); + } public partial interface IProgress { void Report(T value); } public partial interface ISpanFormattable : System.IFormattable { - bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider); + bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format, System.IFormatProvider? provider); + } + public partial interface ISpanParsable : System.IParsable where TSelf : System.ISpanParsable + { + static abstract TSelf Parse(System.ReadOnlySpan s, System.IFormatProvider? provider); + static abstract bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out TSelf result); } public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T> { @@ -4187,40 +3983,39 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static bool operator !=(System.RuntimeTypeHandle left, object? right) { throw null; } } [System.CLSCompliantAttribute(false)] - public readonly partial struct SByte : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct SByte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly sbyte _dummyPrimitive; - public const sbyte AdditiveIdentity = (sbyte)0; public const sbyte MaxValue = (sbyte)127; public const sbyte MinValue = (sbyte)-128; - public const sbyte MultiplicativeIdentity = (sbyte)1; - public const sbyte NegativeOne = (sbyte)-1; - public const sbyte One = (sbyte)1; - public const sbyte Zero = (sbyte)0; - static sbyte System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static sbyte System.IMinMaxValue.MaxValue { get { throw null; } } - static sbyte System.IMinMaxValue.MinValue { get { throw null; } } - static sbyte System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static sbyte System.INumber.One { get { throw null; } } - static sbyte System.INumber.Zero { get { throw null; } } - static sbyte System.ISignedNumber.NegativeOne { get { throw null; } } + static sbyte System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static sbyte System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static sbyte System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static sbyte System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static sbyte System.Numerics.INumberBase.One { get { throw null; } } + static sbyte System.Numerics.INumberBase.Zero { get { throw null; } } + static sbyte System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.SByte Abs(System.SByte value) { throw null; } public static System.SByte Clamp(System.SByte value, System.SByte min, System.SByte max) { throw null; } public int CompareTo(object? obj) { throw null; } public int CompareTo(System.SByte value) { throw null; } - public static System.SByte CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.SByte CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.SByte Create(TOther value) where TOther : INumber { throw null; } + public static System.SByte CopySign(System.SByte value, System.SByte sign) { throw null; } + public static System.SByte CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.SByte CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.SByte CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (sbyte Quotient, sbyte Remainder) DivRem(System.SByte left, System.SByte right) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public bool Equals(System.SByte obj) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } + public static bool IsNegative(System.SByte value) { throw null; } public static bool IsPow2(System.SByte value) { throw null; } public static System.SByte LeadingZeroCount(System.SByte value) { throw null; } public static System.SByte Log2(System.SByte value) { throw null; } public static System.SByte Max(System.SByte x, System.SByte y) { throw null; } + public static System.SByte MaxMagnitude(System.SByte x, System.SByte y) { throw null; } public static System.SByte Min(System.SByte x, System.SByte y) { throw null; } + public static System.SByte MinMagnitude(System.SByte x, System.SByte y) { throw null; } public static System.SByte Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; } public static System.SByte Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { throw null; } public static System.SByte Parse(string s) { throw null; } @@ -4230,16 +4025,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S public static System.SByte PopCount(System.SByte value) { throw null; } public static System.SByte RotateLeft(System.SByte value, int rotateAmount) { throw null; } public static System.SByte RotateRight(System.SByte value, int rotateAmount) { throw null; } - public static System.SByte Sign(System.SByte value) { throw null; } - static System.SByte System.IAdditionOperators.operator +(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IBitwiseOperators.operator &(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IBitwiseOperators.operator |(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IBitwiseOperators.operator ^(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IBitwiseOperators.operator ~(System.SByte value) { throw null; } - static bool System.IComparisonOperators.operator >(System.SByte left, System.SByte right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.SByte left, System.SByte right) { throw null; } - static bool System.IComparisonOperators.operator <(System.SByte left, System.SByte right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.SByte left, System.SByte right) { throw null; } + public static int Sign(System.SByte value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -4255,24 +4041,33 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.SByte System.IDecrementOperators.operator --(System.SByte value) { throw null; } - static System.SByte System.IDivisionOperators.operator /(System.SByte left, System.SByte right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.SByte left, System.SByte right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IIncrementOperators.operator ++(System.SByte value) { throw null; } - static System.SByte System.IModulusOperators.operator %(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IMultiplyOperators.operator *(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IShiftOperators.operator <<(System.SByte value, int shiftAmount) { throw null; } - static System.SByte System.IShiftOperators.operator >>(System.SByte value, int shiftAmount) { throw null; } - static System.SByte System.ISubtractionOperators.operator -(System.SByte left, System.SByte right) { throw null; } - static System.SByte System.IUnaryNegationOperators.operator -(System.SByte value) { throw null; } - static System.SByte System.IUnaryPlusOperators.operator +(System.SByte value) { throw null; } + static System.SByte System.Numerics.IAdditionOperators.operator +(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IBitwiseOperators.operator &(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IBitwiseOperators.operator |(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IBitwiseOperators.operator ^(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IBitwiseOperators.operator ~(System.SByte value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.SByte left, System.SByte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.SByte left, System.SByte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.SByte left, System.SByte right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IDecrementOperators.operator --(System.SByte value) { throw null; } + static System.SByte System.Numerics.IDivisionOperators.operator /(System.SByte left, System.SByte right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.SByte left, System.SByte right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IIncrementOperators.operator ++(System.SByte value) { throw null; } + static System.SByte System.Numerics.IModulusOperators.operator %(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IMultiplyOperators.operator *(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IShiftOperators.operator <<(System.SByte value, int shiftAmount) { throw null; } + static System.SByte System.Numerics.IShiftOperators.operator >>(System.SByte value, int shiftAmount) { throw null; } + static System.SByte System.Numerics.ISubtractionOperators.operator -(System.SByte left, System.SByte right) { throw null; } + static System.SByte System.Numerics.IUnaryNegationOperators.operator -(System.SByte value) { throw null; } + static System.SByte System.Numerics.IUnaryPlusOperators.operator +(System.SByte value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.SByte TrailingZeroCount(System.SByte value) { throw null; } - public static bool TryCreate(TOther value, out System.SByte result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.SByte result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.SByte result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.SByte result) { throw null; } @@ -4286,39 +4081,34 @@ public sealed partial class SerializableAttribute : System.Attribute { public SerializableAttribute() { } } - public readonly partial struct Single : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryFloatingPoint, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFloatingPoint, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.ISignedNumber, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct Single : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryFloatingPointIeee754, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IExponentialFunctions, System.Numerics.IFloatingPoint, System.Numerics.IFloatingPointIeee754, System.Numerics.IHyperbolicFunctions, System.Numerics.IIncrementOperators, System.Numerics.ILogarithmicFunctions, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IPowerFunctions, System.Numerics.IRootFunctions, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.ITrigonometricFunctions, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly float _dummyPrimitive; - public const float AdditiveIdentity = 0f; public const float E = 2.7182817f; public const float Epsilon = 1E-45f; public const float MaxValue = 3.4028235E+38f; public const float MinValue = -3.4028235E+38f; - public const float MultiplicativeIdentity = 1f; public const float NaN = 0.0f / 0.0f; public const float NegativeInfinity = -1.0f / 0.0f; - public const float NegativeOne = -1f; public const float NegativeZero = -0f; - public const float One = 1f; public const float Pi = 3.1415927f; public const float PositiveInfinity = 1.0f / 0.0f; public const float Tau = 6.2831855f; - public const float Zero = 0f; - static float System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static float System.IFloatingPoint.E { get { throw null; } } - static float System.IFloatingPoint.Epsilon { get { throw null; } } - static float System.IFloatingPoint.NaN { get { throw null; } } - static float System.IFloatingPoint.NegativeInfinity { get { throw null; } } - static float System.IFloatingPoint.NegativeZero { get { throw null; } } - static float System.IFloatingPoint.Pi { get { throw null; } } - static float System.IFloatingPoint.PositiveInfinity { get { throw null; } } - static float System.IFloatingPoint.Tau { get { throw null; } } - static float System.IMinMaxValue.MaxValue { get { throw null; } } - static float System.IMinMaxValue.MinValue { get { throw null; } } - static float System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static float System.INumber.One { get { throw null; } } - static float System.INumber.Zero { get { throw null; } } - static float System.ISignedNumber.NegativeOne { get { throw null; } } + static float System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.E { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.Epsilon { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.NaN { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.NegativeInfinity { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.NegativeZero { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.Pi { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.PositiveInfinity { get { throw null; } } + static float System.Numerics.IFloatingPointIeee754.Tau { get { throw null; } } + static float System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static float System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static float System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static float System.Numerics.INumberBase.One { get { throw null; } } + static float System.Numerics.INumberBase.Zero { get { throw null; } } + static float System.Numerics.ISignedNumber.NegativeOne { get { throw null; } } public static System.Single Abs(System.Single value) { throw null; } public static System.Single Acos(System.Single x) { throw null; } public static System.Single Acosh(System.Single x) { throw null; } @@ -4337,10 +4127,9 @@ public SerializableAttribute() { } public static System.Single CopySign(System.Single x, System.Single y) { throw null; } public static System.Single Cos(System.Single x) { throw null; } public static System.Single Cosh(System.Single x) { throw null; } - public static System.Single CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.Single CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.Single Create(TOther value) where TOther : INumber { throw null; } - public static (float Quotient, float Remainder) DivRem(System.Single left, System.Single right) { throw null; } + public static System.Single CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Single CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.Single CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public bool Equals(System.Single obj) { throw null; } public static System.Single Exp(System.Single x) { throw null; } @@ -4348,8 +4137,8 @@ public SerializableAttribute() { } public static System.Single FusedMultiplyAdd(System.Single left, System.Single right, System.Single addend) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } - public static System.Single IEEERemainder(System.Single left, System.Single right) { throw null; } - public static TInteger ILogB(System.Single x) where TInteger : IBinaryInteger { throw null; } + public static System.Single Ieee754Remainder(System.Single left, System.Single right) { throw null; } + public static int ILogB(System.Single x) { throw null; } public static bool IsFinite(System.Single f) { throw null; } public static bool IsInfinity(System.Single f) { throw null; } public static bool IsNaN(System.Single f) { throw null; } @@ -4383,20 +4172,15 @@ public SerializableAttribute() { } public static System.Single ReciprocalEstimate(System.Single x) { throw null; } public static System.Single ReciprocalSqrtEstimate(System.Single x) { throw null; } public static System.Single Round(System.Single x) { throw null; } + public static System.Single Round(System.Single x, int digits) { throw null; } + public static System.Single Round(System.Single x, int digits, System.MidpointRounding mode) { throw null; } public static System.Single Round(System.Single x, System.MidpointRounding mode) { throw null; } - public static System.Single Round(System.Single x, TInteger digits) where TInteger : IBinaryInteger { throw null; } - public static System.Single Round(System.Single x, TInteger digits, System.MidpointRounding mode) where TInteger : IBinaryInteger { throw null; } - public static System.Single ScaleB(System.Single x, TInteger n) where TInteger : IBinaryInteger { throw null; } - public static System.Single Sign(System.Single value) { throw null; } + public static System.Single ScaleB(System.Single x, int n) { throw null; } + public static int Sign(System.Single value) { throw null; } public static System.Single Sin(System.Single x) { throw null; } public static (System.Single Sin, System.Single Cos) SinCos(System.Single x) { throw null; } public static System.Single Sinh(System.Single x) { throw null; } public static System.Single Sqrt(System.Single x) { throw null; } - static System.Single System.IAdditionOperators.operator +(System.Single left, System.Single right) { throw null; } - static System.Single System.IBitwiseOperators.operator &(System.Single left, System.Single right) { throw null; } - static System.Single System.IBitwiseOperators.operator |(System.Single left, System.Single right) { throw null; } - static System.Single System.IBitwiseOperators.operator ^(System.Single left, System.Single right) { throw null; } - static System.Single System.IBitwiseOperators.operator ~(System.Single value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -4412,14 +4196,19 @@ public SerializableAttribute() { } ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.Single System.IDecrementOperators.operator --(System.Single value) { throw null; } - static System.Single System.IDivisionOperators.operator /(System.Single left, System.Single right) { throw null; } - static System.Single System.IIncrementOperators.operator ++(System.Single value) { throw null; } - static System.Single System.IModulusOperators.operator %(System.Single left, System.Single right) { throw null; } - static System.Single System.IMultiplyOperators.operator *(System.Single left, System.Single right) { throw null; } - static System.Single System.ISubtractionOperators.operator -(System.Single left, System.Single right) { throw null; } - static System.Single System.IUnaryNegationOperators.operator -(System.Single value) { throw null; } - static System.Single System.IUnaryPlusOperators.operator +(System.Single value) { throw null; } + static System.Single System.Numerics.IAdditionOperators.operator +(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IBitwiseOperators.operator &(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IBitwiseOperators.operator |(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IBitwiseOperators.operator ^(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IBitwiseOperators.operator ~(System.Single value) { throw null; } + static System.Single System.Numerics.IDecrementOperators.operator --(System.Single value) { throw null; } + static System.Single System.Numerics.IDivisionOperators.operator /(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IIncrementOperators.operator ++(System.Single value) { throw null; } + static System.Single System.Numerics.IModulusOperators.operator %(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IMultiplyOperators.operator *(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.ISubtractionOperators.operator -(System.Single left, System.Single right) { throw null; } + static System.Single System.Numerics.IUnaryNegationOperators.operator -(System.Single value) { throw null; } + static System.Single System.Numerics.IUnaryPlusOperators.operator +(System.Single value) { throw null; } public static System.Single Tan(System.Single x) { throw null; } public static System.Single Tanh(System.Single x) { throw null; } public override string ToString() { throw null; } @@ -4427,7 +4216,7 @@ public SerializableAttribute() { } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.Single Truncate(System.Single x) { throw null; } - public static bool TryCreate(TOther value, out System.Single result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.Single result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Single result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Single result) { throw null; } @@ -4743,7 +4532,7 @@ public partial class ThreadStaticAttribute : System.Attribute { public ThreadStaticAttribute() { } } - public readonly partial struct TimeOnly : System.IComparable, System.IComparable, System.IComparisonOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IMinMaxValue, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators + public readonly partial struct TimeOnly : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IComparisonOperators, System.Numerics.IEqualityOperators, System.Numerics.IMinMaxValue, System.Numerics.ISubtractionOperators { private readonly int _dummyPrimitive; public TimeOnly(int hour, int minute) { throw null; } @@ -4756,8 +4545,6 @@ public ThreadStaticAttribute() { } public int Minute { get { throw null; } } public static System.TimeOnly MinValue { get { throw null; } } public int Second { get { throw null; } } - static System.TimeOnly System.IMinMaxValue.MaxValue { get { throw null; } } - static System.TimeOnly System.IMinMaxValue.MinValue { get { throw null; } } public long Ticks { get { throw null; } } public System.TimeOnly Add(System.TimeSpan value) { throw null; } public System.TimeOnly Add(System.TimeSpan value, out int wrappedDays) { throw null; } @@ -4822,7 +4609,7 @@ protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, public TimeoutException(string? message) { } public TimeoutException(string? message, System.Exception? innerException) { } } - public readonly partial struct TimeSpan : System.IAdditionOperators, System.IAdditiveIdentity, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDivisionOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IMinMaxValue, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.IParseable, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators + public readonly partial struct TimeSpan : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IDivisionOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IMinMaxValue, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators { private readonly int _dummyPrimitive; public static readonly System.TimeSpan MaxValue; @@ -4837,15 +4624,15 @@ public TimeoutException(string? message, System.Exception? innerException) { } public TimeSpan(int days, int hours, int minutes, int seconds) { throw null; } public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { throw null; } public TimeSpan(long ticks) { throw null; } - public static System.TimeSpan AdditiveIdentity { get { throw null; } } public int Days { get { throw null; } } public int Hours { get { throw null; } } public int Milliseconds { get { throw null; } } public int Minutes { get { throw null; } } - public static double MultiplicativeIdentity { get { throw null; } } public int Seconds { get { throw null; } } - static System.TimeSpan System.IMinMaxValue.MaxValue { get { throw null; } } - static System.TimeSpan System.IMinMaxValue.MinValue { get { throw null; } } + static System.TimeSpan System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static System.TimeSpan System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static System.TimeSpan System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static double System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } public long Ticks { get { throw null; } } public double TotalDays { get { throw null; } } public double TotalHours { get { throw null; } } @@ -5599,28 +5386,23 @@ public TypeUnloadedException(string? message) { } public TypeUnloadedException(string? message, System.Exception? innerException) { } } [System.CLSCompliantAttribute(false)] - public readonly partial struct UInt16 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber + public readonly partial struct UInt16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber { private readonly ushort _dummyPrimitive; - public const ushort AdditiveIdentity = (ushort)0; public const ushort MaxValue = (ushort)65535; public const ushort MinValue = (ushort)0; - public const ushort MultiplicativeIdentity = (ushort)1; - public const ushort One = (ushort)1; - public const ushort Zero = (ushort)0; - static ushort System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static ushort System.IMinMaxValue.MaxValue { get { throw null; } } - static ushort System.IMinMaxValue.MinValue { get { throw null; } } - static ushort System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static ushort System.INumber.One { get { throw null; } } - static ushort System.INumber.Zero { get { throw null; } } - public static System.UInt16 Abs(System.UInt16 value) { throw null; } + static ushort System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static ushort System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static ushort System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static ushort System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static ushort System.Numerics.INumberBase.One { get { throw null; } } + static ushort System.Numerics.INumberBase.Zero { get { throw null; } } public static System.UInt16 Clamp(System.UInt16 value, System.UInt16 min, System.UInt16 max) { throw null; } public int CompareTo(object? value) { throw null; } public int CompareTo(System.UInt16 value) { throw null; } - public static System.UInt16 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.UInt16 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.UInt16 Create(TOther value) where TOther : INumber { throw null; } + public static System.UInt16 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt16 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt16 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (ushort Quotient, ushort Remainder) DivRem(System.UInt16 left, System.UInt16 right) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public bool Equals(System.UInt16 obj) { throw null; } @@ -5640,16 +5422,7 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static System.UInt16 PopCount(System.UInt16 value) { throw null; } public static System.UInt16 RotateLeft(System.UInt16 value, int rotateAmount) { throw null; } public static System.UInt16 RotateRight(System.UInt16 value, int rotateAmount) { throw null; } - public static System.UInt16 Sign(System.UInt16 value) { throw null; } - static System.UInt16 System.IAdditionOperators.operator +(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IBitwiseOperators.operator &(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IBitwiseOperators.operator |(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IBitwiseOperators.operator ^(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IBitwiseOperators.operator ~(System.UInt16 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.UInt16 left, System.UInt16 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.UInt16 left, System.UInt16 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.UInt16 left, System.UInt16 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.UInt16 left, System.UInt16 right) { throw null; } + public static int Sign(System.UInt16 value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -5665,24 +5438,38 @@ public TypeUnloadedException(string? message, System.Exception? innerException) System.UInt16 System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.UInt16 System.IDecrementOperators.operator --(System.UInt16 value) { throw null; } - static System.UInt16 System.IDivisionOperators.operator /(System.UInt16 left, System.UInt16 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.UInt16 left, System.UInt16 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IIncrementOperators.operator ++(System.UInt16 value) { throw null; } - static System.UInt16 System.IModulusOperators.operator %(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IMultiplyOperators.operator *(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IShiftOperators.operator <<(System.UInt16 value, int shiftAmount) { throw null; } - static System.UInt16 System.IShiftOperators.operator >>(System.UInt16 value, int shiftAmount) { throw null; } - static System.UInt16 System.ISubtractionOperators.operator -(System.UInt16 left, System.UInt16 right) { throw null; } - static System.UInt16 System.IUnaryNegationOperators.operator -(System.UInt16 value) { throw null; } - static System.UInt16 System.IUnaryPlusOperators.operator +(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.IAdditionOperators.operator +(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IBitwiseOperators.operator &(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IBitwiseOperators.operator |(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IBitwiseOperators.operator ^(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IBitwiseOperators.operator ~(System.UInt16 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.UInt16 left, System.UInt16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.UInt16 left, System.UInt16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.UInt16 left, System.UInt16 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IDecrementOperators.operator --(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.IDivisionOperators.operator /(System.UInt16 left, System.UInt16 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.UInt16 left, System.UInt16 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IIncrementOperators.operator ++(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.IModulusOperators.operator %(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IMultiplyOperators.operator *(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.INumber.Abs(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.INumber.CopySign(System.UInt16 value, System.UInt16 sign) { throw null; } + static bool System.Numerics.INumber.IsNegative(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.INumber.MaxMagnitude(System.UInt16 x, System.UInt16 y) { throw null; } + static System.UInt16 System.Numerics.INumber.MinMagnitude(System.UInt16 x, System.UInt16 y) { throw null; } + static System.UInt16 System.Numerics.IShiftOperators.operator <<(System.UInt16 value, int shiftAmount) { throw null; } + static System.UInt16 System.Numerics.IShiftOperators.operator >>(System.UInt16 value, int shiftAmount) { throw null; } + static System.UInt16 System.Numerics.ISubtractionOperators.operator -(System.UInt16 left, System.UInt16 right) { throw null; } + static System.UInt16 System.Numerics.IUnaryNegationOperators.operator -(System.UInt16 value) { throw null; } + static System.UInt16 System.Numerics.IUnaryPlusOperators.operator +(System.UInt16 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.UInt16 TrailingZeroCount(System.UInt16 value) { throw null; } - public static bool TryCreate(TOther value, out System.UInt16 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.UInt16 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt16 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.UInt16 result) { throw null; } @@ -5692,28 +5479,23 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt16 result) { throw null; } } [System.CLSCompliantAttribute(false)] - public readonly partial struct UInt32 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber + public readonly partial struct UInt32 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber { private readonly uint _dummyPrimitive; - public const uint AdditiveIdentity = (uint)0; public const uint MaxValue = (uint)4294967295; public const uint MinValue = (uint)0; - public const uint MultiplicativeIdentity = (uint)1; - public const uint One = (uint)1; - public const uint Zero = (uint)0; - static uint System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static uint System.IMinMaxValue.MaxValue { get { throw null; } } - static uint System.IMinMaxValue.MinValue { get { throw null; } } - static uint System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static uint System.INumber.One { get { throw null; } } - static uint System.INumber.Zero { get { throw null; } } - public static System.UInt32 Abs(System.UInt32 value) { throw null; } + static uint System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static uint System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static uint System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static uint System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static uint System.Numerics.INumberBase.One { get { throw null; } } + static uint System.Numerics.INumberBase.Zero { get { throw null; } } public static System.UInt32 Clamp(System.UInt32 value, System.UInt32 min, System.UInt32 max) { throw null; } public int CompareTo(object? value) { throw null; } public int CompareTo(System.UInt32 value) { throw null; } - public static System.UInt32 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.UInt32 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.UInt32 Create(TOther value) where TOther : INumber { throw null; } + public static System.UInt32 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt32 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt32 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (uint Quotient, uint Remainder) DivRem(System.UInt32 left, System.UInt32 right) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public bool Equals(System.UInt32 obj) { throw null; } @@ -5733,16 +5515,7 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static System.UInt32 PopCount(System.UInt32 value) { throw null; } public static System.UInt32 RotateLeft(System.UInt32 value, int rotateAmount) { throw null; } public static System.UInt32 RotateRight(System.UInt32 value, int rotateAmount) { throw null; } - public static System.UInt32 Sign(System.UInt32 value) { throw null; } - static System.UInt32 System.IAdditionOperators.operator +(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IBitwiseOperators.operator &(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IBitwiseOperators.operator |(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IBitwiseOperators.operator ^(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IBitwiseOperators.operator ~(System.UInt32 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.UInt32 left, System.UInt32 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.UInt32 left, System.UInt32 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.UInt32 left, System.UInt32 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.UInt32 left, System.UInt32 right) { throw null; } + public static int Sign(System.UInt32 value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -5758,24 +5531,38 @@ public TypeUnloadedException(string? message, System.Exception? innerException) ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } System.UInt32 System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.UInt32 System.IDecrementOperators.operator --(System.UInt32 value) { throw null; } - static System.UInt32 System.IDivisionOperators.operator /(System.UInt32 left, System.UInt32 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.UInt32 left, System.UInt32 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IIncrementOperators.operator ++(System.UInt32 value) { throw null; } - static System.UInt32 System.IModulusOperators.operator %(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IMultiplyOperators.operator *(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IShiftOperators.operator <<(System.UInt32 value, int shiftAmount) { throw null; } - static System.UInt32 System.IShiftOperators.operator >>(System.UInt32 value, int shiftAmount) { throw null; } - static System.UInt32 System.ISubtractionOperators.operator -(System.UInt32 left, System.UInt32 right) { throw null; } - static System.UInt32 System.IUnaryNegationOperators.operator -(System.UInt32 value) { throw null; } - static System.UInt32 System.IUnaryPlusOperators.operator +(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.IAdditionOperators.operator +(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IBitwiseOperators.operator &(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IBitwiseOperators.operator |(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IBitwiseOperators.operator ^(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IBitwiseOperators.operator ~(System.UInt32 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.UInt32 left, System.UInt32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.UInt32 left, System.UInt32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.UInt32 left, System.UInt32 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IDecrementOperators.operator --(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.IDivisionOperators.operator /(System.UInt32 left, System.UInt32 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.UInt32 left, System.UInt32 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IIncrementOperators.operator ++(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.IModulusOperators.operator %(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IMultiplyOperators.operator *(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.INumber.Abs(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.INumber.CopySign(System.UInt32 value, System.UInt32 sign) { throw null; } + static bool System.Numerics.INumber.IsNegative(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.INumber.MaxMagnitude(System.UInt32 x, System.UInt32 y) { throw null; } + static System.UInt32 System.Numerics.INumber.MinMagnitude(System.UInt32 x, System.UInt32 y) { throw null; } + static System.UInt32 System.Numerics.IShiftOperators.operator <<(System.UInt32 value, int shiftAmount) { throw null; } + static System.UInt32 System.Numerics.IShiftOperators.operator >>(System.UInt32 value, int shiftAmount) { throw null; } + static System.UInt32 System.Numerics.ISubtractionOperators.operator -(System.UInt32 left, System.UInt32 right) { throw null; } + static System.UInt32 System.Numerics.IUnaryNegationOperators.operator -(System.UInt32 value) { throw null; } + static System.UInt32 System.Numerics.IUnaryPlusOperators.operator +(System.UInt32 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.UInt32 TrailingZeroCount(System.UInt32 value) { throw null; } - public static bool TryCreate(TOther value, out System.UInt32 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.UInt32 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt32 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.UInt32 result) { throw null; } @@ -5785,28 +5572,23 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt32 result) { throw null; } } [System.CLSCompliantAttribute(false)] - public readonly partial struct UInt64 : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IConvertible, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber + public readonly partial struct UInt64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber { private readonly ulong _dummyPrimitive; - public const ulong AdditiveIdentity = (ulong)0; public const ulong MaxValue = (ulong)18446744073709551615; public const ulong MinValue = (ulong)0; - public const ulong MultiplicativeIdentity = (ulong)1; - public const ulong One = (ulong)1; - public const ulong Zero = (ulong)0; - static ulong System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static ulong System.IMinMaxValue.MaxValue { get { throw null; } } - static ulong System.IMinMaxValue.MinValue { get { throw null; } } - static ulong System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static ulong System.INumber.One { get { throw null; } } - static ulong System.INumber.Zero { get { throw null; } } - public static System.UInt64 Abs(System.UInt64 value) { throw null; } + static ulong System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static ulong System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static ulong System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static ulong System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static ulong System.Numerics.INumberBase.One { get { throw null; } } + static ulong System.Numerics.INumberBase.Zero { get { throw null; } } public static System.UInt64 Clamp(System.UInt64 value, System.UInt64 min, System.UInt64 max) { throw null; } public int CompareTo(object? value) { throw null; } public int CompareTo(System.UInt64 value) { throw null; } - public static System.UInt64 CreateSaturating(TOther value) where TOther : INumber { throw null; } - public static System.UInt64 CreateTruncating(TOther value) where TOther : INumber { throw null; } - public static System.UInt64 Create(TOther value) where TOther : INumber { throw null; } + public static System.UInt64 CreateChecked(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt64 CreateSaturating(TOther value) where TOther : System.Numerics.INumber { throw null; } + public static System.UInt64 CreateTruncating(TOther value) where TOther : System.Numerics.INumber { throw null; } public static (ulong Quotient, ulong Remainder) DivRem(System.UInt64 left, System.UInt64 right) { throw null; } public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } public bool Equals(System.UInt64 obj) { throw null; } @@ -5826,16 +5608,7 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static System.UInt64 PopCount(System.UInt64 value) { throw null; } public static System.UInt64 RotateLeft(System.UInt64 value, int rotateAmount) { throw null; } public static System.UInt64 RotateRight(System.UInt64 value, int rotateAmount) { throw null; } - public static System.UInt64 Sign(System.UInt64 value) { throw null; } - static System.UInt64 System.IAdditionOperators.operator +(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IBitwiseOperators.operator &(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IBitwiseOperators.operator |(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IBitwiseOperators.operator ^(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IBitwiseOperators.operator ~(System.UInt64 value) { throw null; } - static bool System.IComparisonOperators.operator >(System.UInt64 left, System.UInt64 right) { throw null; } - static bool System.IComparisonOperators.operator >=(System.UInt64 left, System.UInt64 right) { throw null; } - static bool System.IComparisonOperators.operator <(System.UInt64 left, System.UInt64 right) { throw null; } - static bool System.IComparisonOperators.operator <=(System.UInt64 left, System.UInt64 right) { throw null; } + public static int Sign(System.UInt64 value) { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; } @@ -5851,24 +5624,38 @@ public TypeUnloadedException(string? message, System.Exception? innerException) ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; } uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; } System.UInt64 System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; } - static System.UInt64 System.IDecrementOperators.operator --(System.UInt64 value) { throw null; } - static System.UInt64 System.IDivisionOperators.operator /(System.UInt64 left, System.UInt64 right) { throw null; } - static bool System.IEqualityOperators.operator ==(System.UInt64 left, System.UInt64 right) { throw null; } - static bool System.IEqualityOperators.operator !=(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IIncrementOperators.operator ++(System.UInt64 value) { throw null; } - static System.UInt64 System.IModulusOperators.operator %(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IMultiplyOperators.operator *(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IShiftOperators.operator <<(System.UInt64 value, int shiftAmount) { throw null; } - static System.UInt64 System.IShiftOperators.operator >>(System.UInt64 value, int shiftAmount) { throw null; } - static System.UInt64 System.ISubtractionOperators.operator -(System.UInt64 left, System.UInt64 right) { throw null; } - static System.UInt64 System.IUnaryNegationOperators.operator -(System.UInt64 value) { throw null; } - static System.UInt64 System.IUnaryPlusOperators.operator +(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.IAdditionOperators.operator +(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IBitwiseOperators.operator &(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IBitwiseOperators.operator |(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IBitwiseOperators.operator ^(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IBitwiseOperators.operator ~(System.UInt64 value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(System.UInt64 left, System.UInt64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(System.UInt64 left, System.UInt64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(System.UInt64 left, System.UInt64 right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IDecrementOperators.operator --(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.IDivisionOperators.operator /(System.UInt64 left, System.UInt64 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator ==(System.UInt64 left, System.UInt64 right) { throw null; } + static bool System.Numerics.IEqualityOperators.operator !=(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IIncrementOperators.operator ++(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.IModulusOperators.operator %(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IMultiplyOperators.operator *(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.INumber.Abs(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.INumber.CopySign(System.UInt64 value, System.UInt64 sign) { throw null; } + static bool System.Numerics.INumber.IsNegative(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.INumber.MaxMagnitude(System.UInt64 x, System.UInt64 y) { throw null; } + static System.UInt64 System.Numerics.INumber.MinMagnitude(System.UInt64 x, System.UInt64 y) { throw null; } + static System.UInt64 System.Numerics.IShiftOperators.operator <<(System.UInt64 value, int shiftAmount) { throw null; } + static System.UInt64 System.Numerics.IShiftOperators.operator >>(System.UInt64 value, int shiftAmount) { throw null; } + static System.UInt64 System.Numerics.ISubtractionOperators.operator -(System.UInt64 left, System.UInt64 right) { throw null; } + static System.UInt64 System.Numerics.IUnaryNegationOperators.operator -(System.UInt64 value) { throw null; } + static System.UInt64 System.Numerics.IUnaryPlusOperators.operator +(System.UInt64 value) { throw null; } public override string ToString() { throw null; } public string ToString(System.IFormatProvider? provider) { throw null; } public string ToString(string? format) { throw null; } public string ToString(string? format, System.IFormatProvider? provider) { throw null; } public static System.UInt64 TrailingZeroCount(System.UInt64 value) { throw null; } - public static bool TryCreate(TOther value, out System.UInt64 result) where TOther : INumber { throw null; } + public static bool TryCreate(TOther value, out System.UInt64 result) where TOther : System.Numerics.INumber { throw null; } public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format = default(System.ReadOnlySpan), System.IFormatProvider? provider = null) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt64 result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.UInt64 result) { throw null; } @@ -5878,7 +5665,7 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt64 result) { throw null; } } [System.CLSCompliantAttribute(false)] - public readonly partial struct UIntPtr : System.IAdditionOperators, System.IAdditiveIdentity, System.IBinaryInteger, System.IBinaryNumber, System.IBitwiseOperators, System.IComparable, System.IComparable, System.IComparisonOperators, System.IDecrementOperators, System.IDivisionOperators, System.IEqualityOperators, System.IEquatable, System.IFormattable, System.IIncrementOperators, System.IMinMaxValue, System.IModulusOperators, System.IMultiplicativeIdentity, System.IMultiplyOperators, System.INumber, System.IParseable, System.IShiftOperators, System.ISpanFormattable, System.ISpanParseable, System.ISubtractionOperators, System.IUnaryNegationOperators, System.IUnaryPlusOperators, System.IUnsignedNumber, System.Runtime.Serialization.ISerializable + public readonly partial struct UIntPtr : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryInteger, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMinMaxValue, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators, System.Numerics.IUnsignedNumber, System.Runtime.Serialization.ISerializable { private readonly int _dummyPrimitive; public static readonly System.UIntPtr Zero; @@ -5888,12 +5675,12 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static System.UIntPtr MaxValue { get { throw null; } } public static System.UIntPtr MinValue { get { throw null; } } public static int Size { get { throw null; } } - static nuint System.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } - static nuint System.IMinMaxValue.MaxValue { get { throw null; } } - static nuint System.IMinMaxValue.MinValue { get { throw null; } } - static nuint System.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } - static nuint System.INumber.One { get { throw null; } } - static nuint System.INumber.Zero { get { throw null; } } + static nuint System.Numerics.IAdditiveIdentity.AdditiveIdentity { get { throw null; } } + static nuint System.Numerics.IMinMaxValue.MaxValue { get { throw null; } } + static nuint System.Numerics.IMinMaxValue.MinValue { get { throw null; } } + static nuint System.Numerics.IMultiplicativeIdentity.MultiplicativeIdentity { get { throw null; } } + static nuint System.Numerics.INumberBase.One { get { throw null; } } + static nuint System.Numerics.INumberBase.Zero { get { throw null; } } public static System.UIntPtr Add(System.UIntPtr pointer, int offset) { throw null; } public int CompareTo(object? value) { throw null; } public int CompareTo(System.UIntPtr value) { throw null; } @@ -5917,42 +5704,46 @@ public TypeUnloadedException(string? message, System.Exception? innerException) public static System.UIntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; } public static System.UIntPtr Parse(string s, System.IFormatProvider? provider) { throw null; } public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; } - static nuint System.IAdditionOperators.operator +(nuint left, nuint right) { throw null; } - static nuint System.IBinaryInteger.LeadingZeroCount(nuint value) { throw null; } - static nuint System.IBinaryInteger.PopCount(nuint value) { throw null; } - static nuint System.IBinaryInteger.RotateLeft(nuint value, int rotateAmount) { throw null; } - static nuint System.IBinaryInteger.RotateRight(nuint value, int rotateAmount) { throw null; } - static nuint System.IBinaryInteger.TrailingZeroCount(nuint value) { throw null; } - static bool System.IBinaryNumber.IsPow2(nuint value) { throw null; } - static nuint System.IBinaryNumber.Log2(nuint value) { throw null; } - static nuint System.IBitwiseOperators.operator &(nuint left, nuint right) { throw null; } - static nuint System.IBitwiseOperators.operator |(nuint left, nuint right) { throw null; } - static nuint System.IBitwiseOperators.operator ^(nuint left, nuint right) { throw null; } - static nuint System.IBitwiseOperators.operator ~(nuint value) { throw null; } - static bool System.IComparisonOperators.operator >(nuint left, nuint right) { throw null; } - static bool System.IComparisonOperators.operator >=(nuint left, nuint right) { throw null; } - static bool System.IComparisonOperators.operator <(nuint left, nuint right) { throw null; } - static bool System.IComparisonOperators.operator <=(nuint left, nuint right) { throw null; } - static nuint System.IDecrementOperators.operator --(nuint value) { throw null; } - static nuint System.IDivisionOperators.operator /(nuint left, nuint right) { throw null; } - static nuint System.IIncrementOperators.operator ++(nuint value) { throw null; } - static nuint System.IModulusOperators.operator %(nuint left, nuint right) { throw null; } - static nuint System.IMultiplyOperators.operator *(nuint left, nuint right) { throw null; } - static nuint System.INumber.Abs(nuint value) { throw null; } - static nuint System.INumber.Clamp(nuint value, nuint min, nuint max) { throw null; } - static nuint System.INumber.CreateSaturating(TOther value) { throw null; } - static nuint System.INumber.CreateTruncating(TOther value) { throw null; } - static nuint System.INumber.Create(TOther value) { throw null; } - static (nuint Quotient, nuint Remainder) System.INumber.DivRem(nuint left, nuint right) { throw null; } - static nuint System.INumber.Max(nuint x, nuint y) { throw null; } - static nuint System.INumber.Min(nuint x, nuint y) { throw null; } - static nuint System.INumber.Sign(nuint value) { throw null; } - static bool System.INumber.TryCreate(TOther value, out nuint result) { throw null; } - static nuint System.IShiftOperators.operator <<(nuint value, int shiftAmount) { throw null; } - static nuint System.IShiftOperators.operator >>(nuint value, int shiftAmount) { throw null; } - static nuint System.ISubtractionOperators.operator -(nuint left, nuint right) { throw null; } - static nuint System.IUnaryNegationOperators.operator -(nuint value) { throw null; } - static nuint System.IUnaryPlusOperators.operator +(nuint value) { throw null; } + static nuint System.Numerics.IAdditionOperators.operator +(nuint left, nuint right) { throw null; } + static (nuint Quotient, nuint Remainder) System.Numerics.IBinaryInteger.DivRem(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IBinaryInteger.LeadingZeroCount(nuint value) { throw null; } + static nuint System.Numerics.IBinaryInteger.PopCount(nuint value) { throw null; } + static nuint System.Numerics.IBinaryInteger.RotateLeft(nuint value, int rotateAmount) { throw null; } + static nuint System.Numerics.IBinaryInteger.RotateRight(nuint value, int rotateAmount) { throw null; } + static nuint System.Numerics.IBinaryInteger.TrailingZeroCount(nuint value) { throw null; } + static bool System.Numerics.IBinaryNumber.IsPow2(nuint value) { throw null; } + static nuint System.Numerics.IBinaryNumber.Log2(nuint value) { throw null; } + static nuint System.Numerics.IBitwiseOperators.operator &(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IBitwiseOperators.operator |(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IBitwiseOperators.operator ^(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IBitwiseOperators.operator ~(nuint value) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >(nuint left, nuint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator >=(nuint left, nuint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <(nuint left, nuint right) { throw null; } + static bool System.Numerics.IComparisonOperators.operator <=(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IDecrementOperators.operator --(nuint value) { throw null; } + static nuint System.Numerics.IDivisionOperators.operator /(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IIncrementOperators.operator ++(nuint value) { throw null; } + static nuint System.Numerics.IModulusOperators.operator %(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IMultiplyOperators.operator *(nuint left, nuint right) { throw null; } + static nuint System.Numerics.INumber.Abs(nuint value) { throw null; } + static nuint System.Numerics.INumber.Clamp(nuint value, nuint min, nuint max) { throw null; } + static nuint System.Numerics.INumber.CopySign(nuint value, nuint sign) { throw null; } + static nuint System.Numerics.INumber.CreateChecked(TOther value) { throw null; } + static nuint System.Numerics.INumber.CreateSaturating(TOther value) { throw null; } + static nuint System.Numerics.INumber.CreateTruncating(TOther value) { throw null; } + static bool System.Numerics.INumber.IsNegative(nuint value) { throw null; } + static nuint System.Numerics.INumber.Max(nuint x, nuint y) { throw null; } + static nuint System.Numerics.INumber.MaxMagnitude(nuint x, nuint y) { throw null; } + static nuint System.Numerics.INumber.Min(nuint x, nuint y) { throw null; } + static nuint System.Numerics.INumber.MinMagnitude(nuint x, nuint y) { throw null; } + static int System.Numerics.INumber.Sign(nuint value) { throw null; } + static bool System.Numerics.INumber.TryCreate(TOther value, out nuint result) { throw null; } + static nuint System.Numerics.IShiftOperators.operator <<(nuint value, int shiftAmount) { throw null; } + static nuint System.Numerics.IShiftOperators.operator >>(nuint value, int shiftAmount) { throw null; } + static nuint System.Numerics.ISubtractionOperators.operator -(nuint left, nuint right) { throw null; } + static nuint System.Numerics.IUnaryNegationOperators.operator -(nuint value) { throw null; } + static nuint System.Numerics.IUnaryPlusOperators.operator +(nuint value) { throw null; } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public unsafe void* ToPointer() { throw null; } public override string ToString() { throw null; } @@ -9536,6 +9327,204 @@ public static partial class BitOperations [System.CLSCompliantAttribute(false)] public static int TrailingZeroCount(nuint value) { throw null; } } + public partial interface IAdditionOperators where TSelf : System.Numerics.IAdditionOperators + { + static abstract TResult operator +(TSelf left, TOther right); + } + public partial interface IAdditiveIdentity where TSelf : System.Numerics.IAdditiveIdentity + { + static abstract TResult AdditiveIdentity { get; } + } + public partial interface IBinaryFloatingPointIeee754 : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IExponentialFunctions, System.Numerics.IFloatingPoint, System.Numerics.IFloatingPointIeee754, System.Numerics.IHyperbolicFunctions, System.Numerics.IIncrementOperators, System.Numerics.ILogarithmicFunctions, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IPowerFunctions, System.Numerics.IRootFunctions, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.ITrigonometricFunctions, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.IBinaryFloatingPointIeee754 + { + } + public partial interface IBinaryInteger : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBinaryNumber, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IShiftOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.IBinaryInteger + { + static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right); + static abstract TSelf LeadingZeroCount(TSelf value); + static abstract TSelf PopCount(TSelf value); + static abstract TSelf RotateLeft(TSelf value, int rotateAmount); + static abstract TSelf RotateRight(TSelf value, int rotateAmount); + static abstract TSelf TrailingZeroCount(TSelf value); + } + public partial interface IBinaryNumber : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IBitwiseOperators, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.IBinaryNumber + { + static abstract bool IsPow2(TSelf value); + static abstract TSelf Log2(TSelf value); + } + public partial interface IBitwiseOperators where TSelf : System.Numerics.IBitwiseOperators + { + static abstract TResult operator &(TSelf left, TOther right); + static abstract TResult operator |(TSelf left, TOther right); + static abstract TResult operator ^(TSelf left, TOther right); + static abstract TResult operator ~(TSelf value); + } + public partial interface IComparisonOperators : System.IComparable, System.IComparable, System.IEquatable, System.Numerics.IEqualityOperators where TSelf : System.Numerics.IComparisonOperators + { + static abstract bool operator >(TSelf left, TOther right); + static abstract bool operator >=(TSelf left, TOther right); + static abstract bool operator <(TSelf left, TOther right); + static abstract bool operator <=(TSelf left, TOther right); + } + public partial interface IDecrementOperators where TSelf : System.Numerics.IDecrementOperators + { + static abstract TSelf operator --(TSelf value); + } + public partial interface IDivisionOperators where TSelf : System.Numerics.IDivisionOperators + { + static abstract TResult operator /(TSelf left, TOther right); + } + public partial interface IEqualityOperators : System.IEquatable where TSelf : System.Numerics.IEqualityOperators + { + static abstract bool operator ==(TSelf left, TOther right); + static abstract bool operator !=(TSelf left, TOther right); + } + public partial interface IExponentialFunctions where TSelf : System.Numerics.IExponentialFunctions + { + static abstract TSelf Exp(TSelf x); + } + public partial interface IFloatingPointIeee754 : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IExponentialFunctions, System.Numerics.IFloatingPoint, System.Numerics.IHyperbolicFunctions, System.Numerics.IIncrementOperators, System.Numerics.ILogarithmicFunctions, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.IPowerFunctions, System.Numerics.IRootFunctions, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.ITrigonometricFunctions, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.IFloatingPointIeee754 + { + static abstract TSelf E { get; } + static abstract TSelf Epsilon { get; } + static abstract TSelf NaN { get; } + static abstract TSelf NegativeInfinity { get; } + static abstract TSelf NegativeZero { get; } + static abstract TSelf Pi { get; } + static abstract TSelf PositiveInfinity { get; } + static abstract TSelf Tau { get; } + static abstract TSelf BitDecrement(TSelf x); + static abstract TSelf BitIncrement(TSelf x); + static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend); + static abstract TSelf Ieee754Remainder(TSelf left, TSelf right); + static abstract int ILogB(TSelf x); + static abstract bool IsFinite(TSelf value); + static abstract bool IsInfinity(TSelf value); + static abstract bool IsNaN(TSelf value); + static abstract bool IsNegativeInfinity(TSelf value); + static abstract bool IsNormal(TSelf value); + static abstract bool IsPositiveInfinity(TSelf value); + static abstract bool IsSubnormal(TSelf value); + static abstract TSelf ReciprocalEstimate(TSelf x); + static abstract TSelf ReciprocalSqrtEstimate(TSelf x); + static abstract TSelf ScaleB(TSelf x, int n); + } + public partial interface IFloatingPoint : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumber, System.Numerics.INumberBase, System.Numerics.ISignedNumber, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.IFloatingPoint + { + static abstract TSelf Ceiling(TSelf x); + static abstract TSelf Floor(TSelf x); + static abstract TSelf Round(TSelf x); + static abstract TSelf Round(TSelf x, int digits); + static abstract TSelf Round(TSelf x, int digits, System.MidpointRounding mode); + static abstract TSelf Round(TSelf x, System.MidpointRounding mode); + static abstract TSelf Truncate(TSelf x); + } + public partial interface IHyperbolicFunctions where TSelf : System.Numerics.IHyperbolicFunctions + { + static abstract TSelf Acosh(TSelf x); + static abstract TSelf Asinh(TSelf x); + static abstract TSelf Atanh(TSelf x); + static abstract TSelf Cosh(TSelf x); + static abstract TSelf Sinh(TSelf x); + static abstract TSelf Tanh(TSelf x); + } + public partial interface IIncrementOperators where TSelf : System.Numerics.IIncrementOperators + { + static abstract TSelf operator ++(TSelf value); + } + public partial interface ILogarithmicFunctions where TSelf : System.Numerics.ILogarithmicFunctions + { + static abstract TSelf Log(TSelf x); + static abstract TSelf Log(TSelf x, TSelf newBase); + static abstract TSelf Log10(TSelf x); + static abstract TSelf Log2(TSelf x); + } + public partial interface IMinMaxValue where TSelf : System.Numerics.IMinMaxValue + { + static abstract TSelf MaxValue { get; } + static abstract TSelf MinValue { get; } + } + public partial interface IModulusOperators where TSelf : System.Numerics.IModulusOperators + { + static abstract TResult operator %(TSelf left, TOther right); + } + public partial interface IMultiplicativeIdentity where TSelf : System.Numerics.IMultiplicativeIdentity + { + static abstract TResult MultiplicativeIdentity { get; } + } + public partial interface IMultiplyOperators where TSelf : System.Numerics.IMultiplyOperators + { + static abstract TResult operator *(TSelf left, TOther right); + } + public partial interface INumberBase : System.IEquatable, System.IFormattable, System.ISpanFormattable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.INumberBase + { + static abstract TSelf One { get; } + static abstract TSelf Zero { get; } + } + public partial interface INumber : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.IParsable, System.ISpanFormattable, System.ISpanParsable, System.Numerics.IAdditionOperators, System.Numerics.IAdditiveIdentity, System.Numerics.IComparisonOperators, System.Numerics.IDecrementOperators, System.Numerics.IDivisionOperators, System.Numerics.IEqualityOperators, System.Numerics.IIncrementOperators, System.Numerics.IModulusOperators, System.Numerics.IMultiplicativeIdentity, System.Numerics.IMultiplyOperators, System.Numerics.INumberBase, System.Numerics.ISubtractionOperators, System.Numerics.IUnaryNegationOperators, System.Numerics.IUnaryPlusOperators where TSelf : System.Numerics.INumber + { + static abstract TSelf Abs(TSelf value); + static abstract TSelf Clamp(TSelf value, TSelf min, TSelf max); + static abstract TSelf CopySign(TSelf value, TSelf sign); + static abstract TSelf CreateChecked(TOther value) where TOther : System.Numerics.INumber; + static abstract TSelf CreateSaturating(TOther value) where TOther : System.Numerics.INumber; + static abstract TSelf CreateTruncating(TOther value) where TOther : System.Numerics.INumber; + static abstract bool IsNegative(TSelf value); + static abstract TSelf Max(TSelf x, TSelf y); + static abstract TSelf MaxMagnitude(TSelf x, TSelf y); + static abstract TSelf Min(TSelf x, TSelf y); + static abstract TSelf MinMagnitude(TSelf x, TSelf y); + static abstract TSelf Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider); + static abstract TSelf Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider); + static abstract int Sign(TSelf value); + static abstract bool TryCreate(TOther value, out TSelf result) where TOther : System.Numerics.INumber; + static abstract bool TryParse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out TSelf result); + static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out TSelf result); + } + public partial interface IPowerFunctions where TSelf : System.Numerics.IPowerFunctions + { + static abstract TSelf Pow(TSelf x, TSelf y); + } + public partial interface IRootFunctions where TSelf : System.Numerics.IRootFunctions + { + static abstract TSelf Cbrt(TSelf x); + static abstract TSelf Sqrt(TSelf x); + } + public partial interface IShiftOperators where TSelf : System.Numerics.IShiftOperators + { + static abstract TResult operator <<(TSelf value, int shiftAmount); + static abstract TResult operator >>(TSelf value, int shiftAmount); + } + public partial interface ISignedNumber where TSelf : System.Numerics.INumberBase, System.Numerics.ISignedNumber + { + static abstract TSelf NegativeOne { get; } + } + public partial interface ISubtractionOperators where TSelf : System.Numerics.ISubtractionOperators + { + static abstract TResult operator -(TSelf left, TOther right); + } + public partial interface ITrigonometricFunctions where TSelf : System.Numerics.ITrigonometricFunctions + { + static abstract TSelf Acos(TSelf x); + static abstract TSelf Asin(TSelf x); + static abstract TSelf Atan(TSelf x); + static abstract TSelf Atan2(TSelf y, TSelf x); + static abstract TSelf Cos(TSelf x); + static abstract TSelf Sin(TSelf x); + static abstract (TSelf Sin, TSelf Cos) SinCos(TSelf x); + static abstract TSelf Tan(TSelf x); + } + public partial interface IUnaryNegationOperators where TSelf : System.Numerics.IUnaryNegationOperators + { + static abstract TResult operator -(TSelf value); + } + public partial interface IUnaryPlusOperators where TSelf : System.Numerics.IUnaryPlusOperators + { + static abstract TResult operator +(TSelf value); + } + public partial interface IUnsignedNumber where TSelf : System.Numerics.INumberBase, System.Numerics.IUnsignedNumber + { + } } namespace System.Reflection { diff --git a/src/libraries/System.Runtime/tests/System/ByteTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/ByteTests.GenericMath.cs index 35a8e4defc2f2a..5db2398690f73b 100644 --- a/src/libraries/System.Runtime/tests/System/ByteTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/ByteTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class ByteTests_GenericMath { [Fact] @@ -37,13 +36,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((byte)0x01, NumberHelper.One); + Assert.Equal((byte)0x01, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((byte)0x00, NumberHelper.Zero); + Assert.Equal((byte)0x00, NumberBaseHelper.Zero); } [Fact] @@ -297,134 +296,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x00)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x01)); - Assert.Equal((byte)0x7F, NumberHelper.Create(0x7F)); - Assert.Equal((byte)0x80, NumberHelper.Create(0x80)); - Assert.Equal((byte)0xFF, NumberHelper.Create(0xFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x00)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x01)); + Assert.Equal((byte)0x7F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((byte)0x80, NumberHelper.CreateChecked(0x80)); + Assert.Equal((byte)0xFF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((byte)0x00, NumberHelper.Create((char)0x0000)); - Assert.Equal((byte)0x01, NumberHelper.Create((char)0x0001)); - Assert.Throws(() => NumberHelper.Create((char)0x7FFF)); - Assert.Throws(() => NumberHelper.Create((char)0x8000)); - Assert.Throws(() => NumberHelper.Create((char)0xFFFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked((char)0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x0000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x0001)); - Assert.Throws(() => NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x00000000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((byte)0x00, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((byte)0x01, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((byte)0x00, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((byte)0x01, NumberHelper.Create((nint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x00)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x01)); - Assert.Equal((byte)0x7F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x00)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x01)); + Assert.Equal((byte)0x7F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x0000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x0001)); - Assert.Throws(() => NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(0x8000)); - Assert.Throws(() => NumberHelper.Create(0xFFFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x00000000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((byte)0x00, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((byte)0x01, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((byte)0x00, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((byte)0x01, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((byte)0x00, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((byte)0x01, NumberHelper.Create((nuint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((byte)0x00, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((byte)0x01, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -695,11 +694,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((byte)0x00, (byte)0x00), NumberHelper.DivRem((byte)0x00, (byte)2)); - Assert.Equal(((byte)0x00, (byte)0x01), NumberHelper.DivRem((byte)0x01, (byte)2)); - Assert.Equal(((byte)0x3F, (byte)0x01), NumberHelper.DivRem((byte)0x7F, (byte)2)); - Assert.Equal(((byte)0x40, (byte)0x00), NumberHelper.DivRem((byte)0x80, (byte)2)); - Assert.Equal(((byte)0x7F, (byte)0x01), NumberHelper.DivRem((byte)0xFF, (byte)2)); + Assert.Equal(((byte)0x00, (byte)0x00), BinaryIntegerHelper.DivRem((byte)0x00, (byte)2)); + Assert.Equal(((byte)0x00, (byte)0x01), BinaryIntegerHelper.DivRem((byte)0x01, (byte)2)); + Assert.Equal(((byte)0x3F, (byte)0x01), BinaryIntegerHelper.DivRem((byte)0x7F, (byte)2)); + Assert.Equal(((byte)0x40, (byte)0x00), BinaryIntegerHelper.DivRem((byte)0x80, (byte)2)); + Assert.Equal(((byte)0x7F, (byte)0x01), BinaryIntegerHelper.DivRem((byte)0xFF, (byte)2)); } [Fact] @@ -725,11 +724,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((byte)0x00, NumberHelper.Sign((byte)0x00)); - Assert.Equal((byte)0x01, NumberHelper.Sign((byte)0x01)); - Assert.Equal((byte)0x01, NumberHelper.Sign((byte)0x7F)); - Assert.Equal((byte)0x01, NumberHelper.Sign((byte)0x80)); - Assert.Equal((byte)0x01, NumberHelper.Sign((byte)0xFF)); + Assert.Equal(0, NumberHelper.Sign((byte)0x00)); + Assert.Equal(1, NumberHelper.Sign((byte)0x01)); + Assert.Equal(1, NumberHelper.Sign((byte)0x7F)); + Assert.Equal(1, NumberHelper.Sign((byte)0x80)); + Assert.Equal(1, NumberHelper.Sign((byte)0xFF)); } [Fact] @@ -1063,9 +1062,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1082,7 +1081,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1100,9 +1099,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(byte), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1119,7 +1118,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1137,7 +1136,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1161,7 +1160,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(byte), result); } diff --git a/src/libraries/System.Runtime/tests/System/CharTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/CharTests.GenericMath.cs index f9611f3bdcdb39..c3da51ef4c2c94 100644 --- a/src/libraries/System.Runtime/tests/System/CharTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/CharTests.GenericMath.cs @@ -6,7 +6,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class CharTests_GenericMath { [Fact] @@ -36,13 +35,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((char)0x0001, NumberHelper.One); + Assert.Equal((char)0x0001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((char)0x0000, NumberHelper.Zero); + Assert.Equal((char)0x0000, NumberBaseHelper.Zero); } [Fact] @@ -296,134 +295,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((char)0x007F, NumberHelper.Create(0x7F)); - Assert.Equal((char)0x0080, NumberHelper.Create(0x80)); - Assert.Equal((char)0x00FF, NumberHelper.Create(0xFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((char)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((char)0x0080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((char)0x00FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((char)0x0000, NumberHelper.Create((char)0x0000)); - Assert.Equal((char)0x0001, NumberHelper.Create((char)0x0001)); - Assert.Equal((char)0x7FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((char)0x8000, NumberHelper.Create((char)0x8000)); - Assert.Equal((char)0xFFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((char)0x7FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((char)0x8000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((char)0xFFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((char)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((char)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((char)0x0000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((char)0x0001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((char)0x0000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((char)0x0001, NumberHelper.Create((nint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((char)0x007F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((char)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((char)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((char)0x8000, NumberHelper.Create(0x8000)); - Assert.Equal((char)0xFFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((char)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((char)0x8000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((char)0xFFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((char)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((char)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((char)0x0000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((char)0x0001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((char)0x0000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((char)0x0001, NumberHelper.Create((nuint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((char)0x0000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((char)0x0001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -694,11 +693,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((char)0x0000, (char)0x0000), NumberHelper.DivRem((char)0x0000, (char)2)); - Assert.Equal(((char)0x0000, (char)0x0001), NumberHelper.DivRem((char)0x0001, (char)2)); - Assert.Equal(((char)0x3FFF, (char)0x0001), NumberHelper.DivRem((char)0x7FFF, (char)2)); - Assert.Equal(((char)0x4000, (char)0x0000), NumberHelper.DivRem((char)0x8000, (char)2)); - Assert.Equal(((char)0x7FFF, (char)0x0001), NumberHelper.DivRem((char)0xFFFF, (char)2)); + Assert.Equal(((char)0x0000, (char)0x0000), BinaryIntegerHelper.DivRem((char)0x0000, (char)2)); + Assert.Equal(((char)0x0000, (char)0x0001), BinaryIntegerHelper.DivRem((char)0x0001, (char)2)); + Assert.Equal(((char)0x3FFF, (char)0x0001), BinaryIntegerHelper.DivRem((char)0x7FFF, (char)2)); + Assert.Equal(((char)0x4000, (char)0x0000), BinaryIntegerHelper.DivRem((char)0x8000, (char)2)); + Assert.Equal(((char)0x7FFF, (char)0x0001), BinaryIntegerHelper.DivRem((char)0xFFFF, (char)2)); } [Fact] @@ -724,11 +723,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((char)0x0000, NumberHelper.Sign((char)0x0000)); - Assert.Equal((char)0x0001, NumberHelper.Sign((char)0x0001)); - Assert.Equal((char)0x0001, NumberHelper.Sign((char)0x7FFF)); - Assert.Equal((char)0x0001, NumberHelper.Sign((char)0x8000)); - Assert.Equal((char)0x0001, NumberHelper.Sign((char)0xFFFF)); + Assert.Equal(0, NumberHelper.Sign((char)0x0000)); + Assert.Equal(1, NumberHelper.Sign((char)0x0001)); + Assert.Equal(1, NumberHelper.Sign((char)0x7FFF)); + Assert.Equal(1, NumberHelper.Sign((char)0x8000)); + Assert.Equal(1, NumberHelper.Sign((char)0xFFFF)); } [Fact] diff --git a/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs index 6d9b1b6bc03a11..25adcef44651af 100644 --- a/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/DoubleTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class DoubleTests_GenericMath { [Theory] diff --git a/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs b/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs index e1d4659db229be..cbcfd60dc07234 100644 --- a/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs +++ b/src/libraries/System.Runtime/tests/System/GenericMathHelpers.cs @@ -2,28 +2,28 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Globalization; +using System.Numerics; using System.Runtime.Versioning; namespace System.Tests { - [RequiresPreviewFeatures] public static class AdditionOperatorsHelper where TSelf : IAdditionOperators { public static TResult op_Addition(TSelf left, TOther right) => left + right; } - [RequiresPreviewFeatures] public static class AdditiveIdentityHelper where TSelf : IAdditiveIdentity { public static TResult AdditiveIdentity => TSelf.AdditiveIdentity; } - [RequiresPreviewFeatures] public static class BinaryIntegerHelper where TSelf : IBinaryInteger { + public static (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right) => TSelf.DivRem(left, right); + public static TSelf LeadingZeroCount(TSelf value) => TSelf.LeadingZeroCount(value); public static TSelf PopCount(TSelf value) => TSelf.PopCount(value); @@ -35,7 +35,6 @@ public static class BinaryIntegerHelper public static TSelf TrailingZeroCount(TSelf value) => TSelf.TrailingZeroCount(value); } - [RequiresPreviewFeatures] public static class BinaryNumberHelper where TSelf : IBinaryNumber { @@ -44,7 +43,6 @@ public static class BinaryNumberHelper public static TSelf Log2(TSelf value) => TSelf.Log2(value); } - [RequiresPreviewFeatures] public static class BitwiseOperatorsHelper where TSelf : IBitwiseOperators { @@ -57,7 +55,6 @@ public static class BitwiseOperatorsHelper public static TResult op_OnesComplement(TSelf value) => ~value; } - [RequiresPreviewFeatures] public static class ComparisonOperatorsHelper where TSelf : IComparisonOperators { @@ -70,21 +67,18 @@ public static class ComparisonOperatorsHelper public static bool op_LessThanOrEqual(TSelf left, TOther right) => left <= right; } - [RequiresPreviewFeatures] public static class DecrementOperatorsHelper where TSelf : IDecrementOperators { public static TSelf op_Decrement(TSelf value) => --value; } - [RequiresPreviewFeatures] public static class DivisionOperatorsHelper where TSelf : IDivisionOperators { public static TResult op_Division(TSelf left, TOther right) => left / right; } - [RequiresPreviewFeatures] public static class EqualityOperatorsHelper where TSelf : IEqualityOperators { @@ -93,70 +87,74 @@ public static class EqualityOperatorsHelper public static bool op_Inequality(TSelf left, TOther right) => left != right; } - [RequiresPreviewFeatures] public static class IncrementOperatorsHelper where TSelf : IIncrementOperators { public static TSelf op_Increment(TSelf value) => ++value; } - [RequiresPreviewFeatures] + public static class MinMaxValueHelper + where TSelf : IMinMaxValue + { + public static TSelf MaxValue => TSelf.MaxValue; + + public static TSelf MinValue => TSelf.MinValue; + } + public static class ModulusOperatorsHelper where TSelf : IModulusOperators { public static TResult op_Modulus(TSelf left, TOther right) => left % right; } - [RequiresPreviewFeatures] public static class MultiplyOperatorsHelper where TSelf : IMultiplyOperators { public static TResult op_Multiply(TSelf left, TOther right) => left * right; } - [RequiresPreviewFeatures] - public static class MinMaxValueHelper - where TSelf : IMinMaxValue - { - public static TSelf MaxValue => TSelf.MaxValue; - - public static TSelf MinValue => TSelf.MinValue; - } - - [RequiresPreviewFeatures] public static class MultiplicativeIdentityHelper where TSelf : IMultiplicativeIdentity { public static TResult MultiplicativeIdentity => TSelf.MultiplicativeIdentity; } - [RequiresPreviewFeatures] - public static class NumberHelper - where TSelf : INumber + public static class NumberBaseHelper + where TSelf : INumberBase { public static TSelf One => TSelf.One; public static TSelf Zero => TSelf.Zero; + } + public static class NumberHelper + where TSelf : INumber + { public static TSelf Abs(TSelf value) => TSelf.Abs(value); public static TSelf Clamp(TSelf value, TSelf min, TSelf max) => TSelf.Clamp(value, min, max); - public static TSelf Create(TOther value) - where TOther : INumber => TSelf.Create(value); + public static TSelf CopySign(TSelf value, TSelf sign) => TSelf.CopySign(value, sign); + + public static TSelf CreateChecked(TOther value) + where TOther : INumber => TSelf.CreateChecked(value); public static TSelf CreateSaturating(TOther value) - where TOther : INumber => TSelf.CreateSaturating(value); + where TOther : INumber => TSelf.CreateSaturating(value); public static TSelf CreateTruncating(TOther value) - where TOther : INumber => TSelf.CreateTruncating(value); + where TOther : INumber => TSelf.CreateTruncating(value); - public static (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right) => TSelf.DivRem(left, right); + public static bool IsNegative(TSelf value) => TSelf.IsNegative(value); public static TSelf Max(TSelf x, TSelf y) => TSelf.Max(x, y); + public static TSelf MaxMagnitude(TSelf x, TSelf y) => TSelf.MaxMagnitude(x, y); + public static TSelf Min(TSelf x, TSelf y) => TSelf.Min(x, y); + public static TSelf MinMagnitude(TSelf x, TSelf y) => TSelf.MinMagnitude(x, y); + public static TSelf Parse(string s, IFormatProvider provider) => TSelf.Parse(s, provider); public static TSelf Parse(string s, NumberStyles style, IFormatProvider provider) => TSelf.Parse(s, style, provider); @@ -165,10 +163,10 @@ public static TSelf CreateTruncating(TOther value) public static TSelf Parse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider) => TSelf.Parse(s, style, provider); - public static TSelf Sign(TSelf value) => TSelf.Sign(value); + public static int Sign(TSelf value) => TSelf.Sign(value); public static bool TryCreate(TOther value, out TSelf result) - where TOther : INumber => TSelf.TryCreate(value, out result); + where TOther : INumber => TSelf.TryCreate(value, out result); public static bool TryParse(string s, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, provider, out result); @@ -179,16 +177,14 @@ public static bool TryCreate(TOther value, out TSelf result) public static bool TryParse(ReadOnlySpan s, NumberStyles style, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, style, provider, out result); } - [RequiresPreviewFeatures] - public static class ParseableHelper - where TSelf : IParseable + public static class ParsableHelper + where TSelf : IParsable { public static TSelf Parse(string s, IFormatProvider provider) => TSelf.Parse(s, provider); public static bool TryParse(string s, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, provider, out result); } - [RequiresPreviewFeatures] public static class ShiftOperatorsHelper where TSelf : IShiftOperators { @@ -197,37 +193,32 @@ public static class ShiftOperatorsHelper public static TResult op_RightShift(TSelf value, int shiftAmount) => value >> shiftAmount; } - [RequiresPreviewFeatures] public static class SignedNumberHelper - where TSelf : ISignedNumber + where TSelf : INumberBase, ISignedNumber { public static TSelf NegativeOne => TSelf.NegativeOne; } - [RequiresPreviewFeatures] - public static class SpanParseableHelper - where TSelf : ISpanParseable + public static class SpanParsableHelper + where TSelf : ISpanParsable { public static TSelf Parse(ReadOnlySpan s, IFormatProvider provider) => TSelf.Parse(s, provider); public static bool TryParse(ReadOnlySpan s, IFormatProvider provider, out TSelf result) => TSelf.TryParse(s, provider, out result); } - [RequiresPreviewFeatures] public static class SubtractionOperatorsHelper where TSelf : ISubtractionOperators { public static TResult op_Subtraction(TSelf left, TOther right) => left - right; } - [RequiresPreviewFeatures] public static class UnaryNegationOperatorsHelper where TSelf : IUnaryNegationOperators { public static TResult op_UnaryNegation(TSelf value) => -value; } - [RequiresPreviewFeatures] public static class UnaryPlusOperatorsHelper where TSelf : IUnaryPlusOperators { diff --git a/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs index 617e22dd84f614..a5be3cc2f6135a 100644 --- a/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/HalfTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class HalfTests_GenericMath { [Theory] diff --git a/src/libraries/System.Runtime/tests/System/Int16Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/Int16Tests.GenericMath.cs index 06fe87729fe0a8..3f63e60c439ad6 100644 --- a/src/libraries/System.Runtime/tests/System/Int16Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/Int16Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class Int16Tests_GenericMath { [Fact] @@ -43,13 +42,13 @@ public static void NegativeOneTest() [Fact] public static void OneTest() { - Assert.Equal((short)0x0001, NumberHelper.One); + Assert.Equal((short)0x0001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((short)0x0000, NumberHelper.Zero); + Assert.Equal((short)0x0000, NumberBaseHelper.Zero); } [Fact] @@ -303,134 +302,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((short)0x007F, NumberHelper.Create(0x7F)); - Assert.Equal((short)0x0080, NumberHelper.Create(0x80)); - Assert.Equal((short)0x00FF, NumberHelper.Create(0xFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((short)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((short)0x0080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((short)0x00FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((short)0x0000, NumberHelper.Create((char)0x0000)); - Assert.Equal((short)0x0001, NumberHelper.Create((char)0x0001)); - Assert.Equal((short)0x7FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Throws(() => NumberHelper.Create((char)0x8000)); - Assert.Throws(() => NumberHelper.Create((char)0xFFFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((short)0x7FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((short)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal(unchecked((short)0x8000), NumberHelper.Create(unchecked((short)0x8000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((short)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal(unchecked((short)0x8000), NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((short)0x0000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((short)0x0001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((short)0x0000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((short)0x0001, NumberHelper.Create((nint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((short)0x007F, NumberHelper.Create(0x7F)); - Assert.Equal(unchecked((short)0xFF80), NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((short)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal(unchecked((short)0xFF80), NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Equal(unchecked((short)0xFFFF), NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((short)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(0x8000)); - Assert.Throws(() => NumberHelper.Create(0xFFFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((short)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((short)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((short)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((short)0x0000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((short)0x0001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((short)0x0000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((short)0x0001, NumberHelper.Create((nuint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((short)0x0000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((short)0x0001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -701,11 +700,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((short)0x0000, (short)0x0000), NumberHelper.DivRem((short)0x0000, (short)2)); - Assert.Equal(((short)0x0000, (short)0x0001), NumberHelper.DivRem((short)0x0001, (short)2)); - Assert.Equal(((short)0x3FFF, (short)0x0001), NumberHelper.DivRem((short)0x7FFF, (short)2)); - Assert.Equal((unchecked((short)0xC000), (short)0x0000), NumberHelper.DivRem(unchecked((short)0x8000), (short)2)); - Assert.Equal(((short)0x0000, unchecked((short)0xFFFF)), NumberHelper.DivRem(unchecked((short)0xFFFF), (short)2)); + Assert.Equal(((short)0x0000, (short)0x0000), BinaryIntegerHelper.DivRem((short)0x0000, (short)2)); + Assert.Equal(((short)0x0000, (short)0x0001), BinaryIntegerHelper.DivRem((short)0x0001, (short)2)); + Assert.Equal(((short)0x3FFF, (short)0x0001), BinaryIntegerHelper.DivRem((short)0x7FFF, (short)2)); + Assert.Equal((unchecked((short)0xC000), (short)0x0000), BinaryIntegerHelper.DivRem(unchecked((short)0x8000), (short)2)); + Assert.Equal(((short)0x0000, unchecked((short)0xFFFF)), BinaryIntegerHelper.DivRem(unchecked((short)0xFFFF), (short)2)); } [Fact] @@ -731,11 +730,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((short)0x0000, NumberHelper.Sign((short)0x0000)); - Assert.Equal((short)0x0001, NumberHelper.Sign((short)0x0001)); - Assert.Equal((short)0x0001, NumberHelper.Sign((short)0x7FFF)); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Sign(unchecked((short)0x8000))); - Assert.Equal(unchecked((short)0xFFFF), NumberHelper.Sign(unchecked((short)0xFFFF))); + Assert.Equal(0, NumberHelper.Sign((short)0x0000)); + Assert.Equal(1, NumberHelper.Sign((short)0x0001)); + Assert.Equal(1, NumberHelper.Sign((short)0x7FFF)); + Assert.Equal(-1, NumberHelper.Sign(unchecked((short)0x8000))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((short)0xFFFF))); } [Fact] @@ -1069,9 +1068,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1088,7 +1087,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1106,9 +1105,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(short), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1125,7 +1124,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1143,7 +1142,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1167,7 +1166,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(short), result); } diff --git a/src/libraries/System.Runtime/tests/System/Int32Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/Int32Tests.GenericMath.cs index 930538903c5140..4e3302aa2e2d38 100644 --- a/src/libraries/System.Runtime/tests/System/Int32Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/Int32Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class Int32Tests_GenericMath { [Fact] @@ -43,13 +42,13 @@ public static void NegativeOneTest() [Fact] public static void OneTest() { - Assert.Equal((int)0x00000001, NumberHelper.One); + Assert.Equal((int)0x00000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((int)0x00000000, NumberHelper.Zero); + Assert.Equal((int)0x00000000, NumberBaseHelper.Zero); } [Fact] @@ -303,134 +302,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((int)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal((int)0x00000080, NumberHelper.Create(0x80)); - Assert.Equal((int)0x000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((int)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((int)0x00000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((int)0x000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((int)0x00000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((int)0x00000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((int)0x00007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((int)0x00008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((int)0x0000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((int)0x00007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((int)0x00008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((int)0x0000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((int)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal(unchecked((int)0xFFFF8000), NumberHelper.Create(unchecked((short)0x8000))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((int)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal(unchecked((int)0xFFFF8000), NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((int)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal(unchecked((int)0x80000000), NumberHelper.Create(unchecked(unchecked((int)0x80000000)))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked(unchecked((int)0xFFFFFFFF)))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((int)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal(unchecked((int)0x80000000), NumberHelper.CreateChecked(unchecked(unchecked((int)0x80000000)))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked(unchecked((int)0xFFFFFFFF)))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((int)0x00000000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((int)0x00000001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((int)0x00000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((int)0x7FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Equal(unchecked((int)0x80000000), NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((int)0x7FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Equal(unchecked((int)0x80000000), NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((int)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal(unchecked((int)0xFFFFFF80), NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((int)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal(unchecked((int)0xFFFFFF80), NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((int)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((int)0x00008000, NumberHelper.Create(0x8000)); - Assert.Equal((int)0x0000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((int)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((int)0x00008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((int)0x0000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((int)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((int)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((int)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((int)0x00000000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((int)0x00000001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((int)0x00000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((int)0x00000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((int)0x7FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((int)0x00000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((int)0x00000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((int)0x7FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -701,11 +700,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((int)0x00000000, (int)0x00000000), NumberHelper.DivRem((int)0x00000000, 2)); - Assert.Equal(((int)0x00000000, (int)0x00000001), NumberHelper.DivRem((int)0x00000001, 2)); - Assert.Equal(((int)0x3FFFFFFF, (int)0x00000001), NumberHelper.DivRem((int)0x7FFFFFFF, 2)); - Assert.Equal((unchecked((int)0xC0000000), (int)0x00000000), NumberHelper.DivRem(unchecked((int)0x80000000), 2)); - Assert.Equal(((int)0x00000000, unchecked((int)0xFFFFFFFF)), NumberHelper.DivRem(unchecked((int)0xFFFFFFFF), 2)); + Assert.Equal(((int)0x00000000, (int)0x00000000), BinaryIntegerHelper.DivRem((int)0x00000000, 2)); + Assert.Equal(((int)0x00000000, (int)0x00000001), BinaryIntegerHelper.DivRem((int)0x00000001, 2)); + Assert.Equal(((int)0x3FFFFFFF, (int)0x00000001), BinaryIntegerHelper.DivRem((int)0x7FFFFFFF, 2)); + Assert.Equal((unchecked((int)0xC0000000), (int)0x00000000), BinaryIntegerHelper.DivRem(unchecked((int)0x80000000), 2)); + Assert.Equal(((int)0x00000000, unchecked((int)0xFFFFFFFF)), BinaryIntegerHelper.DivRem(unchecked((int)0xFFFFFFFF), 2)); } [Fact] @@ -731,11 +730,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((int)0x00000000, NumberHelper.Sign((int)0x00000000)); - Assert.Equal((int)0x00000001, NumberHelper.Sign((int)0x00000001)); - Assert.Equal((int)0x00000001, NumberHelper.Sign((int)0x7FFFFFFF)); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Sign(unchecked((int)0x80000000))); - Assert.Equal(unchecked((int)0xFFFFFFFF), NumberHelper.Sign(unchecked((int)0xFFFFFFFF))); + Assert.Equal(0, NumberHelper.Sign((int)0x00000000)); + Assert.Equal(1, NumberHelper.Sign((int)0x00000001)); + Assert.Equal(1, NumberHelper.Sign((int)0x7FFFFFFF)); + Assert.Equal(-1, NumberHelper.Sign(unchecked((int)0x80000000))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((int)0xFFFFFFFF))); } [Fact] @@ -1069,9 +1068,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1088,7 +1087,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1106,9 +1105,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(int), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1125,7 +1124,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1143,7 +1142,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1167,7 +1166,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(int), result); } diff --git a/src/libraries/System.Runtime/tests/System/Int64Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/Int64Tests.GenericMath.cs index f243969b628f74..e3c6bcb0c7b68f 100644 --- a/src/libraries/System.Runtime/tests/System/Int64Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/Int64Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class Int64Tests_GenericMath { [Fact] @@ -43,13 +42,13 @@ public static void NegativeOneTest() [Fact] public static void OneTest() { - Assert.Equal((long)0x0000000000000001, NumberHelper.One); + Assert.Equal((long)0x0000000000000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Zero); + Assert.Equal((long)0x0000000000000000, NumberBaseHelper.Zero); } [Fact] @@ -303,134 +302,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x00)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x01)); - Assert.Equal((long)0x000000000000007F, NumberHelper.Create(0x7F)); - Assert.Equal((long)0x0000000000000080, NumberHelper.Create(0x80)); - Assert.Equal((long)0x00000000000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((long)0x000000000000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((long)0x0000000000000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((long)0x00000000000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((long)0x0000000000007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((long)0x0000000000008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((long)0x000000000000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((long)0x0000000000007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((long)0x0000000000008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((long)0x000000000000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x0000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x0001)); - Assert.Equal((long)0x0000000000007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFF8000), NumberHelper.Create(unchecked((short)0x8000))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((long)0x0000000000007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFF8000), NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x00000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x00000001)); - Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal(unchecked((long)0xFFFFFFFF80000000), NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal(unchecked((long)0xFFFFFFFF80000000), NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x0000000000000001)); - Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Equal(unchecked((long)0x8000000000000000), NumberHelper.Create(unchecked(unchecked((long)0x8000000000000000)))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked(unchecked((long)0xFFFFFFFFFFFFFFFF)))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Equal(unchecked((long)0x8000000000000000), NumberHelper.CreateChecked(unchecked(unchecked((long)0x8000000000000000)))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked(unchecked((long)0xFFFFFFFFFFFFFFFF)))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal(unchecked((long)0x8000000000000000), NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((long)0x8000000000000000), NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Equal(unchecked((long)0xFFFFFFFF80000000), NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Equal(unchecked((long)0xFFFFFFFF80000000), NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x00)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x01)); - Assert.Equal((long)0x000000000000007F, NumberHelper.Create(0x7F)); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFF80), NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((long)0x000000000000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFF80), NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x0000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x0001)); - Assert.Equal((long)0x0000000000007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((long)0x0000000000008000, NumberHelper.Create(0x8000)); - Assert.Equal((long)0x000000000000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((long)0x0000000000007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((long)0x0000000000008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((long)0x000000000000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x00000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x00000001)); - Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal((long)0x0000000080000000, NumberHelper.Create(0x80000000)); - Assert.Equal((long)0x00000000FFFFFFFF, NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal((long)0x0000000080000000, NumberHelper.CreateChecked(0x80000000)); + Assert.Equal((long)0x00000000FFFFFFFF, NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(0x0000000000000001)); - Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Equal((long)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((long)0x0000000000000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Equal((long)0x0000000080000000, NumberHelper.Create((nuint)0x80000000)); - Assert.Equal((long)0x00000000FFFFFFFF, NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((long)0x0000000000000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((long)0x0000000000000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((long)0x000000007FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Equal((long)0x0000000080000000, NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Equal((long)0x00000000FFFFFFFF, NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -701,11 +700,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((long)0x0000000000000000, (long)0x0000000000000000), NumberHelper.DivRem((long)0x0000000000000000, 2)); - Assert.Equal(((long)0x0000000000000000, (long)0x0000000000000001), NumberHelper.DivRem((long)0x0000000000000001, 2)); - Assert.Equal(((long)0x3FFFFFFFFFFFFFFF, (long)0x0000000000000001), NumberHelper.DivRem((long)0x7FFFFFFFFFFFFFFF, 2)); - Assert.Equal((unchecked((long)0xC000000000000000), (long)0x0000000000000000), NumberHelper.DivRem(unchecked((long)0x8000000000000000), 2)); - Assert.Equal(((long)0x0000000000000000, unchecked((long)0xFFFFFFFFFFFFFFFF)), NumberHelper.DivRem(unchecked((long)0xFFFFFFFFFFFFFFFF), 2)); + Assert.Equal(((long)0x0000000000000000, (long)0x0000000000000000), BinaryIntegerHelper.DivRem((long)0x0000000000000000, 2)); + Assert.Equal(((long)0x0000000000000000, (long)0x0000000000000001), BinaryIntegerHelper.DivRem((long)0x0000000000000001, 2)); + Assert.Equal(((long)0x3FFFFFFFFFFFFFFF, (long)0x0000000000000001), BinaryIntegerHelper.DivRem((long)0x7FFFFFFFFFFFFFFF, 2)); + Assert.Equal((unchecked((long)0xC000000000000000), (long)0x0000000000000000), BinaryIntegerHelper.DivRem(unchecked((long)0x8000000000000000), 2)); + Assert.Equal(((long)0x0000000000000000, unchecked((long)0xFFFFFFFFFFFFFFFF)), BinaryIntegerHelper.DivRem(unchecked((long)0xFFFFFFFFFFFFFFFF), 2)); } [Fact] @@ -731,11 +730,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((long)0x0000000000000000, NumberHelper.Sign((long)0x0000000000000000)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Sign((long)0x0000000000000001)); - Assert.Equal((long)0x0000000000000001, NumberHelper.Sign((long)0x7FFFFFFFFFFFFFFF)); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Sign(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((long)0xFFFFFFFFFFFFFFFF), NumberHelper.Sign(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(0, NumberHelper.Sign((long)0x0000000000000000)); + Assert.Equal(1, NumberHelper.Sign((long)0x0000000000000001)); + Assert.Equal(1, NumberHelper.Sign((long)0x7FFFFFFFFFFFFFFF)); + Assert.Equal(-1, NumberHelper.Sign(unchecked((long)0x8000000000000000))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] @@ -1069,9 +1068,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1088,7 +1087,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1106,9 +1105,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(long), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1125,7 +1124,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1143,7 +1142,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1167,7 +1166,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(long), result); } diff --git a/src/libraries/System.Runtime/tests/System/IntPtrTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/IntPtrTests.GenericMath.cs index 4fae5c21733fd3..ca25bfa464fc2d 100644 --- a/src/libraries/System.Runtime/tests/System/IntPtrTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/IntPtrTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class IntPtrTests_GenericMath { [Fact] @@ -64,13 +63,13 @@ public static void NegativeOneTest() [Fact] public static void OneTest() { - Assert.Equal((nint)0x00000001, NumberHelper.One); + Assert.Equal((nint)0x00000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((nint)0x00000000, NumberHelper.Zero); + Assert.Equal((nint)0x00000000, NumberBaseHelper.Zero); } [Fact] @@ -599,167 +598,167 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((nint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal((nint)0x00000080, NumberHelper.Create(0x80)); - Assert.Equal((nint)0x000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((nint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((nint)0x00000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((nint)0x000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((nint)0x00000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((nint)0x00007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((nint)0x00008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((nint)0x0000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((nint)0x00007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((nint)0x00008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((nint)0x0000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((nint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal(unchecked((nint)(int)0xFFFF8000), NumberHelper.Create(unchecked((short)0x8000))); - Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((nint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal(unchecked((nint)(int)0xFFFF8000), NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((nint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal(unchecked((nint)(int)0x80000000), NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((nint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal(unchecked((nint)(int)0x80000000), NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Create(0x0000000000000000)); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Create(0x0000000000000001)); - Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Equal(unchecked((nint)0x8000000000000000), NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Equal(unchecked((nint)0x8000000000000000), NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal(unchecked((nint)0x8000000000000000), NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nint)0x8000000000000000), NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((nint)0x7FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Equal(unchecked((nint)0x80000000), NumberHelper.Create(unchecked(unchecked((nint)0x80000000)))); - Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.Create(unchecked(unchecked((nint)0xFFFFFFFF)))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((nint)0x7FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Equal(unchecked((nint)0x80000000), NumberHelper.CreateChecked(unchecked(unchecked((nint)0x80000000)))); + Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked(unchecked((nint)0xFFFFFFFF)))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((nint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal(unchecked((nint)(int)0xFFFFFF80), NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((nint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal(unchecked((nint)(int)0xFFFFFF80), NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Equal(unchecked((nint)(int)0xFFFFFFFF), NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((nint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((nint)0x00008000, NumberHelper.Create(0x8000)); - Assert.Equal((nint)0x0000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((nint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((nint)0x00008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((nint)0x0000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Create(0x00000000)); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Create(0x00000001)); - Assert.Equal(unchecked((nint)0x000000007FFFFFFF), NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal(unchecked((nint)0x0000000080000000), NumberHelper.Create(0x80000000)); - Assert.Equal(unchecked((nint)0x00000000FFFFFFFF), NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.CreateChecked(0x00000000)); + Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.CreateChecked(0x00000001)); + Assert.Equal(unchecked((nint)0x000000007FFFFFFF), NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal(unchecked((nint)0x0000000080000000), NumberHelper.CreateChecked(0x80000000)); + Assert.Equal(unchecked((nint)0x00000000FFFFFFFF), NumberHelper.CreateChecked(0xFFFFFFFF)); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((nint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((nint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Create(0x0000000000000000)); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Create(0x0000000000000001)); - Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Equal(unchecked((nint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((nint)0x7FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFF))); + Assert.Equal((nint)0x00000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((nint)0x00000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((nint)0x7FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFF))); } } @@ -1113,19 +1112,19 @@ public static void DivRemTest() { if (Environment.Is64BitProcess) { - Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0x0000000000000000)), NumberHelper.DivRem(unchecked((nint)0x0000000000000000), (nint)2)); - Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0x0000000000000001)), NumberHelper.DivRem(unchecked((nint)0x0000000000000001), (nint)2)); - Assert.Equal((unchecked((nint)0x3FFFFFFFFFFFFFFF), unchecked((nint)0x0000000000000001)), NumberHelper.DivRem(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2)); - Assert.Equal((unchecked((nint)0xC000000000000000), unchecked((nint)0x0000000000000000)), NumberHelper.DivRem(unchecked((nint)0x8000000000000000), (nint)2)); - Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0xFFFFFFFFFFFFFFFF)), NumberHelper.DivRem(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2)); + Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0x0000000000000000)), BinaryIntegerHelper.DivRem(unchecked((nint)0x0000000000000000), (nint)2)); + Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0x0000000000000001)), BinaryIntegerHelper.DivRem(unchecked((nint)0x0000000000000001), (nint)2)); + Assert.Equal((unchecked((nint)0x3FFFFFFFFFFFFFFF), unchecked((nint)0x0000000000000001)), BinaryIntegerHelper.DivRem(unchecked((nint)0x7FFFFFFFFFFFFFFF), (nint)2)); + Assert.Equal((unchecked((nint)0xC000000000000000), unchecked((nint)0x0000000000000000)), BinaryIntegerHelper.DivRem(unchecked((nint)0x8000000000000000), (nint)2)); + Assert.Equal((unchecked((nint)0x0000000000000000), unchecked((nint)0xFFFFFFFFFFFFFFFF)), BinaryIntegerHelper.DivRem(unchecked((nint)0xFFFFFFFFFFFFFFFF), (nint)2)); } else { - Assert.Equal(((nint)0x00000000, (nint)0x00000000), NumberHelper.DivRem((nint)0x00000000, (nint)2)); - Assert.Equal(((nint)0x00000000, (nint)0x00000001), NumberHelper.DivRem((nint)0x00000001, (nint)2)); - Assert.Equal(((nint)0x3FFFFFFF, (nint)0x00000001), NumberHelper.DivRem((nint)0x7FFFFFFF, (nint)2)); - Assert.Equal((unchecked((nint)0xC0000000), (nint)0x00000000), NumberHelper.DivRem(unchecked((nint)0x80000000), (nint)2)); - Assert.Equal(((nint)0x00000000, unchecked((nint)0xFFFFFFFF)), NumberHelper.DivRem(unchecked((nint)0xFFFFFFFF), (nint)2)); + Assert.Equal(((nint)0x00000000, (nint)0x00000000), BinaryIntegerHelper.DivRem((nint)0x00000000, (nint)2)); + Assert.Equal(((nint)0x00000000, (nint)0x00000001), BinaryIntegerHelper.DivRem((nint)0x00000001, (nint)2)); + Assert.Equal(((nint)0x3FFFFFFF, (nint)0x00000001), BinaryIntegerHelper.DivRem((nint)0x7FFFFFFF, (nint)2)); + Assert.Equal((unchecked((nint)0xC0000000), (nint)0x00000000), BinaryIntegerHelper.DivRem(unchecked((nint)0x80000000), (nint)2)); + Assert.Equal(((nint)0x00000000, unchecked((nint)0xFFFFFFFF)), BinaryIntegerHelper.DivRem(unchecked((nint)0xFFFFFFFF), (nint)2)); } } @@ -1176,19 +1175,19 @@ public static void SignTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nint)0x0000000000000000), NumberHelper.Sign(unchecked((nint)0x0000000000000000))); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Sign(unchecked((nint)0x0000000000000001))); - Assert.Equal(unchecked((nint)0x0000000000000001), NumberHelper.Sign(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.Sign(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((nint)0xFFFFFFFFFFFFFFFF), NumberHelper.Sign(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(0, NumberHelper.Sign(unchecked((nint)0x0000000000000000))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nint)0x0000000000000001))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((nint)0x8000000000000000))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nint)0x00000000, NumberHelper.Sign((nint)0x00000000)); - Assert.Equal((nint)0x00000001, NumberHelper.Sign((nint)0x00000001)); - Assert.Equal((nint)0x00000001, NumberHelper.Sign((nint)0x7FFFFFFF)); - Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.Sign(unchecked((nint)0x80000000))); - Assert.Equal(unchecked((nint)0xFFFFFFFF), NumberHelper.Sign(unchecked((nint)0xFFFFFFFF))); + Assert.Equal(0, NumberHelper.Sign((nint)0x00000000)); + Assert.Equal(1, NumberHelper.Sign((nint)0x00000001)); + Assert.Equal(1, NumberHelper.Sign((nint)0x7FFFFFFF)); + Assert.Equal(-1, NumberHelper.Sign(unchecked((nint)0x80000000))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((nint)0xFFFFFFFF))); } } @@ -1640,9 +1639,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1659,7 +1658,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1677,9 +1676,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(nint), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1696,7 +1695,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1714,7 +1713,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1738,7 +1737,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(nint), result); } diff --git a/src/libraries/System.Runtime/tests/System/SByteTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/SByteTests.GenericMath.cs index 9b59db73c36b8d..658446a9e15b0e 100644 --- a/src/libraries/System.Runtime/tests/System/SByteTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/SByteTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class SByteTests_GenericMath { [Fact] @@ -43,13 +42,13 @@ public static void NegativeOneTest() [Fact] public static void OneTest() { - Assert.Equal((sbyte)0x01, NumberHelper.One); + Assert.Equal((sbyte)0x01, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((sbyte)0x00, NumberHelper.Zero); + Assert.Equal((sbyte)0x00, NumberBaseHelper.Zero); } [Fact] @@ -303,134 +302,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x00)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x01)); - Assert.Equal((sbyte)0x7F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(0x80)); - Assert.Throws(() => NumberHelper.Create(0xFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x00)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x01)); + Assert.Equal((sbyte)0x7F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((sbyte)0x00, NumberHelper.Create((char)0x0000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create((char)0x0001)); - Assert.Throws(() => NumberHelper.Create((char)0x7FFF)); - Assert.Throws(() => NumberHelper.Create((char)0x8000)); - Assert.Throws(() => NumberHelper.Create((char)0xFFFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked((char)0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x0000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x0001)); - Assert.Throws(() => NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x00000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((sbyte)0x00, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((sbyte)0x01, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((sbyte)0x00, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create((nint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x00)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x01)); - Assert.Equal((sbyte)0x7F, NumberHelper.Create(0x7F)); - Assert.Equal(unchecked((sbyte)0x80), NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x00)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x01)); + Assert.Equal((sbyte)0x7F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal(unchecked((sbyte)0x80), NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x0000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x0001)); - Assert.Throws(() => NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(0x8000)); - Assert.Throws(() => NumberHelper.Create(0xFFFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x0001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x00000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((sbyte)0x00, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((sbyte)0x00, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((sbyte)0x01, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((sbyte)0x00, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((sbyte)0x01, NumberHelper.Create((nuint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((sbyte)0x00, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((sbyte)0x01, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -701,11 +700,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((sbyte)0x00, (sbyte)0x00), NumberHelper.DivRem((sbyte)0x00, (sbyte)2)); - Assert.Equal(((sbyte)0x00, (sbyte)0x01), NumberHelper.DivRem((sbyte)0x01, (sbyte)2)); - Assert.Equal(((sbyte)0x3F, (sbyte)0x01), NumberHelper.DivRem((sbyte)0x7F, (sbyte)2)); - Assert.Equal((unchecked((sbyte)0xC0), (sbyte)0x00), NumberHelper.DivRem(unchecked((sbyte)0x80), (sbyte)2)); - Assert.Equal(((sbyte)0x00, unchecked((sbyte)0xFF)), NumberHelper.DivRem(unchecked((sbyte)0xFF), (sbyte)2)); + Assert.Equal(((sbyte)0x00, (sbyte)0x00), BinaryIntegerHelper.DivRem((sbyte)0x00, (sbyte)2)); + Assert.Equal(((sbyte)0x00, (sbyte)0x01), BinaryIntegerHelper.DivRem((sbyte)0x01, (sbyte)2)); + Assert.Equal(((sbyte)0x3F, (sbyte)0x01), BinaryIntegerHelper.DivRem((sbyte)0x7F, (sbyte)2)); + Assert.Equal((unchecked((sbyte)0xC0), (sbyte)0x00), BinaryIntegerHelper.DivRem(unchecked((sbyte)0x80), (sbyte)2)); + Assert.Equal(((sbyte)0x00, unchecked((sbyte)0xFF)), BinaryIntegerHelper.DivRem(unchecked((sbyte)0xFF), (sbyte)2)); } [Fact] @@ -731,11 +730,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((sbyte)0x00, NumberHelper.Sign((sbyte)0x00)); - Assert.Equal((sbyte)0x01, NumberHelper.Sign((sbyte)0x01)); - Assert.Equal((sbyte)0x01, NumberHelper.Sign((sbyte)0x7F)); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Sign(unchecked((sbyte)0x80))); - Assert.Equal(unchecked((sbyte)0xFF), NumberHelper.Sign(unchecked((sbyte)0xFF))); + Assert.Equal(0, NumberHelper.Sign((sbyte)0x00)); + Assert.Equal(1, NumberHelper.Sign((sbyte)0x01)); + Assert.Equal(1, NumberHelper.Sign((sbyte)0x7F)); + Assert.Equal(-1, NumberHelper.Sign(unchecked((sbyte)0x80))); + Assert.Equal(-1, NumberHelper.Sign(unchecked((sbyte)0xFF))); } [Fact] @@ -1069,9 +1068,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1088,7 +1087,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1106,9 +1105,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(sbyte), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1125,7 +1124,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1143,7 +1142,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1167,7 +1166,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(sbyte), result); } diff --git a/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs index ced6bf7102afd1..212d61131f5994 100644 --- a/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/SingleTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class SingleTests_GenericMath { [Theory] diff --git a/src/libraries/System.Runtime/tests/System/UInt16Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/UInt16Tests.GenericMath.cs index 9110b56ade608b..e9e187d2faa03c 100644 --- a/src/libraries/System.Runtime/tests/System/UInt16Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/UInt16Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class UInt16Tests_GenericMath { [Fact] @@ -37,13 +36,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((ushort)0x0001, NumberHelper.One); + Assert.Equal((ushort)0x0001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((ushort)0x0000, NumberHelper.Zero); + Assert.Equal((ushort)0x0000, NumberBaseHelper.Zero); } [Fact] @@ -297,134 +296,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((ushort)0x007F, NumberHelper.Create(0x7F)); - Assert.Equal((ushort)0x0080, NumberHelper.Create(0x80)); - Assert.Equal((ushort)0x00FF, NumberHelper.Create(0xFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((ushort)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((ushort)0x0080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((ushort)0x00FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((ushort)0x0000, NumberHelper.Create((char)0x0000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create((char)0x0001)); - Assert.Equal((ushort)0x7FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((ushort)0x8000, NumberHelper.Create((char)0x8000)); - Assert.Equal((ushort)0xFFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((ushort)0x7FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((ushort)0x8000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((ushort)0xFFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((ushort)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((ushort)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((ushort)0x0000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((ushort)0x0001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((ushort)0x0000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create((nint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x00)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x01)); - Assert.Equal((ushort)0x007F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((ushort)0x007F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x0000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x0001)); - Assert.Equal((ushort)0x7FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((ushort)0x8000, NumberHelper.Create(0x8000)); - Assert.Equal((ushort)0xFFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((ushort)0x7FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((ushort)0x8000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((ushort)0xFFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x00000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x00000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x80000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((ushort)0x0000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((ushort)0x0000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((ushort)0x0001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((ushort)0x0000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((ushort)0x0001, NumberHelper.Create((nuint)0x00000001)); - Assert.Throws(() => NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create((nuint)0x80000000)); - Assert.Throws(() => NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((ushort)0x0000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((ushort)0x0001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Throws(() => NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -695,11 +694,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((ushort)0x0000, (ushort)0x0000), NumberHelper.DivRem((ushort)0x0000, (ushort)2)); - Assert.Equal(((ushort)0x0000, (ushort)0x0001), NumberHelper.DivRem((ushort)0x0001, (ushort)2)); - Assert.Equal(((ushort)0x3FFF, (ushort)0x0001), NumberHelper.DivRem((ushort)0x7FFF, (ushort)2)); - Assert.Equal(((ushort)0x4000, (ushort)0x0000), NumberHelper.DivRem((ushort)0x8000, (ushort)2)); - Assert.Equal(((ushort)0x7FFF, (ushort)0x0001), NumberHelper.DivRem((ushort)0xFFFF, (ushort)2)); + Assert.Equal(((ushort)0x0000, (ushort)0x0000), BinaryIntegerHelper.DivRem((ushort)0x0000, (ushort)2)); + Assert.Equal(((ushort)0x0000, (ushort)0x0001), BinaryIntegerHelper.DivRem((ushort)0x0001, (ushort)2)); + Assert.Equal(((ushort)0x3FFF, (ushort)0x0001), BinaryIntegerHelper.DivRem((ushort)0x7FFF, (ushort)2)); + Assert.Equal(((ushort)0x4000, (ushort)0x0000), BinaryIntegerHelper.DivRem((ushort)0x8000, (ushort)2)); + Assert.Equal(((ushort)0x7FFF, (ushort)0x0001), BinaryIntegerHelper.DivRem((ushort)0xFFFF, (ushort)2)); } [Fact] @@ -725,11 +724,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((ushort)0x0000, NumberHelper.Sign((ushort)0x0000)); - Assert.Equal((ushort)0x0001, NumberHelper.Sign((ushort)0x0001)); - Assert.Equal((ushort)0x0001, NumberHelper.Sign((ushort)0x7FFF)); - Assert.Equal((ushort)0x0001, NumberHelper.Sign((ushort)0x8000)); - Assert.Equal((ushort)0x0001, NumberHelper.Sign((ushort)0xFFFF)); + Assert.Equal(0, NumberHelper.Sign((ushort)0x0000)); + Assert.Equal(1, NumberHelper.Sign((ushort)0x0001)); + Assert.Equal(1, NumberHelper.Sign((ushort)0x7FFF)); + Assert.Equal(1, NumberHelper.Sign((ushort)0x8000)); + Assert.Equal(1, NumberHelper.Sign((ushort)0xFFFF)); } [Fact] @@ -1063,9 +1062,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1082,7 +1081,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1100,9 +1099,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(ushort), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1119,7 +1118,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1137,7 +1136,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1161,7 +1160,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(ushort), result); } diff --git a/src/libraries/System.Runtime/tests/System/UInt32Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/UInt32Tests.GenericMath.cs index e692e6370b3f3d..b79481aa3e8f10 100644 --- a/src/libraries/System.Runtime/tests/System/UInt32Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/UInt32Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class UInt32Tests_GenericMath { [Fact] @@ -37,13 +36,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((uint)0x00000001, NumberHelper.One); + Assert.Equal((uint)0x00000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((uint)0x00000000, NumberHelper.Zero); + Assert.Equal((uint)0x00000000, NumberBaseHelper.Zero); } [Fact] @@ -297,134 +296,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((uint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal((uint)0x00000080, NumberHelper.Create(0x80)); - Assert.Equal((uint)0x000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((uint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((uint)0x00000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((uint)0x000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((uint)0x00000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((uint)0x00007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((uint)0x00008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((uint)0x0000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((uint)0x00007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((uint)0x00008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((uint)0x0000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((uint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((uint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((uint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((uint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((uint)0x00000000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((uint)0x00000001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((uint)0x00000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((uint)0x7FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((uint)0x7FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((uint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((uint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((uint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((uint)0x00008000, NumberHelper.Create(0x8000)); - Assert.Equal((uint)0x0000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((uint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((uint)0x00008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((uint)0x0000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((uint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal((uint)0x80000000, NumberHelper.Create(0x80000000)); - Assert.Equal((uint)0xFFFFFFFF, NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((uint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal((uint)0x80000000, NumberHelper.CreateChecked(0x80000000)); + Assert.Equal((uint)0xFFFFFFFF, NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((uint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((uint)0x00000000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((uint)0x00000001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((uint)0x00000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((uint)0x7FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Equal((uint)0x80000000, NumberHelper.Create((nuint)0x80000000)); - Assert.Equal((uint)0xFFFFFFFF, NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((uint)0x00000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((uint)0x00000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((uint)0x7FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Equal((uint)0x80000000, NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Equal((uint)0xFFFFFFFF, NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -695,11 +694,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((uint)0x00000000, (uint)0x00000000), NumberHelper.DivRem((uint)0x00000000, 2)); - Assert.Equal(((uint)0x00000000, (uint)0x00000001), NumberHelper.DivRem((uint)0x00000001, 2)); - Assert.Equal(((uint)0x3FFFFFFF, (uint)0x00000001), NumberHelper.DivRem((uint)0x7FFFFFFF, 2)); - Assert.Equal(((uint)0x40000000, (uint)0x00000000), NumberHelper.DivRem((uint)0x80000000, 2)); - Assert.Equal(((uint)0x7FFFFFFF, (uint)0x00000001), NumberHelper.DivRem((uint)0xFFFFFFFF, 2)); + Assert.Equal(((uint)0x00000000, (uint)0x00000000), BinaryIntegerHelper.DivRem((uint)0x00000000, 2)); + Assert.Equal(((uint)0x00000000, (uint)0x00000001), BinaryIntegerHelper.DivRem((uint)0x00000001, 2)); + Assert.Equal(((uint)0x3FFFFFFF, (uint)0x00000001), BinaryIntegerHelper.DivRem((uint)0x7FFFFFFF, 2)); + Assert.Equal(((uint)0x40000000, (uint)0x00000000), BinaryIntegerHelper.DivRem((uint)0x80000000, 2)); + Assert.Equal(((uint)0x7FFFFFFF, (uint)0x00000001), BinaryIntegerHelper.DivRem((uint)0xFFFFFFFF, 2)); } [Fact] @@ -725,11 +724,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((uint)0x00000000, NumberHelper.Sign((uint)0x00000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Sign((uint)0x00000001)); - Assert.Equal((uint)0x00000001, NumberHelper.Sign((uint)0x7FFFFFFF)); - Assert.Equal((uint)0x00000001, NumberHelper.Sign((uint)0x80000000)); - Assert.Equal((uint)0x00000001, NumberHelper.Sign((uint)0xFFFFFFFF)); + Assert.Equal(0, NumberHelper.Sign((uint)0x00000000)); + Assert.Equal(1, NumberHelper.Sign((uint)0x00000001)); + Assert.Equal(1, NumberHelper.Sign((uint)0x7FFFFFFF)); + Assert.Equal(1, NumberHelper.Sign((uint)0x80000000)); + Assert.Equal(1, NumberHelper.Sign((uint)0xFFFFFFFF)); } [Fact] @@ -1063,9 +1062,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1082,7 +1081,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1100,9 +1099,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(uint), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1119,7 +1118,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1137,7 +1136,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1161,7 +1160,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(uint), result); } diff --git a/src/libraries/System.Runtime/tests/System/UInt64Tests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/UInt64Tests.GenericMath.cs index 2a2b0859c48e07..bea9f59475b295 100644 --- a/src/libraries/System.Runtime/tests/System/UInt64Tests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/UInt64Tests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class UInt64Tests_GenericMath { [Fact] @@ -37,13 +36,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((ulong)0x0000000000000001, NumberHelper.One); + Assert.Equal((ulong)0x0000000000000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Zero); + Assert.Equal((ulong)0x0000000000000000, NumberBaseHelper.Zero); } [Fact] @@ -297,134 +296,134 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x00)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x01)); - Assert.Equal((ulong)0x000000000000007F, NumberHelper.Create(0x7F)); - Assert.Equal((ulong)0x0000000000000080, NumberHelper.Create(0x80)); - Assert.Equal((ulong)0x00000000000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((ulong)0x000000000000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((ulong)0x0000000000000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((ulong)0x00000000000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((ulong)0x0000000000008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((ulong)0x000000000000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((ulong)0x0000000000008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((ulong)0x000000000000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x0000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x0001)); - Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x00000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x00000001)); - Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x0000000000000001)); - Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x00)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x01)); - Assert.Equal((ulong)0x000000000000007F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((ulong)0x000000000000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x0000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x0001)); - Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((ulong)0x0000000000008000, NumberHelper.Create(0x8000)); - Assert.Equal((ulong)0x000000000000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((ulong)0x0000000000007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((ulong)0x0000000000008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((ulong)0x000000000000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x00000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x00000001)); - Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal((ulong)0x0000000080000000, NumberHelper.Create(0x80000000)); - Assert.Equal((ulong)0x00000000FFFFFFFF, NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal((ulong)0x0000000080000000, NumberHelper.CreateChecked(0x80000000)); + Assert.Equal((ulong)0x00000000FFFFFFFF, NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(0x0000000000000001)); - Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Equal((ulong)0x8000000000000000, NumberHelper.Create(0x8000000000000000)); - Assert.Equal((ulong)0xFFFFFFFFFFFFFFFF, NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Equal((ulong)0x8000000000000000, NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Equal((ulong)0xFFFFFFFFFFFFFFFF, NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal((ulong)0x8000000000000000, NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Equal((ulong)0xFFFFFFFFFFFFFFFF, NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Equal((ulong)0x7FFFFFFFFFFFFFFF, NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal((ulong)0x8000000000000000, NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Equal((ulong)0xFFFFFFFFFFFFFFFF, NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Equal((ulong)0x0000000080000000, NumberHelper.Create((nuint)0x80000000)); - Assert.Equal((ulong)0x00000000FFFFFFFF, NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((ulong)0x0000000000000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((ulong)0x0000000000000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((ulong)0x000000007FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Equal((ulong)0x0000000080000000, NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Equal((ulong)0x00000000FFFFFFFF, NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -695,11 +694,11 @@ public static void CreateTruncatingFromUIntPtrTest() [Fact] public static void DivRemTest() { - Assert.Equal(((ulong)0x0000000000000000, (ulong)0x0000000000000000), NumberHelper.DivRem((ulong)0x0000000000000000, 2)); - Assert.Equal(((ulong)0x0000000000000000, (ulong)0x0000000000000001), NumberHelper.DivRem((ulong)0x0000000000000001, 2)); - Assert.Equal(((ulong)0x3FFFFFFFFFFFFFFF, (ulong)0x0000000000000001), NumberHelper.DivRem((ulong)0x7FFFFFFFFFFFFFFF, 2)); - Assert.Equal(((ulong)0x4000000000000000, (ulong)0x0000000000000000), NumberHelper.DivRem((ulong)0x8000000000000000, 2)); - Assert.Equal(((ulong)0x7FFFFFFFFFFFFFFF, (ulong)0x0000000000000001), NumberHelper.DivRem((ulong)0xFFFFFFFFFFFFFFFF, 2)); + Assert.Equal(((ulong)0x0000000000000000, (ulong)0x0000000000000000), BinaryIntegerHelper.DivRem((ulong)0x0000000000000000, 2)); + Assert.Equal(((ulong)0x0000000000000000, (ulong)0x0000000000000001), BinaryIntegerHelper.DivRem((ulong)0x0000000000000001, 2)); + Assert.Equal(((ulong)0x3FFFFFFFFFFFFFFF, (ulong)0x0000000000000001), BinaryIntegerHelper.DivRem((ulong)0x7FFFFFFFFFFFFFFF, 2)); + Assert.Equal(((ulong)0x4000000000000000, (ulong)0x0000000000000000), BinaryIntegerHelper.DivRem((ulong)0x8000000000000000, 2)); + Assert.Equal(((ulong)0x7FFFFFFFFFFFFFFF, (ulong)0x0000000000000001), BinaryIntegerHelper.DivRem((ulong)0xFFFFFFFFFFFFFFFF, 2)); } [Fact] @@ -725,11 +724,11 @@ public static void MinTest() [Fact] public static void SignTest() { - Assert.Equal((ulong)0x0000000000000000, NumberHelper.Sign((ulong)0x0000000000000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Sign((ulong)0x0000000000000001)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Sign((ulong)0x7FFFFFFFFFFFFFFF)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Sign((ulong)0x8000000000000000)); - Assert.Equal((ulong)0x0000000000000001, NumberHelper.Sign((ulong)0xFFFFFFFFFFFFFFFF)); + Assert.Equal(0, NumberHelper.Sign((ulong)0x0000000000000000)); + Assert.Equal(1, NumberHelper.Sign((ulong)0x0000000000000001)); + Assert.Equal(1, NumberHelper.Sign((ulong)0x7FFFFFFFFFFFFFFF)); + Assert.Equal(1, NumberHelper.Sign((ulong)0x8000000000000000)); + Assert.Equal(1, NumberHelper.Sign((ulong)0xFFFFFFFFFFFFFFFF)); } [Fact] @@ -1063,9 +1062,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1082,7 +1081,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1100,9 +1099,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(ulong), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1119,7 +1118,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1137,7 +1136,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1161,7 +1160,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(ulong), result); } diff --git a/src/libraries/System.Runtime/tests/System/UIntPtrTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System/UIntPtrTests.GenericMath.cs index f67397441d75a2..d39fe0b5fc929a 100644 --- a/src/libraries/System.Runtime/tests/System/UIntPtrTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System/UIntPtrTests.GenericMath.cs @@ -7,7 +7,6 @@ namespace System.Tests { - [RequiresPreviewFeaturesAttribute] public class UIntPtrTests_GenericMath { [Fact] @@ -44,13 +43,13 @@ public static void MultiplicativeIdentityTest() [Fact] public static void OneTest() { - Assert.Equal((nuint)0x00000001, NumberHelper.One); + Assert.Equal((nuint)0x00000001, NumberBaseHelper.One); } [Fact] public static void ZeroTest() { - Assert.Equal((nuint)0x00000000, NumberHelper.Zero); + Assert.Equal((nuint)0x00000000, NumberBaseHelper.Zero); } [Fact] @@ -579,156 +578,156 @@ public static void ClampTest() } [Fact] - public static void CreateFromByteTest() + public static void CreateCheckedFromByteTest() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((nuint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Equal((nuint)0x00000080, NumberHelper.Create(0x80)); - Assert.Equal((nuint)0x000000FF, NumberHelper.Create(0xFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((nuint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Equal((nuint)0x00000080, NumberHelper.CreateChecked(0x80)); + Assert.Equal((nuint)0x000000FF, NumberHelper.CreateChecked(0xFF)); } [Fact] - public static void CreateFromCharTest() + public static void CreateCheckedFromCharTest() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create((char)0x0000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create((char)0x0001)); - Assert.Equal((nuint)0x00007FFF, NumberHelper.Create((char)0x7FFF)); - Assert.Equal((nuint)0x00008000, NumberHelper.Create((char)0x8000)); - Assert.Equal((nuint)0x0000FFFF, NumberHelper.Create((char)0xFFFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked((char)0x0000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked((char)0x0001)); + Assert.Equal((nuint)0x00007FFF, NumberHelper.CreateChecked((char)0x7FFF)); + Assert.Equal((nuint)0x00008000, NumberHelper.CreateChecked((char)0x8000)); + Assert.Equal((nuint)0x0000FFFF, NumberHelper.CreateChecked((char)0xFFFF)); } [Fact] - public static void CreateFromInt16Test() + public static void CreateCheckedFromInt16Test() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((nuint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0x8000))); - Assert.Throws(() => NumberHelper.Create(unchecked((short)0xFFFF))); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((nuint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0x8000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((short)0xFFFF))); } [Fact] - public static void CreateFromInt32Test() + public static void CreateCheckedFromInt32Test() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((int)0xFFFFFFFF))); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((int)0xFFFFFFFF))); } [Fact] - public static void CreateFromInt64Test() + public static void CreateCheckedFromInt64Test() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.Create(0x0000000000000000)); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Create(0x0000000000000001)); - Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((long)0xFFFFFFFFFFFFFFFF))); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((long)0xFFFFFFFFFFFFFFFF))); } } [Fact] - public static void CreateFromIntPtrTest() + public static void CreateCheckedFromIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.Create(unchecked((nint)0x0000000000000000))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Create(unchecked((nint)0x0000000000000001))); - Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nint)0x7FFFFFFFFFFFFFFF))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x8000000000000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.CreateChecked(unchecked((nint)0x0000000000000000))); + Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.CreateChecked(unchecked((nint)0x0000000000000001))); + Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nint)0x7FFFFFFFFFFFFFFF))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x8000000000000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nuint)0x00000000, NumberHelper.Create((nint)0x00000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create((nint)0x00000001)); - Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.Create((nint)0x7FFFFFFF)); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0x80000000))); - Assert.Throws(() => NumberHelper.Create(unchecked((nint)0xFFFFFFFF))); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked((nint)0x00000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked((nint)0x00000001)); + Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.CreateChecked((nint)0x7FFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0x80000000))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((nint)0xFFFFFFFF))); } } [Fact] - public static void CreateFromSByteTest() + public static void CreateCheckedFromSByteTest() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x00)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x01)); - Assert.Equal((nuint)0x0000007F, NumberHelper.Create(0x7F)); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0x80))); - Assert.Throws(() => NumberHelper.Create(unchecked((sbyte)0xFF))); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x00)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x01)); + Assert.Equal((nuint)0x0000007F, NumberHelper.CreateChecked(0x7F)); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0x80))); + Assert.Throws(() => NumberHelper.CreateChecked(unchecked((sbyte)0xFF))); } [Fact] - public static void CreateFromUInt16Test() + public static void CreateCheckedFromUInt16Test() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x0000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x0001)); - Assert.Equal((nuint)0x00007FFF, NumberHelper.Create(0x7FFF)); - Assert.Equal((nuint)0x00008000, NumberHelper.Create(0x8000)); - Assert.Equal((nuint)0x0000FFFF, NumberHelper.Create(0xFFFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x0000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x0001)); + Assert.Equal((nuint)0x00007FFF, NumberHelper.CreateChecked(0x7FFF)); + Assert.Equal((nuint)0x00008000, NumberHelper.CreateChecked(0x8000)); + Assert.Equal((nuint)0x0000FFFF, NumberHelper.CreateChecked(0xFFFF)); } [Fact] - public static void CreateFromUInt32Test() + public static void CreateCheckedFromUInt32Test() { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x00000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x00000001)); - Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.Create(0x7FFFFFFF)); - Assert.Equal((nuint)0x80000000, NumberHelper.Create(0x80000000)); - Assert.Equal((nuint)0xFFFFFFFF, NumberHelper.Create(0xFFFFFFFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x00000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x00000001)); + Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.CreateChecked(0x7FFFFFFF)); + Assert.Equal((nuint)0x80000000, NumberHelper.CreateChecked(0x80000000)); + Assert.Equal((nuint)0xFFFFFFFF, NumberHelper.CreateChecked(0xFFFFFFFF)); } [Fact] - public static void CreateFromUInt64Test() + public static void CreateCheckedFromUInt64Test() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.Create(0x0000000000000000)); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Create(0x0000000000000001)); - Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Equal(unchecked((nuint)0x8000000000000000), NumberHelper.Create(0x8000000000000000)); - Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Equal(unchecked((nuint)0x8000000000000000), NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } else { - Assert.Equal((nuint)0x00000000, NumberHelper.Create(0x0000000000000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create(0x0000000000000001)); - Assert.Throws(() => NumberHelper.Create(0x7FFFFFFFFFFFFFFF)); - Assert.Throws(() => NumberHelper.Create(0x8000000000000000)); - Assert.Throws(() => NumberHelper.Create(0xFFFFFFFFFFFFFFFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked(0x0000000000000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked(0x0000000000000001)); + Assert.Throws(() => NumberHelper.CreateChecked(0x7FFFFFFFFFFFFFFF)); + Assert.Throws(() => NumberHelper.CreateChecked(0x8000000000000000)); + Assert.Throws(() => NumberHelper.CreateChecked(0xFFFFFFFFFFFFFFFF)); } } [Fact] - public static void CreateFromUIntPtrTest() + public static void CreateCheckedFromUIntPtrTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.Create(unchecked((nuint)0x0000000000000000))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Create(unchecked((nuint)0x0000000000000001))); - Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal(unchecked((nuint)0x8000000000000000), NumberHelper.Create(unchecked((nuint)0x8000000000000000))); - Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFF), NumberHelper.Create(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000000))); + Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.CreateChecked(unchecked((nuint)0x0000000000000001))); + Assert.Equal(unchecked((nuint)0x7FFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal(unchecked((nuint)0x8000000000000000), NumberHelper.CreateChecked(unchecked((nuint)0x8000000000000000))); + Assert.Equal(unchecked((nuint)0xFFFFFFFFFFFFFFFF), NumberHelper.CreateChecked(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nuint)0x00000000, NumberHelper.Create((nuint)0x00000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Create((nuint)0x00000001)); - Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.Create((nuint)0x7FFFFFFF)); - Assert.Equal((nuint)0x80000000, NumberHelper.Create((nuint)0x80000000)); - Assert.Equal((nuint)0xFFFFFFFF, NumberHelper.Create((nuint)0xFFFFFFFF)); + Assert.Equal((nuint)0x00000000, NumberHelper.CreateChecked((nuint)0x00000000)); + Assert.Equal((nuint)0x00000001, NumberHelper.CreateChecked((nuint)0x00000001)); + Assert.Equal((nuint)0x7FFFFFFF, NumberHelper.CreateChecked((nuint)0x7FFFFFFF)); + Assert.Equal((nuint)0x80000000, NumberHelper.CreateChecked((nuint)0x80000000)); + Assert.Equal((nuint)0xFFFFFFFF, NumberHelper.CreateChecked((nuint)0xFFFFFFFF)); } } @@ -1078,19 +1077,19 @@ public static void DivRemTest() { if (Environment.Is64BitProcess) { - Assert.Equal((unchecked((nuint)0x0000000000000000), unchecked((nuint)0x0000000000000000)), NumberHelper.DivRem(unchecked((nuint)0x0000000000000000), (nuint)2)); - Assert.Equal((unchecked((nuint)0x0000000000000000), unchecked((nuint)0x0000000000000001)), NumberHelper.DivRem(unchecked((nuint)0x0000000000000001), (nuint)2)); - Assert.Equal((unchecked((nuint)0x3FFFFFFFFFFFFFFF), unchecked((nuint)0x0000000000000001)), NumberHelper.DivRem(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2)); - Assert.Equal((unchecked((nuint)0x4000000000000000), unchecked((nuint)0x0000000000000000)), NumberHelper.DivRem(unchecked((nuint)0x8000000000000000), (nuint)2)); - Assert.Equal((unchecked((nuint)0x7FFFFFFFFFFFFFFF), unchecked((nuint)0x0000000000000001)), NumberHelper.DivRem(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2)); + Assert.Equal((unchecked((nuint)0x0000000000000000), unchecked((nuint)0x0000000000000000)), BinaryIntegerHelper.DivRem(unchecked((nuint)0x0000000000000000), (nuint)2)); + Assert.Equal((unchecked((nuint)0x0000000000000000), unchecked((nuint)0x0000000000000001)), BinaryIntegerHelper.DivRem(unchecked((nuint)0x0000000000000001), (nuint)2)); + Assert.Equal((unchecked((nuint)0x3FFFFFFFFFFFFFFF), unchecked((nuint)0x0000000000000001)), BinaryIntegerHelper.DivRem(unchecked((nuint)0x7FFFFFFFFFFFFFFF), (nuint)2)); + Assert.Equal((unchecked((nuint)0x4000000000000000), unchecked((nuint)0x0000000000000000)), BinaryIntegerHelper.DivRem(unchecked((nuint)0x8000000000000000), (nuint)2)); + Assert.Equal((unchecked((nuint)0x7FFFFFFFFFFFFFFF), unchecked((nuint)0x0000000000000001)), BinaryIntegerHelper.DivRem(unchecked((nuint)0xFFFFFFFFFFFFFFFF), (nuint)2)); } else { - Assert.Equal(((nuint)0x00000000, (nuint)0x00000000), NumberHelper.DivRem((nuint)0x00000000, (nuint)2)); - Assert.Equal(((nuint)0x00000000, (nuint)0x00000001), NumberHelper.DivRem((nuint)0x00000001, (nuint)2)); - Assert.Equal(((nuint)0x3FFFFFFF, (nuint)0x00000001), NumberHelper.DivRem((nuint)0x7FFFFFFF, (nuint)2)); - Assert.Equal(((nuint)0x40000000, (nuint)0x00000000), NumberHelper.DivRem((nuint)0x80000000, (nuint)2)); - Assert.Equal(((nuint)0x7FFFFFFF, (nuint)0x00000001), NumberHelper.DivRem((nuint)0xFFFFFFFF, (nuint)2)); + Assert.Equal(((nuint)0x00000000, (nuint)0x00000000), BinaryIntegerHelper.DivRem((nuint)0x00000000, (nuint)2)); + Assert.Equal(((nuint)0x00000000, (nuint)0x00000001), BinaryIntegerHelper.DivRem((nuint)0x00000001, (nuint)2)); + Assert.Equal(((nuint)0x3FFFFFFF, (nuint)0x00000001), BinaryIntegerHelper.DivRem((nuint)0x7FFFFFFF, (nuint)2)); + Assert.Equal(((nuint)0x40000000, (nuint)0x00000000), BinaryIntegerHelper.DivRem((nuint)0x80000000, (nuint)2)); + Assert.Equal(((nuint)0x7FFFFFFF, (nuint)0x00000001), BinaryIntegerHelper.DivRem((nuint)0xFFFFFFFF, (nuint)2)); } } @@ -1141,19 +1140,19 @@ public static void SignTest() { if (Environment.Is64BitProcess) { - Assert.Equal(unchecked((nuint)0x0000000000000000), NumberHelper.Sign(unchecked((nuint)0x0000000000000000))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Sign(unchecked((nuint)0x0000000000000001))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Sign(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Sign(unchecked((nuint)0x8000000000000000))); - Assert.Equal(unchecked((nuint)0x0000000000000001), NumberHelper.Sign(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); + Assert.Equal(0, NumberHelper.Sign(unchecked((nuint)0x0000000000000000))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nuint)0x0000000000000001))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nuint)0x7FFFFFFFFFFFFFFF))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nuint)0x8000000000000000))); + Assert.Equal(1, NumberHelper.Sign(unchecked((nuint)0xFFFFFFFFFFFFFFFF))); } else { - Assert.Equal((nuint)0x00000000, NumberHelper.Sign((nuint)0x00000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Sign((nuint)0x00000001)); - Assert.Equal((nuint)0x00000001, NumberHelper.Sign((nuint)0x7FFFFFFF)); - Assert.Equal((nuint)0x00000001, NumberHelper.Sign((nuint)0x80000000)); - Assert.Equal((nuint)0x00000001, NumberHelper.Sign((nuint)0xFFFFFFFF)); + Assert.Equal(0, NumberHelper.Sign((nuint)0x00000000)); + Assert.Equal(1, NumberHelper.Sign((nuint)0x00000001)); + Assert.Equal(1, NumberHelper.Sign((nuint)0x7FFFFFFF)); + Assert.Equal(1, NumberHelper.Sign((nuint)0x80000000)); + Assert.Equal(1, NumberHelper.Sign((nuint)0xFFFFFFFF)); } } @@ -1583,9 +1582,9 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(ParseableHelper.TryParse(value, provider, out result)); + Assert.True(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(expected, result); - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Default provider @@ -1602,7 +1601,7 @@ public static void ParseValidStringTest(string value, NumberStyles style, IForma // Default style if (style == NumberStyles.Integer) { - Assert.Equal(expected, ParseableHelper.Parse(value, provider)); + Assert.Equal(expected, ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1620,9 +1619,9 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(ParseableHelper.TryParse(value, provider, out result)); + Assert.False(ParsableHelper.TryParse(value, provider, out result)); Assert.Equal(default(nuint), result); - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Default provider @@ -1639,7 +1638,7 @@ public static void ParseInvalidStringTest(string value, NumberStyles style, IFor // Default style if (style == NumberStyles.Integer) { - Assert.Throws(exceptionType, () => ParseableHelper.Parse(value, provider)); + Assert.Throws(exceptionType, () => ParsableHelper.Parse(value, provider)); } // Full overloads @@ -1657,7 +1656,7 @@ public static void ParseValidSpanTest(string value, int offset, int count, Numbe // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.True(SpanParseableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); + Assert.True(SpanParsableHelper.TryParse(value.AsSpan(offset, count), provider, out result)); Assert.Equal(expected, result); } @@ -1681,7 +1680,7 @@ public static void ParseInvalidSpanTest(string value, NumberStyles style, IForma // Default style and provider if ((style == NumberStyles.Integer) && (provider is null)) { - Assert.False(SpanParseableHelper.TryParse(value.AsSpan(), provider, out result)); + Assert.False(SpanParsableHelper.TryParse(value.AsSpan(), provider, out result)); Assert.Equal(default(nuint), result); }