358 instantiations of UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
127
return new
UInt128
(hash.High64, hash.Low64);
212
return new
UInt128
(current.High64, current.Low64);
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
129
return new
UInt128
(hash.High64, hash.Low64);
214
return new
UInt128
(current.High64, current.Low64);
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
125
return new
UInt128
(hash.High64, hash.Low64);
210
return new
UInt128
(current.High64, current.Low64);
System.Private.CoreLib (340)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (1)
189
return new
UInt128
(
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (1)
35
value /= new
UInt128
(0x5, 0x6BC7_5E2D_6310_0000); // value /= 1e20
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (2)
1749
UInt128 mantissa = new
UInt128
(high, low64);
1823
return new
UInt128
((exponent == DEC_SCALE_MAX) ? 2u : 0u, pow5[exponent]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (2)
422
public static explicit operator UInt128(Int128 value) => new
UInt128
(value._upper, value._lower);
435
return new
UInt128
(value._upper, value._lower);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
285
return new
UInt128
(high, low);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (2)
1356
return new
UInt128
(((ulong)_blocks[3] << 32) + _blocks[2], ((ulong)(_blocks[1]) << 32) + _blocks[0]);
1361
return new
UInt128
((ulong)_blocks[2], ((ulong)_blocks[1] << 32) + _blocks[0]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128.cs (2)
551
return new
UInt128
((ulong)value._sign << 32, 0);
596
return new
UInt128
(currentDigit, lowWord);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Conversions.cs (1)
158
UInt128 fraction = new
UInt128
(value._hi, value._lo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128PiTrig.cs (1)
95
UInt128 significand = new
UInt128
(value._hi, value._lo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Trig.cs (4)
178
UInt128 p = (UInt128)a * b + new
UInt128
(addHi, addLo);
186
UInt128 addend = new
UInt128
(addHi, addLo);
196
UInt128 prod = (UInt128)a * b + new
UInt128
(carryIn, 0);
197
UInt128 addend = new
UInt128
(addHi, addLo);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (1)
2837
UInt128 divisor = new
UInt128
(0, 10_000_000_000_000_000_000);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Rounding.cs (1)
145
: TryGetFloorAndMidpoint(new
UInt128
(high, low), shift, DoubleIntegerBoundaryLog2, out floor, out midpointComparison, out hasRemainder);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal128.cs (225)
40
private static UInt128 PositiveInfinityValue => new
UInt128
(upper: 0x7800_0000_0000_0000, lower: 0);
41
private static UInt128 NegativeInfinityValue => new
UInt128
(upper: 0xF800_0000_0000_0000, lower: 0);
44
private static UInt128 ZeroValue => new
UInt128
(0x3040_0000_0000_0000, 0);
45
private static UInt128 NegativeZeroValue => new
UInt128
(0xB040_0000_0000_0000, 0);
47
private static UInt128 OneValue => new
UInt128
(0x3040_0000_0000_0000, 1);
48
private static UInt128 NegativeOneValue => new
UInt128
(0xB040_0000_0000_0000, 1);
50
private static UInt128 EValue => new
UInt128
(0x2FFE_8605_8A4B_F4DE, 0x4E90_6ACC_B26A_BB56); // +2.718281828459045235360287471352662
51
private static UInt128 PiValue => new
UInt128
(0x2FFE_9AE4_7957_96A7, 0xBABE_5564_E6F3_9F8F); // +3.141592653589793238462643383279503
52
private static UInt128 TauValue => new
UInt128
(0x2FFF_35C8_F2AF_2D4F, 0x757C_AAC9_CDE7_3F1E); // +6.283185307179586476925286766559006
53
private static UInt128 QuietNaNValue => new
UInt128
(0xFC00_0000_0000_0000, 0);
54
private static UInt128 NaNPayloadMask => new
UInt128
(0x0000_3FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
221
var current = new
UInt128
(_upper, _lower);
222
var another = new
UInt128
(other._upper, other._lower);
229
var current = new
UInt128
(_upper, _lower);
230
var another = new
UInt128
(other._upper, other._lower);
247
return Number.GetDecimalIeee754HashCode<Decimal128, UInt128>(new
UInt128
(_upper, _lower));
254
public static UInt128 EncodeBinary(Decimal128 x) => new
UInt128
(x._upper, x._lower);
266
public static UInt128 EncodeDecimal(Decimal128 x) => Number.EncodeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower));
279
return Number.FormatDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower), null, NumberFormatInfo.CurrentInfo);
287
return Number.FormatDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower), format, NumberFormatInfo.CurrentInfo);
295
return Number.FormatDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower), null, NumberFormatInfo.GetInstance(provider));
303
return Number.FormatDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower), format, NumberFormatInfo.GetInstance(provider));
309
return Number.TryFormatDecimalIeee754<Decimal128, UInt128, char>(new
UInt128
(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten);
315
return Number.TryFormatDecimalIeee754<Decimal128, UInt128, byte>(new
UInt128
(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), utf8Destination, out bytesWritten);
333
UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower), OneValue);
342
UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower), OneValue);
352
UInt128 result = Number.AddDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
362
UInt128 result = Number.SubtractDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
372
UInt128 result = Number.MultiplyDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
382
UInt128 result = Number.DivideDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
392
UInt128 result = Number.RemainderDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
433
public static explicit operator byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new
UInt128
(value._upper, value._lower), isChecked: false);
439
public static explicit operator checked byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, byte>(new
UInt128
(value._upper, value._lower), isChecked: true);
445
public static explicit operator sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new
UInt128
(value._upper, value._lower), isChecked: false);
452
public static explicit operator checked sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, sbyte>(new
UInt128
(value._upper, value._lower), isChecked: true);
457
public static explicit operator char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new
UInt128
(value._upper, value._lower), isChecked: false);
463
public static explicit operator checked char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new
UInt128
(value._upper, value._lower), isChecked: true);
468
public static explicit operator short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new
UInt128
(value._upper, value._lower), isChecked: false);
474
public static explicit operator checked short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, short>(new
UInt128
(value._upper, value._lower), isChecked: true);
480
public static explicit operator ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new
UInt128
(value._upper, value._lower), isChecked: false);
487
public static explicit operator checked ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ushort>(new
UInt128
(value._upper, value._lower), isChecked: true);
492
public static explicit operator int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new
UInt128
(value._upper, value._lower), isChecked: false);
498
public static explicit operator checked int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, int>(new
UInt128
(value._upper, value._lower), isChecked: true);
504
public static explicit operator uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new
UInt128
(value._upper, value._lower), isChecked: false);
511
public static explicit operator checked uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, uint>(new
UInt128
(value._upper, value._lower), isChecked: true);
516
public static explicit operator nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new
UInt128
(value._upper, value._lower), isChecked: false);
522
public static explicit operator checked nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nint>(new
UInt128
(value._upper, value._lower), isChecked: true);
528
public static explicit operator nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new
UInt128
(value._upper, value._lower), isChecked: false);
535
public static explicit operator checked nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, nuint>(new
UInt128
(value._upper, value._lower), isChecked: true);
540
public static explicit operator long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new
UInt128
(value._upper, value._lower), isChecked: false);
546
public static explicit operator checked long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, long>(new
UInt128
(value._upper, value._lower), isChecked: true);
552
public static explicit operator ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new
UInt128
(value._upper, value._lower), isChecked: false);
559
public static explicit operator checked ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, ulong>(new
UInt128
(value._upper, value._lower), isChecked: true);
564
public static explicit operator Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new
UInt128
(value._upper, value._lower), isChecked: false);
570
public static explicit operator checked Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, Int128>(new
UInt128
(value._upper, value._lower), isChecked: true);
576
public static explicit operator UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new
UInt128
(value._upper, value._lower), isChecked: false);
583
public static explicit operator checked UInt128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128, UInt128, UInt128>(new
UInt128
(value._upper, value._lower), isChecked: true);
588
public static explicit operator Half(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, Half>(new
UInt128
(value._upper, value._lower));
593
public static explicit operator float(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, float>(new
UInt128
(value._upper, value._lower));
598
public static explicit operator double(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128, UInt128, double>(new
UInt128
(value._upper, value._lower));
604
public static explicit operator decimal(Decimal128 value) => Number.ConvertDecimalIeee754ToDecimal<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
681
return Number.EqualsDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
699
return Number.LessThanDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
708
return Number.GreaterThanDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
717
return Number.LessThanOrEqualDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
726
return Number.GreaterThanOrEqualDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower));
795
public static Decimal128 Ceiling(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), 0, MidpointRounding.ToPositiveInfinity));
806
public static Decimal128 Floor(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), 0, MidpointRounding.ToNegativeInfinity));
809
public static Decimal128 Round(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), 0, MidpointRounding.ToEven));
812
public static Decimal128 Round(Decimal128 x, int digits) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), digits, MidpointRounding.ToEven));
815
public static Decimal128 Round(Decimal128 x, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), 0, mode));
818
public static Decimal128 Round(Decimal128 x, int digits, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), digits, mode));
821
public static Decimal128 Truncate(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), 0, MidpointRounding.ToZero));
829
int exponent = Number.UnpackDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower)).UnbiasedExponent;
850
if (BinaryPrimitives.TryWriteInt32BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower)).UnbiasedExponent))
863
if (BinaryPrimitives.TryWriteInt32LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower)).UnbiasedExponent))
876
if (BinaryPrimitives.TryWriteUInt128BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower)).Significand))
889
if (BinaryPrimitives.TryWriteUInt128LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128, UInt128>(new
UInt128
(_upper, _lower)).Significand))
904
public static Decimal128 Acos(Decimal128 x) => new Decimal128(Number.AcosDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
907
public static Decimal128 AcosPi(Decimal128 x) => new Decimal128(Number.AcosPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
910
public static Decimal128 Acosh(Decimal128 x) => new Decimal128(Number.AcoshDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
913
public static Decimal128 Asin(Decimal128 x) => new Decimal128(Number.AsinDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
916
public static Decimal128 AsinPi(Decimal128 x) => new Decimal128(Number.AsinPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
919
public static Decimal128 Asinh(Decimal128 x) => new Decimal128(Number.AsinhDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
922
public static Decimal128 Atan(Decimal128 x) => new Decimal128(Number.AtanDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
925
public static Decimal128 Atan2(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2DecimalIeee754<Decimal128, UInt128>(new
UInt128
(y._upper, y._lower), new
UInt128
(x._upper, x._lower)));
928
public static Decimal128 Atan2Pi(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2PiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(y._upper, y._lower), new
UInt128
(x._upper, x._lower)));
931
public static Decimal128 AtanPi(Decimal128 x) => new Decimal128(Number.AtanPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
934
public static Decimal128 Atanh(Decimal128 x) => new Decimal128(Number.AtanhDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
937
public static Decimal128 BitDecrement(Decimal128 x) => new Decimal128(Number.BitDecrementDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
940
public static Decimal128 BitIncrement(Decimal128 x) => new Decimal128(Number.BitIncrementDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
943
public static Decimal128 Cbrt(Decimal128 x) => new Decimal128(Number.CbrtDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
946
public static Decimal128 Cos(Decimal128 x) => new Decimal128(Number.CosDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
949
public static Decimal128 CosPi(Decimal128 x) => new Decimal128(Number.CosPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
952
public static Decimal128 Cosh(Decimal128 x) => new Decimal128(Number.CoshDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
955
public static Decimal128 Exp(Decimal128 x) => new Decimal128(Number.ExpDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
958
public static Decimal128 Exp10(Decimal128 x) => new Decimal128(Number.Exp10DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
961
public static Decimal128 Exp10M1(Decimal128 x) => new Decimal128(Number.Exp10M1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
964
public static Decimal128 Exp2(Decimal128 x) => new Decimal128(Number.Exp2DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
967
public static Decimal128 Exp2M1(Decimal128 x) => new Decimal128(Number.Exp2M1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
970
public static Decimal128 ExpM1(Decimal128 x) => new Decimal128(Number.ExpM1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
973
public static Decimal128 FusedMultiplyAdd(Decimal128 left, Decimal128 right, Decimal128 addend) => new Decimal128(Number.FusedMultiplyAddDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower), new
UInt128
(addend._upper, addend._lower)));
976
public static Decimal128 Hypot(Decimal128 x, Decimal128 y) => new Decimal128(Number.HypotDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
979
public static Decimal128 Ieee754Remainder(Decimal128 left, Decimal128 right) => new Decimal128(Number.Ieee754RemainderDecimalIeee754<Decimal128, UInt128>(new
UInt128
(left._upper, left._lower), new
UInt128
(right._upper, right._lower)));
982
public static int ILogB(Decimal128 x) => Number.ILogBDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower));
988
public static Decimal128 Log(Decimal128 x) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
991
public static Decimal128 Log(Decimal128 x, Decimal128 newBase) => new Decimal128(Number.LogDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(newBase._upper, newBase._lower)));
994
public static Decimal128 Log10(Decimal128 x) => new Decimal128(Number.Log10DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
997
public static Decimal128 Log10P1(Decimal128 x) => new Decimal128(Number.Log10P1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1000
public static Decimal128 Log2(Decimal128 x) => new Decimal128(Number.Log2DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1003
public static Decimal128 Log2P1(Decimal128 x) => new Decimal128(Number.Log2P1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1006
public static Decimal128 LogP1(Decimal128 x) => new Decimal128(Number.LogP1DecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1009
public static Decimal128 Pow(Decimal128 x, Decimal128 y) => new Decimal128(Number.PowDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1018
public static Decimal128 RootN(Decimal128 x, int n) => new Decimal128(Number.RootNDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), n));
1021
public static Decimal128 ScaleB(Decimal128 x, int n) => new Decimal128(Number.ScaleBDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), n));
1024
public static Decimal128 Sin(Decimal128 x) => new Decimal128(Number.SinDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1029
(UInt128 sin, UInt128 cos) = Number.SinCosDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower));
1036
(UInt128 sin, UInt128 cos) = Number.SinCosPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower));
1041
public static Decimal128 SinPi(Decimal128 x) => new Decimal128(Number.SinPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1044
public static Decimal128 Sinh(Decimal128 x) => new Decimal128(Number.SinhDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1047
public static Decimal128 Sqrt(Decimal128 x) => new Decimal128(Number.SqrtDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1050
public static Decimal128 Tan(Decimal128 x) => new Decimal128(Number.TanDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1053
public static Decimal128 TanPi(Decimal128 x) => new Decimal128(Number.TanPiDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1056
public static Decimal128 Tanh(Decimal128 x) => new Decimal128(Number.TanhDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1062
public static Decimal128 Quantize(Decimal128 x, Decimal128 y) => new Decimal128(Number.QuantizeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1067
public static Decimal128 GetQuantum(Decimal128 x) => new Decimal128(Number.QuantumDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower)));
1073
public static bool HaveSameQuantum(Decimal128 x, Decimal128 y) => Number.SameQuantumDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower));
1078
public static Decimal128 Abs(Decimal128 value) => new Decimal128(Number.AbsDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower)));
1123
public static bool IsInteger(Decimal128 value) => Number.IsIntegerDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1128
public static bool IsEvenInteger(Decimal128 value) => Number.IsEvenIntegerDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1133
public static bool IsOddInteger(Decimal128 value) => Number.IsOddIntegerDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1138
public static bool IsNormal(Decimal128 value) => Number.IsNormalDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1143
public static bool IsSubnormal(Decimal128 value) => Number.IsSubnormalDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1149
public static Decimal128 MaxMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1155
public static Decimal128 MaxMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1161
public static Decimal128 MinMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1167
public static Decimal128 MinMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeNumberDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1210
public static Decimal128 CopySign(Decimal128 value, Decimal128 sign) => new Decimal128(Number.CopySignDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower), new
UInt128
(sign._upper, sign._lower)));
1216
public static Decimal128 Max(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1222
public static Decimal128 MaxNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNativeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1228
public static Decimal128 MaxNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNumberDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1234
public static Decimal128 Min(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1240
public static Decimal128 MinNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNativeDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1246
public static Decimal128 MinNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNumberDecimalIeee754<Decimal128, UInt128>(new
UInt128
(x._upper, x._lower), new
UInt128
(y._upper, y._lower)));
1252
public static int Sign(Decimal128 value) => Number.SignDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1258
static bool INumberBase<Decimal128>.IsCanonical(Decimal128 value) => Number.IsCanonicalDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower), nanReservedMask: new
UInt128
(0x01FF_C000_0000_0000, 0x0000_0000_0000_0000), nanPayloadMask: NaNPayloadMask, maxNaNPayload: new
UInt128
(0x0000_314D_C644_8D93, 0x38C1_5B09_FFFF_FFFF));
1267
static bool INumberBase<Decimal128>.IsZero(Decimal128 value) => Number.IsZeroDecimalIeee754<Decimal128, UInt128>(new
UInt128
(value._upper, value._lower));
1702
new
UInt128
(0, 1),
1703
new
UInt128
(0, 10),
1704
new
UInt128
(0, 100),
1705
new
UInt128
(0, 1000),
1706
new
UInt128
(0, 10000),
1707
new
UInt128
(0, 100000),
1708
new
UInt128
(0, 1000000),
1709
new
UInt128
(0, 10000000),
1710
new
UInt128
(0, 100000000),
1711
new
UInt128
(0, 1000000000),
1712
new
UInt128
(0, 10000000000),
1713
new
UInt128
(0, 100000000000),
1714
new
UInt128
(0, 1000000000000),
1715
new
UInt128
(0, 10000000000000),
1716
new
UInt128
(0, 100000000000000),
1717
new
UInt128
(0, 1000000000000000),
1718
new
UInt128
(0, 10000000000000000),
1719
new
UInt128
(0, 100000000000000000),
1720
new
UInt128
(0, 1000000000000000000),
1721
new
UInt128
(0, 10000000000000000000),
1722
new
UInt128
(5, 7766279631452241920),
1723
new
UInt128
(54, 3875820019684212736),
1724
new
UInt128
(542, 1864712049423024128),
1725
new
UInt128
(5421, 200376420520689664),
1726
new
UInt128
(54210, 2003764205206896640),
1727
new
UInt128
(542101, 1590897978359414784),
1728
new
UInt128
(5421010, 15908979783594147840),
1729
new
UInt128
(54210108, 11515845246265065472),
1730
new
UInt128
(542101086, 4477988020393345024),
1731
new
UInt128
(5421010862, 7886392056514347008),
1732
new
UInt128
(54210108624, 5076944270305263616),
1733
new
UInt128
(542101086242, 13875954555633532928),
1734
new
UInt128
(5421010862427, 9632337040368467968),
1735
new
UInt128
(54210108624275, 4089650035136921600),
1736
new
UInt128
(542101086242752, 4003012203950112768),
1791
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MostSignificantBitOfSignificandMask => new
UInt128
(0x0002_0000_0000_0000, 0);
1793
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.NaNMask => new
UInt128
(NaNMaskUpper, 0);
1795
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SNaNMask => new
UInt128
(SNaNMaskUpper, 0);
1799
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.SignMask => new
UInt128
(SignMaskUpper, 0);
1801
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0G1Mask => new
UInt128
(0x6000_0000_0000_0000, 0);
1807
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G0ToGwPlus1ExponentMask => new
UInt128
(0x7FFE_0000_0000_0000, 0);
1809
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.G2ToGwPlus3ExponentMask => new
UInt128
(0x1FFF_8000_0000_0000, 0);
1811
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus2ToGwPlus4SignificandMask => new
UInt128
(0x0001_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1813
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.GwPlus4SignificandMask => new
UInt128
(0x0000_7FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1815
static UInt128 IDecimalIeee754ParseAndFormatInfo<Decimal128, UInt128>.MaxSignificand => new
UInt128
(upper: 0x0001_ED09_BEAD_87C0, lower: 0x378D_8E63_FFFF_FFFF); // 9_999_999_999_999_999_999_999_999_999_999_999;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal32.cs (1)
466
public static explicit operator Decimal32(Decimal128 value) => new Decimal32(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal32, uint>(new
UInt128
(value._upper, value._lower)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal64.cs (1)
451
public static explicit operator Decimal64(Decimal128 value) => new Decimal64(Number.ConvertDecimalIeee754<Decimal128, UInt128, Decimal64, ulong>(new
UInt128
(value._upper, value._lower)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (2)
86
return CompareDecimal<Decimal128, UInt128>(new
UInt128
(xValue._upper, xValue._lower), new
UInt128
(yValue._upper, yValue._lower));
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (92)
496
return new
UInt128
(value.High, value.Low64);
559
UInt128 result = new
UInt128
((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
576
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
589
return new
UInt128
(0, (ushort)value);
598
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
611
return new
UInt128
(0, (uint)value);
620
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
633
return new
UInt128
(0, (ulong)value);
642
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
655
return new
UInt128
(0, (nuint)value);
665
return new
UInt128
((ulong)(lower >> 63), (ulong)lower);
679
return new
UInt128
(0, (byte)value);
700
public static implicit operator UInt128(byte value) => new
UInt128
(0, value);
705
public static implicit operator UInt128(char value) => new
UInt128
(0, value);
711
public static implicit operator UInt128(ushort value) => new
UInt128
(0, value);
717
public static implicit operator UInt128(uint value) => new
UInt128
(0, value);
723
public static implicit operator UInt128(ulong value) => new
UInt128
(0, value);
729
public static implicit operator UInt128(nuint value) => new
UInt128
(0, value);
745
return new
UInt128
(upper, lower);
758
return new
UInt128
(upper, lower);
836
UInt128 valMiLo = new
UInt128
(valMi, valLo);
846
UInt128 divisor = new
UInt128
(divHi, divLo);
847
UInt128 chkMiLo = new
UInt128
(chkMi, chkLo);
894
return (new
UInt128
(highRes, lowRes), remainder);
909
return (new
UInt128
(highRes, lowRes), remainder >> shift);
942
Debug.Assert(Math.BigMul(quo, divisor) + rem == (new
UInt128
(hi, lo)));
985
Debug.Assert(new
UInt128
(valHi, valMiLo) < new
UInt128
(chkHi, chkLo));
998
Debug.Assert(new
UInt128
(valHi, valMiLo) == new
UInt128
(chkHi, chkLo) + remainder);
1040
new
UInt128
(0, 1UL),
1041
new
UInt128
(0, 10UL),
1042
new
UInt128
(0, 100UL),
1043
new
UInt128
(0, 1_000UL),
1044
new
UInt128
(0, 10_000UL),
1045
new
UInt128
(0, 100_000UL),
1046
new
UInt128
(0, 1_000_000UL),
1047
new
UInt128
(0, 10_000_000UL),
1048
new
UInt128
(0, 100_000_000UL),
1049
new
UInt128
(0, 1_000_000_000UL),
1050
new
UInt128
(0, 10_000_000_000UL),
1051
new
UInt128
(0, 100_000_000_000UL),
1052
new
UInt128
(0, 1_000_000_000_000UL),
1053
new
UInt128
(0, 10_000_000_000_000UL),
1054
new
UInt128
(0, 100_000_000_000_000UL),
1055
new
UInt128
(0, 1_000_000_000_000_000UL),
1056
new
UInt128
(0, 10_000_000_000_000_000UL),
1057
new
UInt128
(0, 100_000_000_000_000_000UL),
1058
new
UInt128
(0, 1_000_000_000_000_000_000UL),
1059
new
UInt128
(0, 10_000_000_000_000_000_000UL),
1060
new
UInt128
(5, 7766279631452241920UL),
1061
new
UInt128
(54, 3875820019684212736UL),
1062
new
UInt128
(542, 1864712049423024128UL),
1063
new
UInt128
(5421, 200376420520689664UL),
1064
new
UInt128
(54210, 2003764205206896640UL),
1065
new
UInt128
(542101, 1590897978359414784UL),
1066
new
UInt128
(5421010, 15908979783594147840UL),
1067
new
UInt128
(54210108, 11515845246265065472UL),
1068
new
UInt128
(542101086, 4477988020393345024UL),
1069
new
UInt128
(5421010862, 7886392056514347008UL),
1070
new
UInt128
(54210108624, 5076944270305263616UL),
1071
new
UInt128
(542101086242, 13875954555633532928UL),
1072
new
UInt128
(5421010862427, 9632337040368467968UL),
1073
new
UInt128
(54210108624275, 4089650035136921600UL),
1074
new
UInt128
(542101086242752, 4003012203950112768UL),
1075
new
UInt128
(5421010862427522, 3136633892082024448UL),
1076
new
UInt128
(54210108624275221, 12919594847110692864UL),
1077
new
UInt128
(542101086242752217, 68739955140067328UL),
1078
new
UInt128
(5421010862427522170, 687399551400673280UL),
1242
static UInt128 IBinaryNumber<UInt128>.AllBitsSet => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1262
public static UInt128 operator &(UInt128 left, UInt128 right) => new
UInt128
(left._upper & right._upper, left._lower & right._lower);
1265
public static UInt128 operator |(UInt128 left, UInt128 right) => new
UInt128
(left._upper | right._upper, left._lower | right._lower);
1268
public static UInt128 operator ^(UInt128 left, UInt128 right) => new
UInt128
(left._upper ^ right._upper, left._lower ^ right._lower);
1271
public static UInt128 operator ~(UInt128 value) => new
UInt128
(~value._upper, ~value._lower);
1351
public static UInt128 MinValue => new
UInt128
(0, 0);
1354
public static UInt128 MaxValue => new
UInt128
(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1380
return new
UInt128
(upper, lower);
1419
lower = new
UInt128
(tl._lower, mull._lower);
1470
public static UInt128 One => new
UInt128
(0, 1);
1903
short actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_7FFF)) ? short.MaxValue : (short)value;
1909
int actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_7FFF_FFFF)) ? int.MaxValue : (int)value;
1915
long actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? long.MaxValue : (long)value;
1921
Int128 actualResult = (value >= new
UInt128
(0x7FFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF)) ? Int128.MaxValue : (Int128)value;
1932
nint actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x7FFF_FFFF_FFFF_FFFF)) ? nint.MaxValue : (nint)value;
1939
sbyte actualResult = (value >= new
UInt128
(0x0000_0000_0000_0000, 0x0000_0000_0000_007F)) ? sbyte.MaxValue : (sbyte)value;
2077
return new
UInt128
(upper, 0);
2087
return new
UInt128
(upper, lower);
2113
return new
UInt128
(0, lower);
2123
return new
UInt128
(upper, lower);
2155
return new
UInt128
(upper, lower);
2168
return new
UInt128
(upper, lower);
2222
static UInt128 IBinaryIntegerParseAndFormatInfo<UInt128>.MaxValueDiv10 => new
UInt128
(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
System.Runtime.Numerics (8)
System\Numerics\BigInteger.cs (8)
2330
uu = len > 1 ? new
UInt128
(value._bits[1], value._bits[0]) : (UInt128)(ulong)value._bits[0];
2334
uu = new
UInt128
(
2457
? new
UInt128
(value._bits[1], value._bits[0])
2462
return new
UInt128
(
2580
else if (x <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
2651
else if (value <= new
UInt128
(0x0000_0000_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF))
5147
UInt128 bits =
new
(upperBits, lowerBits);
5341
UInt128 bits =
new
(upperBits, lowerBits);
1350 references to UInt128
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.AspNetCore.Components.Endpoints (7)
FormMapping\Converters\NullableConverter.cs (1)
72
type == typeof(
UInt128
) ||
FormMapping\WellKnownConverters.cs (6)
35
{ typeof(
UInt128
), new ParsableConverter<
UInt128
>() },
67
converters.Add(typeof(
UInt128
?), new NullableConverter<
UInt128
>((FormDataConverter<
UInt128
>)converters[typeof(
UInt128
)]));
Microsoft.AspNetCore.Http.Extensions (7)
src\aspnetcore\src\Components\Endpoints\src\FormMapping\Converters\NullableConverter.cs (1)
72
type == typeof(
UInt128
) ||
src\aspnetcore\src\Components\Endpoints\src\FormMapping\WellKnownConverters.cs (6)
35
{ typeof(
UInt128
), new ParsableConverter<
UInt128
>() },
67
converters.Add(typeof(
UInt128
?), new NullableConverter<
UInt128
>((FormDataConverter<
UInt128
>)converters[typeof(
UInt128
)]));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiConstants.cs (1)
36
typeof(
UInt128
),
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHash128.cs (2)
124
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
209
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis (2)
Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (2)
126
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
211
public
UInt128
GetCurrentHashAsUInt128()
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
64
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1224
[JsonSerializable(typeof(
UInt128
))]
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
64
yield return new TestData<
UInt128
>(42, """{"type":"integer"}""");
1224
[JsonSerializable(typeof(
UInt128
))]
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
71
typeof(T) == typeof(
UInt128
) ||
System.ComponentModel.TypeConverter (5)
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
165
[typeof(
UInt128
)] = new IntrinsicTypeConverterData((type) => new UInt128Converter()),
System\ComponentModel\UInt128Converter.cs (4)
18
internal override Type TargetType => typeof(
UInt128
);
28
return
UInt128
.Parse(value, NumberStyles.HexNumber);
35
UInt128
.Parse(value, formatInfo);
41
((
UInt128
)value).ToString(formatInfo);
System.IO.Compression (1)
System\IO\Compression\WinZipAesStream.cs (1)
23
private
UInt128
_counter = 1;
System.IO.Hashing (2)
System\IO\Hashing\XxHash128.cs (2)
122
public static
UInt128
HashToUInt128(ReadOnlySpan<byte> source, long seed = 0)
207
public
UInt128
GetCurrentHashAsUInt128()
System.Linq (7)
System\Linq\Max.cs (2)
353
if (typeof(TSource) == typeof(
UInt128
)) return (TSource)(object)MaxIntegerEnumerator((IEnumerable<
UInt128
>)source);
System\Linq\Min.cs (2)
332
if (typeof(TSource) == typeof(
UInt128
)) return (TSource)(object)MinIntegerEnumerator((IEnumerable<
UInt128
>)source);
System\Linq\OrderBy.cs (1)
161
t == typeof(Int128) || t == typeof(
UInt128
) ||
System\Linq\Sequence.cs (2)
91
if (typeof(T) == typeof(ulong) && (range = TryUseRange<
UInt128
>(start, endInclusive, step, ulong.MaxValue)) is not null) return range;
93
if (typeof(T) == typeof(nuint) && (range = TryUseRange<
UInt128
>(start, endInclusive, step, nuint.MaxValue)) is not null) return range;
System.Net.Primitives (12)
System\Net\IPNetwork.cs (12)
93
UInt128
baseAddressValue = default;
94
UInt128
otherAddressValue = default;
96
BaseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref baseAddressValue)), out int bytesWritten);
98
address.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref otherAddressValue)), out bytesWritten);
101
UInt128
mask =
UInt128
.MaxValue << (128 - PrefixLength);
262
UInt128
value = default;
263
baseAddress.TryWriteBytes(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref value)), out int bytesWritten);
266
UInt128
mask =
UInt128
.MaxValue << (128 - prefixLength);
272
UInt128
newAddress = value & mask;
275
: new IPAddress(MemoryMarshal.AsBytes(new Span<
UInt128
>(ref newAddress)));
System.Numerics.Tensors (2)
System\Numerics\Tensors\netcore\TensorPrimitives.IsNegative.cs (1)
64
typeof(T) != typeof(
UInt128
);
System\Numerics\Tensors\TensorPrimitives.Helpers.cs (1)
77
typeof(T) == typeof(Int128) || typeof(T) == typeof(
UInt128
) ||
System.Private.CoreLib (1182)
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (10)
287
public static byte[] GetBytes(
UInt128
value)
289
byte[] bytes = new byte[
UInt128
.Size];
302
public static bool TryWriteBytes(Span<byte> destination,
UInt128
value)
304
if (destination.Length <
UInt128
.Size)
697
public static
UInt128
ToUInt128(byte[] value, int startIndex)
703
if (startIndex > value.Length -
UInt128
.Size)
706
return Unsafe.ReadUnaligned<
UInt128
>(ref value[startIndex]);
717
public static
UInt128
ToUInt128(ReadOnlySpan<byte> value)
719
if (value.Length <
UInt128
.Size)
721
return Unsafe.ReadUnaligned<
UInt128
>(ref MemoryMarshal.GetReference(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (9)
220
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as big endian.
226
/// <paramref name="source"/> is too small to contain a <see cref="
UInt128
" />.
230
public static
UInt128
ReadUInt128BigEndian(ReadOnlySpan<byte> source)
233
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
234
MemoryMarshal.Read<
UInt128
>(source);
522
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as big endian.
527
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
532
public static bool TryReadUInt128BigEndian(ReadOnlySpan<byte> source, out
UInt128
value)
536
bool success = MemoryMarshal.TryRead(source, out
UInt128
tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (9)
220
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as little endian.
226
/// <paramref name="source"/> is too small to contain a <see cref="
UInt128
" />.
230
public static
UInt128
ReadUInt128LittleEndian(ReadOnlySpan<byte> source)
233
ReverseEndianness(MemoryMarshal.Read<
UInt128
>(source)) :
234
MemoryMarshal.Read<
UInt128
>(source);
522
/// Reads a <see cref="
UInt128
" /> from the beginning of a read-only span of bytes, as little endian.
527
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
532
public static bool TryReadUInt128LittleEndian(ReadOnlySpan<byte> source, out
UInt128
value)
539
bool success = MemoryMarshal.TryRead(source, out
UInt128
tmp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (7)
181
/// Reverses a primitive value by performing an endianness swap of the specified <see cref="
UInt128
" /> value.
187
public static
UInt128
ReverseEndianness(
UInt128
value)
375
public static void ReverseEndianness(ReadOnlySpan<
UInt128
> source, Span<
UInt128
> destination) =>
376
ReverseEndianness(MemoryMarshal.Cast<
UInt128
, Int128>(source), MemoryMarshal.Cast<
UInt128
, Int128>(destination));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (8)
292
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as big endian.
298
/// <paramref name="destination" /> is too small to contain a <see cref="
UInt128
" />.
302
public static void WriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
306
UInt128
tmp = ReverseEndianness(value);
595
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as big endian.
600
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
605
public static bool TryWriteUInt128BigEndian(Span<byte> destination,
UInt128
value)
609
UInt128
tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (8)
292
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as little endian.
298
/// <paramref name="destination" /> is too small to contain a <see cref="
UInt128
" />.
302
public static void WriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
306
UInt128
tmp = ReverseEndianness(value);
595
/// Writes a <see cref="
UInt128
" /> into a span of bytes, as little endian.
600
/// <see langword="true" /> if the span is large enough to contain a <see cref="
UInt128
" />; otherwise, <see langword="false" />.
605
public static bool TryWriteUInt128LittleEndian(Span<byte> destination,
UInt128
value)
609
UInt128
tmp = ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.Int128.cs (3)
12
public static int CountDigits(
UInt128
value)
53
public static int CountHexDigits(
UInt128
value)
56
return ((int)
UInt128
.Log2(value) >> 2) + 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Byte.cs (9)
726
else if (typeof(TOther) == typeof(
UInt128
))
728
UInt128
actualValue = (
UInt128
)(object)value;
793
else if (typeof(TOther) == typeof(
UInt128
))
795
UInt128
actualValue = (
UInt128
)(object)value;
860
else if (typeof(TOther) == typeof(
UInt128
))
862
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (9)
1606
else if (typeof(TOther) == typeof(
UInt128
))
1608
UInt128
actualValue = (
UInt128
)(object)value;
1669
else if (typeof(TOther) == typeof(
UInt128
))
1671
UInt128
actualValue = (
UInt128
)(object)value;
1732
else if (typeof(TOther) == typeof(
UInt128
))
1734
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.cs (6)
1514
else if (typeof(TOther) == typeof(
UInt128
))
1516
UInt128
actualValue = (
UInt128
)(object)value;
1590
else if (typeof(TOther) == typeof(
UInt128
))
1592
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (33)
1614
UInt128
mantissa;
1627
mantissa = (
UInt128
)significand << exponent;
1641
UInt128
numerator = (
UInt128
)significand * Pow5(scale);
1644
if ((mantissa >> 96) ==
UInt128
.Zero)
1655
if (mantissa ==
UInt128
.Zero)
1749
UInt128
mantissa = new UInt128(high, low64);
1750
if (mantissa ==
UInt128
.Zero)
1753
UInt128
divisor = Pow5(scale); // 5^scale
1755
int mantissaBits = 128 - (int)
UInt128
.LeadingZeroCount(mantissa);
1756
int divisorBits = 128 - (int)
UInt128
.LeadingZeroCount(divisor);
1762
UInt128
numerator, denominator;
1774
(
UInt128
quotient,
UInt128
remainder) =
UInt128
.DivRem(numerator, denominator);
1777
int quotientBits = 128 - (int)
UInt128
.LeadingZeroCount(quotient);
1782
ulong roundBits = (ulong)(quotient & ((
UInt128
.One << drop) - 1));
1784
bool sticky = (remainder !=
UInt128
.Zero) || ((roundBits & (half - 1)) != 0);
1807
/// 5 raised to <paramref name="exponent"/> as a <see cref="
UInt128
"/>, for <c>0 <= exponent <= DEC_SCALE_MAX</c>.
1809
private static
UInt128
Pow5(int exponent)
1830
private static
UInt128
RoundShiftRightEven(
UInt128
value, int shift)
1839
if ((shift == 128) && (value > (
UInt128
.One << 127)))
1840
return
UInt128
.One;
1841
return
UInt128
.Zero;
1844
UInt128
quotient = value >> shift;
1845
UInt128
remainder = value & ((
UInt128
.One << shift) -
UInt128
.One);
1846
UInt128
half =
UInt128
.One << (shift - 1);
1848
if ((remainder > half) || ((remainder == half) && ((quotient &
UInt128
.One) !=
UInt128
.Zero)))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (6)
1362
else if (typeof(TOther) == typeof(
UInt128
))
1364
UInt128
actualResult = checked((
UInt128
)value);
1472
else if (typeof(TOther) == typeof(
UInt128
))
1474
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Half.cs (15)
960
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="
UInt128
"/>.</summary>
964
public static explicit operator
UInt128
(Half value) => (
UInt128
)(double)(value);
966
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="
UInt128
"/>, throwing an overflow exception for any values that fall outside the representable range.</summary>
969
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
971
public static explicit operator checked
UInt128
(Half value) => checked((
UInt128
)(double)(value));
2060
else if (typeof(TOther) == typeof(
UInt128
))
2062
UInt128
actualResult = checked((
UInt128
)value);
2158
else if (typeof(TOther) == typeof(
UInt128
))
2160
UInt128
actualResult = (value == PositiveInfinity) ?
UInt128
.MaxValue :
2161
(value <= Zero) ?
UInt128
.MinValue : (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (38)
217
return -(decimal)(
UInt128
)(value);
219
return (decimal)(
UInt128
)(value);
230
return -(double)(
UInt128
)(value);
232
return (double)(
UInt128
)(value);
243
return -(Half)(
UInt128
)(value);
245
return (Half)(
UInt128
)(value);
353
return -(float)(
UInt128
)(value);
355
return (float)(
UInt128
)(value);
418
/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="
UInt128
" /> value.</summary>
420
/// <returns><paramref name="value" /> converted to a <see cref="
UInt128
" />.</returns>
422
public static explicit operator
UInt128
(Int128 value) => new UInt128(value._upper, value._lower);
424
/// <summary>Explicitly converts a 128-bit signed integer to a <see cref="
UInt128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
426
/// <returns><paramref name="value" /> converted to a <see cref="
UInt128
" />.</returns>
429
public static explicit operator checked
UInt128
(Int128 value)
730
return (Int128)
UInt128
.Log10((
UInt128
)value);
1070
UInt128
result = (
UInt128
)(left) / (
UInt128
)(right);
1142
return (Int128)((
UInt128
)(left) * (
UInt128
)(right));
1180
UInt128
upper =
UInt128
.BigMul((
UInt128
)(left), (
UInt128
)(right), out
UInt128
ulower);
1746
else if (typeof(TOther) == typeof(
UInt128
))
1748
UInt128
actualResult = checked((
UInt128
)value);
1820
else if (typeof(TOther) == typeof(
UInt128
))
1822
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1890
else if (typeof(TOther) == typeof(
UInt128
))
1892
UInt128
actualResult = (
UInt128
)value;
2148
static bool IBinaryIntegerParseAndFormatInfo<Int128>.IsGreaterThanAsUnsigned(Int128 left, Int128 right) => (
UInt128
)(left) > (
UInt128
)(right);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (10)
1144
else if (typeof(TOther) == typeof(
UInt128
))
1146
UInt128
actualResult = checked((
UInt128
)value);
1213
else if (typeof(TOther) == typeof(
UInt128
))
1215
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1281
else if (typeof(TOther) == typeof(
UInt128
))
1283
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (10)
1193
else if (typeof(TOther) == typeof(
UInt128
))
1195
UInt128
actualResult = checked((
UInt128
)value);
1264
else if (typeof(TOther) == typeof(
UInt128
))
1266
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1332
else if (typeof(TOther) == typeof(
UInt128
))
1334
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (10)
1188
else if (typeof(TOther) == typeof(
UInt128
))
1190
UInt128
actualResult = checked((
UInt128
)value);
1260
else if (typeof(TOther) == typeof(
UInt128
))
1262
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1335
else if (typeof(TOther) == typeof(
UInt128
))
1337
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (10)
1208
else if (typeof(TOther) == typeof(
UInt128
))
1210
UInt128
actualResult = checked((
UInt128
)value);
1280
else if (typeof(TOther) == typeof(
UInt128
))
1282
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1348
else if (typeof(TOther) == typeof(
UInt128
))
1350
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
282
public static
UInt128
BigMul(ulong a, ulong b)
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.MinMax.cs (6)
40
if (typeof(T) == typeof(
UInt128
)) return MinMaxInteger<T,
UInt128
, MinCalc<
UInt128
>>(span);
93
if (typeof(T) == typeof(
UInt128
)) return MinMaxInteger<T,
UInt128
, MaxCalc<
UInt128
>>(span);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (1)
1352
public
UInt128
ToUInt128()
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.cs (47)
2385
UInt128
product = (
UInt128
)ulong.CreateTruncating(left) * ulong.CreateTruncating(right);
2597
UInt128
wide = ((
UInt128
)ulong.CreateTruncating(high) << 64) | ulong.CreateTruncating(low);
2720
UInt128
wide = ((
UInt128
)ulong.CreateTruncating(high) << 64) | ulong.CreateTruncating(low);
2722
UInt128
scale =
UInt128
.One;
2727
UInt128
power = scale * 10;
2729
(
UInt128
quotient,
UInt128
remainder) =
UInt128
.DivRem(wide, power);
2731
sticky |= (remainder % scale) !=
UInt128
.Zero;
3304
/// not fit in <see cref="
UInt128
"/> (and therefore in no integer type).
3306
private static DecimalIeee754ToIntegerStatus DecimalIeee754ToIntegerMagnitude<TDecimal, TValue>(TValue decimalBits, out bool isNegative, out
UInt128
magnitude, out bool exceedsUInt128)
3311
magnitude =
UInt128
.Zero;
3327
UInt128
significand =
UInt128
.CreateTruncating(decoded.Significand);
3330
if (significand ==
UInt128
.Zero)
3341
if (significand >
UInt128
.MaxValue / 10)
3349
magnitude = exceedsUInt128 ?
UInt128
.Zero : significand;
3357
for (int i = 0; (i < drop) && (significand !=
UInt128
.Zero); i++)
3379
DecimalIeee754ToIntegerStatus status = DecimalIeee754ToIntegerMagnitude<TDecimal, TValue>(decimalBits, out bool isNegative, out
UInt128
magnitude, out bool exceedsUInt128);
3382
UInt128
maxMagnitude =
UInt128
.CreateTruncating(TInteger.MaxValue);
3384
UInt128
minMagnitude = isUnsigned ?
UInt128
.Zero : maxMagnitude +
UInt128
.One;
3434
if ((magnitude !=
UInt128
.Zero) && isChecked)
3471
UInt128
bits =
UInt128
.CreateTruncating(value);
3475
UInt128
magnitude = isNegative ? (~bits) +
UInt128
.One : bits;
3480
if (magnitude <=
UInt128
.CreateTruncating(TDecimal.MaxSignificand))
3493
private static TValue DecimalIeee754FromMagnitude<TDecimal, TValue>(bool sign,
UInt128
magnitude, int exponent)
3497
if (magnitude ==
UInt128
.Zero)
3521
private static int WriteDecimalDigits(
UInt128
magnitude, Span<byte> digits)
3523
Debug.Assert(magnitude !=
UInt128
.Zero);
3529
while (magnitude !=
UInt128
.Zero)
3531
(magnitude,
UInt128
digit) =
UInt128
.DivRem(magnitude, 10);
3570
UInt128
magnitude =
UInt128
.CreateTruncating(decoded.Significand);
3637
UInt128
magnitude =
UInt128
.CreateTruncating(decoded.Significand);
3763
UInt128
magnitude =
UInt128
.CreateTruncating(decoded.Significand);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128.cs (2)
507
private static DiyFp128 Float128UnpackFinite(
UInt128
packed)
543
private static
UInt128
Float128PackFinite(DiyFp128 value)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Conversions.cs (31)
29
private static DiyFp128 DiyFp128FromUInt128(
UInt128
coefficient, uint sign)
31
Debug.Assert(coefficient !=
UInt128
.Zero);
33
int leadingZeros = (int)
UInt128
.LeadingZeroCount(coefficient);
34
UInt128
fraction = coefficient << leadingZeros; // most significant bit at bit 127
57
DiyFp128 pow = DiyFp128FromUInt128(
UInt128
.CreateTruncating(TDecimal.Power10(chunk)), 0);
85
DiyFp128 value = DiyFp128FromUInt128(
UInt128
.CreateTruncating(significand), signed ? UxSignBit : 0);
117
UInt128
pow10P =
UInt128
.CreateTruncating(TDecimal.MaxSignificand);
119
UInt128
pow10Pm1 =
UInt128
.CreateTruncating(TDecimal.Power10(precision - 1)); // 10^(P-1)
121
UInt128
coefficient;
135
if ((coefficient !=
UInt128
.Zero) && (coefficient < pow10Pm1))
153
private static
UInt128
DiyFp128RoundToUInt128(DiyFp128 value)
158
UInt128
fraction = new UInt128(value._hi, value._lo);
159
UInt128
integer = fraction >> shift;
160
UInt128
remainder = fraction & ((
UInt128
.One << shift) -
UInt128
.One);
161
UInt128
half =
UInt128
.One << (shift - 1);
163
if ((remainder > half) || ((remainder == half) &&
UInt128
.IsOddInteger(integer)))
176
private static TValue EncodeDecimalFromUInt128<TDecimal, TValue>(bool signed,
UInt128
coefficient, int exponent)
180
if (coefficient ==
UInt128
.Zero)
195
if (deficit >=
UInt128
.PowersOf10.Length)
201
UInt128
power =
UInt128
.PowersOf10[deficit];
202
UInt128
quotient = coefficient / power;
203
UInt128
remainder = coefficient - (quotient * power);
204
UInt128
half = power >> 1; // 10^deficit is even, so this is an exact half
206
if ((remainder > half) || ((remainder == half) &&
UInt128
.IsOddInteger(quotient)))
214
if (coefficient ==
UInt128
.Zero)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128DecimalReduce.cs (30)
103
private static bool DiyFp128DecimalReduceExact(
UInt128
coefficient, int unbiasedExponent)
113
UInt128
pow5 = DiyFp128Pow5(unbiasedExponent);
114
return coefficient <= (
UInt128
.MaxValue / pow5);
124
return (coefficient % DiyFp128Pow5(k)) ==
UInt128
.Zero;
127
private static
UInt128
DiyFp128Pow5(int n)
129
UInt128
result =
UInt128
.One;
143
private static int DiyFp128DecimalRadianReduce(uint sign,
UInt128
coefficient, int unbiasedExponent, int octant, out DiyFp128 reduced)
186
private static int DiyFp128ReduceBuildInteger(
UInt128
coefficient, int power, Span<ulong> integerWords)
204
UInt128
carry = 0;
207
UInt128
product = ((
UInt128
)integerWords[i] * multiplier) + carry;
233
Span<
UInt128
> columnLo = stackalloc
UInt128
[TrigReduceWords + Guard];
240
UInt128
acc = 0;
251
UInt128
next = acc + ((
UInt128
)integerWords[j] * TrigOneOverTwoPi[fi]);
271
private static void DiyFp128ReduceFractionNegative(
UInt128
coefficient, int k, Span<ulong> fractionWords)
291
UInt128
cur = ((
UInt128
)rem << 64) | moduli[i];
293
rem = (ulong)(cur - ((
UInt128
)q * divisor));
308
Span<
UInt128
> columnLo = stackalloc
UInt128
[TrigReduceWords + Guard];
313
UInt128
acc = 0;
325
UInt128
next = acc + ((
UInt128
)ca * moduli[b]);
344
private static void DiyFp128ReducePropagate(ReadOnlySpan<
UInt128
> columnLo, ReadOnlySpan<ulong> columnHi, int columns, Span<ulong> fractionWords)
346
UInt128
carry = 0;
350
UInt128
lo = columnLo[t] + carry;
360
carry = ((
UInt128
)fullHi << 64) | (lo >> 64);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128PiTrig.cs (5)
95
UInt128
significand = new UInt128(value._hi, value._lo);
97
UInt128
fractionBits = significand & ((
UInt128
.One << shift) -
UInt128
.One);
104
if (fractionBits ==
UInt128
.Zero)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Trig.cs (16)
164
UInt128
p = (
UInt128
)a * b;
171
UInt128
p = (
UInt128
)a * b + addLo;
178
UInt128
p = (
UInt128
)a * b + new UInt128(addHi, addLo);
185
UInt128
prod = (
UInt128
)a * b;
186
UInt128
addend = new UInt128(addHi, addLo);
187
UInt128
s = prod + addend;
196
UInt128
prod = (
UInt128
)a * b + new UInt128(carryIn, 0);
197
UInt128
addend = new UInt128(addHi, addLo);
198
UInt128
s = prod + addend;
502
public readonly
UInt128
Coefficient;
507
public DiyFp128TrigReduceArg(DiyFp128 value,
UInt128
coefficient, int exponent, uint sign, bool useDecimal)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.Transcendental.cs (2)
968
UInt128
coefficient =
UInt128
.CreateTruncating(decoded.Significand);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (38)
1497
? UInt128ToDecStr((
UInt128
)value, digits: -1)
1513
? UInt128ToDecStr((
UInt128
)value, digits)
1560
? TryUInt128ToDecStr((
UInt128
)value, digits: -1, destination, out charsWritten)
1574
? TryUInt128ToDecStr((
UInt128
)value, digits, destination, out charsWritten)
1613
public static string FormatUInt128(
UInt128
value, string? format, IFormatProvider? provider)
1623
static unsafe string FormatUInt128Slow(
UInt128
value, string? format, IFormatProvider? provider)
1670
public static bool TryFormatUInt128<TChar>(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1682
static unsafe bool TryFormatUInt128Slow(
UInt128
value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
2600
byte* p = UInt128ToDecChars(buffer + Int128Precision, (
UInt128
)value, 0);
2620
? UInt128ToDecStr((
UInt128
)value, -1)
2633
UInt128
absValue = (
UInt128
)(-value);
2661
UInt128
absValue = (
UInt128
)(-value);
2692
UInt128
uValue = (
UInt128
)value;
2713
UInt128
uValue = (
UInt128
)value;
2732
private static unsafe TChar* Int128ToHexChars<TChar>(TChar* buffer,
UInt128
value, int hexBase, int digits) where TChar : unmanaged, IUtfChar<TChar>
2755
UInt128
uValue = (
UInt128
)value;
2757
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2776
UInt128
uValue = (
UInt128
)value;
2778
int bufferLength = Math.Max(digits, 128 - (int)
UInt128
.LeadingZeroCount((
UInt128
)value));
2795
private static unsafe TChar* UInt128ToBinaryChars<TChar>(TChar* buffer,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2811
internal static unsafe void UInt128ToNumber(
UInt128
value, ref NumberBuffer number)
2835
private static ulong Int128DivMod1E19(ref
UInt128
value)
2837
UInt128
divisor = new UInt128(0, 10_000_000_000_000_000_000);
2838
(value,
UInt128
remainder) =
UInt128
.DivRem(value, divisor);
2843
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value) where TChar : unmanaged, IUtfChar<TChar>
2855
internal static unsafe TChar* UInt128ToDecChars<TChar>(TChar* bufferEnd,
UInt128
value, int digits) where TChar : unmanaged, IUtfChar<TChar>
2867
internal static unsafe string UInt128ToDecStr(
UInt128
value)
2886
internal static unsafe string UInt128ToDecStr(
UInt128
value, int digits)
2904
private static unsafe bool TryUInt128ToDecStr<TChar>(
UInt128
value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\BFloat16.cs (20)
642
/// <summary>Explicitly converts a <see cref="
UInt128
" /> value to its nearest representable <see cref="BFloat16"/> value.</summary>
646
public static explicit operator BFloat16(
UInt128
value) => RoundFromUnsigned(value);
786
/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="
UInt128
"/>.</summary>
790
public static explicit operator
UInt128
(BFloat16 value) => (
UInt128
)(double)(value);
792
/// <summary>Explicitly converts a <see cref="BFloat16" /> value to its nearest representable <see cref="
UInt128
"/>, throwing an overflow exception for any values that fall outside the representable range.</summary>
795
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
797
public static explicit operator checked
UInt128
(BFloat16 value) => checked((
UInt128
)(double)(value));
1658
else if (typeof(TOther) == typeof(
UInt128
))
1660
UInt128
actualValue = (
UInt128
)(object)value;
1774
else if (typeof(TOther) == typeof(
UInt128
))
1776
UInt128
actualResult = checked((
UInt128
)value);
1923
else if (typeof(TOther) == typeof(
UInt128
))
1925
UInt128
actualResult = (value == PositiveInfinity) ?
UInt128
.MaxValue :
1926
(value <= Zero) ?
UInt128
.MinValue : (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal128.cs (288)
26
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>
40
private static
UInt128
PositiveInfinityValue => new UInt128(upper: 0x7800_0000_0000_0000, lower: 0);
41
private static
UInt128
NegativeInfinityValue => new UInt128(upper: 0xF800_0000_0000_0000, lower: 0);
44
private static
UInt128
ZeroValue => new UInt128(0x3040_0000_0000_0000, 0);
45
private static
UInt128
NegativeZeroValue => new UInt128(0xB040_0000_0000_0000, 0);
47
private static
UInt128
OneValue => new UInt128(0x3040_0000_0000_0000, 1);
48
private static
UInt128
NegativeOneValue => new UInt128(0xB040_0000_0000_0000, 1);
50
private static
UInt128
EValue => new UInt128(0x2FFE_8605_8A4B_F4DE, 0x4E90_6ACC_B26A_BB56); // +2.718281828459045235360287471352662
51
private static
UInt128
PiValue => new UInt128(0x2FFE_9AE4_7957_96A7, 0xBABE_5564_E6F3_9F8F); // +3.141592653589793238462643383279503
52
private static
UInt128
TauValue => new UInt128(0x2FFF_35C8_F2AF_2D4F, 0x757C_AAC9_CDE7_3F1E); // +6.283185307179586476925286766559006
53
private static
UInt128
QuietNaNValue => new UInt128(0xFC00_0000_0000_0000, 0);
54
private static
UInt128
NaNPayloadMask => new UInt128(0x0000_3FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
85
internal Decimal128(
UInt128
value)
133
return Number.ParseDecimalIeee754<char, Decimal128,
UInt128
>(s, style, NumberFormatInfo.GetInstance(provider));
191
return Number.TryParseDecimalIeee754<char, Decimal128,
UInt128
>(s, style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK;
205
return Number.TryParseDecimalIeee754<char, Decimal128,
UInt128
>(s.AsSpan(), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK;
221
var
current = new UInt128(_upper, _lower);
222
var
another = new UInt128(other._upper, other._lower);
223
return Number.CompareDecimalIeee754<Decimal128,
UInt128
>(current, another);
229
var
current = new UInt128(_upper, _lower);
230
var
another = new UInt128(other._upper, other._lower);
231
return Number.CompareDecimalIeee754<Decimal128,
UInt128
>(current, another) == 0;
247
return Number.GetDecimalIeee754HashCode<Decimal128,
UInt128
>(new UInt128(_upper, _lower));
254
public static
UInt128
EncodeBinary(Decimal128 x) => new UInt128(x._upper, x._lower);
260
public static Decimal128 DecodeBinary(
UInt128
x) => new Decimal128(x);
266
public static
UInt128
EncodeDecimal(Decimal128 x) => Number.EncodeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower));
272
public static Decimal128 DecodeDecimal(
UInt128
x) => new Decimal128(Number.DecodeDecimalIeee754<Decimal128,
UInt128
>(x));
279
return Number.FormatDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower), null, NumberFormatInfo.CurrentInfo);
287
return Number.FormatDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower), format, NumberFormatInfo.CurrentInfo);
295
return Number.FormatDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower), null, NumberFormatInfo.GetInstance(provider));
303
return Number.FormatDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider));
309
return Number.TryFormatDecimalIeee754<Decimal128,
UInt128
, char>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten);
315
return Number.TryFormatDecimalIeee754<Decimal128,
UInt128
, byte>(new UInt128(_upper, _lower), format, NumberFormatInfo.GetInstance(provider), utf8Destination, out bytesWritten);
333
UInt128
result = Number.AddDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower), OneValue);
342
UInt128
result = Number.SubtractDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower), OneValue);
352
UInt128
result = Number.AddDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
362
UInt128
result = Number.SubtractDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
372
UInt128
result = Number.MultiplyDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
382
UInt128
result = Number.DivideDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
392
UInt128
result = Number.RemainderDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
403
public static explicit operator Decimal128(Int128 value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, Int128>(value));
405
/// <summary>Explicitly converts a <see cref="System.
UInt128
" /> value to its nearest representable <see cref="System.Numerics.Decimal128" /> value.</summary>
409
public static explicit operator Decimal128(
UInt128
value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
,
UInt128
>(value));
414
public static explicit operator Decimal128(Half value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<Half, Decimal128,
UInt128
>(value));
419
public static explicit operator Decimal128(float value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<float, Decimal128,
UInt128
>(value));
424
public static explicit operator Decimal128(double value) => new Decimal128(Number.ConvertFloatToDecimalIeee754<double, Decimal128,
UInt128
>(value));
433
public static explicit operator byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, byte>(new UInt128(value._upper, value._lower), isChecked: false);
439
public static explicit operator checked byte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, byte>(new UInt128(value._upper, value._lower), isChecked: true);
445
public static explicit operator sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, sbyte>(new UInt128(value._upper, value._lower), isChecked: false);
452
public static explicit operator checked sbyte(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, sbyte>(new UInt128(value._upper, value._lower), isChecked: true);
457
public static explicit operator char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ushort>(new UInt128(value._upper, value._lower), isChecked: false);
463
public static explicit operator checked char(Decimal128 value) => (char)Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ushort>(new UInt128(value._upper, value._lower), isChecked: true);
468
public static explicit operator short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, short>(new UInt128(value._upper, value._lower), isChecked: false);
474
public static explicit operator checked short(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, short>(new UInt128(value._upper, value._lower), isChecked: true);
480
public static explicit operator ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ushort>(new UInt128(value._upper, value._lower), isChecked: false);
487
public static explicit operator checked ushort(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ushort>(new UInt128(value._upper, value._lower), isChecked: true);
492
public static explicit operator int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, int>(new UInt128(value._upper, value._lower), isChecked: false);
498
public static explicit operator checked int(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, int>(new UInt128(value._upper, value._lower), isChecked: true);
504
public static explicit operator uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, uint>(new UInt128(value._upper, value._lower), isChecked: false);
511
public static explicit operator checked uint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, uint>(new UInt128(value._upper, value._lower), isChecked: true);
516
public static explicit operator nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, nint>(new UInt128(value._upper, value._lower), isChecked: false);
522
public static explicit operator checked nint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, nint>(new UInt128(value._upper, value._lower), isChecked: true);
528
public static explicit operator nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, nuint>(new UInt128(value._upper, value._lower), isChecked: false);
535
public static explicit operator checked nuint(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, nuint>(new UInt128(value._upper, value._lower), isChecked: true);
540
public static explicit operator long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, long>(new UInt128(value._upper, value._lower), isChecked: false);
546
public static explicit operator checked long(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, long>(new UInt128(value._upper, value._lower), isChecked: true);
552
public static explicit operator ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ulong>(new UInt128(value._upper, value._lower), isChecked: false);
559
public static explicit operator checked ulong(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, ulong>(new UInt128(value._upper, value._lower), isChecked: true);
564
public static explicit operator Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, Int128>(new UInt128(value._upper, value._lower), isChecked: false);
570
public static explicit operator checked Int128(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
, Int128>(new UInt128(value._upper, value._lower), isChecked: true);
572
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.
UInt128
" /> value.</summary>
574
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
576
public static explicit operator
UInt128
(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
,
UInt128
>(new UInt128(value._upper, value._lower), isChecked: false);
578
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal128" /> value to its nearest representable <see cref="System.
UInt128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
580
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
581
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
UInt128
" />.</exception>
583
public static explicit operator checked
UInt128
(Decimal128 value) => Number.ConvertDecimalIeee754ToInteger<Decimal128,
UInt128
,
UInt128
>(new UInt128(value._upper, value._lower), isChecked: true);
588
public static explicit operator Half(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128,
UInt128
, Half>(new UInt128(value._upper, value._lower));
593
public static explicit operator float(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128,
UInt128
, float>(new UInt128(value._upper, value._lower));
598
public static explicit operator double(Decimal128 value) => Number.ConvertDecimalIeee754ToFloat<Decimal128,
UInt128
, double>(new UInt128(value._upper, value._lower));
604
public static explicit operator decimal(Decimal128 value) => Number.ConvertDecimalIeee754ToDecimal<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
613
public static implicit operator Decimal128(byte value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, byte>(value));
619
public static implicit operator Decimal128(sbyte value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, sbyte>(value));
624
public static implicit operator Decimal128(char value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, ushort>(value));
629
public static implicit operator Decimal128(short value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, short>(value));
635
public static implicit operator Decimal128(ushort value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, ushort>(value));
640
public static implicit operator Decimal128(int value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, int>(value));
646
public static implicit operator Decimal128(uint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, uint>(value));
651
public static implicit operator Decimal128(nint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, nint>(value));
657
public static implicit operator Decimal128(nuint value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, nuint>(value));
662
public static implicit operator Decimal128(long value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, long>(value));
668
public static implicit operator Decimal128(ulong value) => new Decimal128(Number.ConvertIntegerToDecimalIeee754<Decimal128,
UInt128
, ulong>(value));
673
public static implicit operator Decimal128(decimal value) => new Decimal128(Number.ConvertDecimalToDecimalIeee754<Decimal128,
UInt128
>(value));
681
return Number.EqualsDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
699
return Number.LessThanDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
708
return Number.GreaterThanDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
717
return Number.LessThanOrEqualDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
726
return Number.GreaterThanOrEqualDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower));
737
return Number.TryParseDecimalIeee754<char, Decimal128,
UInt128
>(s.AsSpan(), style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK;
744
return Number.TryParseDecimalIeee754<char, Decimal128,
UInt128
>(s, style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK;
751
return Number.TryParseDecimalIeee754<byte, Decimal128,
UInt128
>(utf8Text, style | Number.AllowTrailingInvalidCharacters, NumberFormatInfo.GetInstance(provider), out result, out bytesConsumed) == Number.ParsingStatus.OK;
766
return Number.ParseDecimalIeee754<byte, Decimal128,
UInt128
>(utf8Text, style, NumberFormatInfo.GetInstance(provider));
773
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, [MaybeNullWhen(false)] out Decimal128 result) => Number.TryParseDecimalIeee754<byte, Decimal128,
UInt128
>(utf8Text, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK;
795
public static Decimal128 Ceiling(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToPositiveInfinity));
806
public static Decimal128 Floor(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToNegativeInfinity));
809
public static Decimal128 Round(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToEven));
812
public static Decimal128 Round(Decimal128 x, int digits) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), digits, MidpointRounding.ToEven));
815
public static Decimal128 Round(Decimal128 x, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), 0, mode));
818
public static Decimal128 Round(Decimal128 x, int digits, MidpointRounding mode) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), digits, mode));
821
public static Decimal128 Truncate(Decimal128 x) => new Decimal128(Number.RoundDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), 0, MidpointRounding.ToZero));
829
int exponent = Number.UnpackDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower)).UnbiasedExponent;
845
int IFloatingPoint<Decimal128>.GetSignificandByteCount() => Unsafe.SizeOf<
UInt128
>();
850
if (BinaryPrimitives.TryWriteInt32BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower)).UnbiasedExponent))
863
if (BinaryPrimitives.TryWriteInt32LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower)).UnbiasedExponent))
876
if (BinaryPrimitives.TryWriteUInt128BigEndian(destination, Number.UnpackDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower)).Significand))
878
bytesWritten = Unsafe.SizeOf<
UInt128
>();
889
if (BinaryPrimitives.TryWriteUInt128LittleEndian(destination, Number.UnpackDecimalIeee754<Decimal128,
UInt128
>(new UInt128(_upper, _lower)).Significand))
891
bytesWritten = Unsafe.SizeOf<
UInt128
>();
904
public static Decimal128 Acos(Decimal128 x) => new Decimal128(Number.AcosDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
907
public static Decimal128 AcosPi(Decimal128 x) => new Decimal128(Number.AcosPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
910
public static Decimal128 Acosh(Decimal128 x) => new Decimal128(Number.AcoshDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
913
public static Decimal128 Asin(Decimal128 x) => new Decimal128(Number.AsinDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
916
public static Decimal128 AsinPi(Decimal128 x) => new Decimal128(Number.AsinPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
919
public static Decimal128 Asinh(Decimal128 x) => new Decimal128(Number.AsinhDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
922
public static Decimal128 Atan(Decimal128 x) => new Decimal128(Number.AtanDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
925
public static Decimal128 Atan2(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2DecimalIeee754<Decimal128,
UInt128
>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower)));
928
public static Decimal128 Atan2Pi(Decimal128 y, Decimal128 x) => new Decimal128(Number.Atan2PiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(y._upper, y._lower), new UInt128(x._upper, x._lower)));
931
public static Decimal128 AtanPi(Decimal128 x) => new Decimal128(Number.AtanPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
934
public static Decimal128 Atanh(Decimal128 x) => new Decimal128(Number.AtanhDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
937
public static Decimal128 BitDecrement(Decimal128 x) => new Decimal128(Number.BitDecrementDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
940
public static Decimal128 BitIncrement(Decimal128 x) => new Decimal128(Number.BitIncrementDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
943
public static Decimal128 Cbrt(Decimal128 x) => new Decimal128(Number.CbrtDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
946
public static Decimal128 Cos(Decimal128 x) => new Decimal128(Number.CosDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
949
public static Decimal128 CosPi(Decimal128 x) => new Decimal128(Number.CosPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
952
public static Decimal128 Cosh(Decimal128 x) => new Decimal128(Number.CoshDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
955
public static Decimal128 Exp(Decimal128 x) => new Decimal128(Number.ExpDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
958
public static Decimal128 Exp10(Decimal128 x) => new Decimal128(Number.Exp10DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
961
public static Decimal128 Exp10M1(Decimal128 x) => new Decimal128(Number.Exp10M1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
964
public static Decimal128 Exp2(Decimal128 x) => new Decimal128(Number.Exp2DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
967
public static Decimal128 Exp2M1(Decimal128 x) => new Decimal128(Number.Exp2M1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
970
public static Decimal128 ExpM1(Decimal128 x) => new Decimal128(Number.ExpM1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
973
public static Decimal128 FusedMultiplyAdd(Decimal128 left, Decimal128 right, Decimal128 addend) => new Decimal128(Number.FusedMultiplyAddDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower), new UInt128(addend._upper, addend._lower)));
976
public static Decimal128 Hypot(Decimal128 x, Decimal128 y) => new Decimal128(Number.HypotDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
979
public static Decimal128 Ieee754Remainder(Decimal128 left, Decimal128 right) => new Decimal128(Number.Ieee754RemainderDecimalIeee754<Decimal128,
UInt128
>(new UInt128(left._upper, left._lower), new UInt128(right._upper, right._lower)));
982
public static int ILogB(Decimal128 x) => Number.ILogBDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower));
988
public static Decimal128 Log(Decimal128 x) => new Decimal128(Number.LogDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
991
public static Decimal128 Log(Decimal128 x, Decimal128 newBase) => new Decimal128(Number.LogDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(newBase._upper, newBase._lower)));
994
public static Decimal128 Log10(Decimal128 x) => new Decimal128(Number.Log10DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
997
public static Decimal128 Log10P1(Decimal128 x) => new Decimal128(Number.Log10P1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1000
public static Decimal128 Log2(Decimal128 x) => new Decimal128(Number.Log2DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1003
public static Decimal128 Log2P1(Decimal128 x) => new Decimal128(Number.Log2P1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1006
public static Decimal128 LogP1(Decimal128 x) => new Decimal128(Number.LogP1DecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1009
public static Decimal128 Pow(Decimal128 x, Decimal128 y) => new Decimal128(Number.PowDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1018
public static Decimal128 RootN(Decimal128 x, int n) => new Decimal128(Number.RootNDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), n));
1021
public static Decimal128 ScaleB(Decimal128 x, int n) => new Decimal128(Number.ScaleBDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), n));
1024
public static Decimal128 Sin(Decimal128 x) => new Decimal128(Number.SinDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1029
(
UInt128
sin,
UInt128
cos) = Number.SinCosDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower));
1036
(
UInt128
sin,
UInt128
cos) = Number.SinCosPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower));
1041
public static Decimal128 SinPi(Decimal128 x) => new Decimal128(Number.SinPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1044
public static Decimal128 Sinh(Decimal128 x) => new Decimal128(Number.SinhDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1047
public static Decimal128 Sqrt(Decimal128 x) => new Decimal128(Number.SqrtDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1050
public static Decimal128 Tan(Decimal128 x) => new Decimal128(Number.TanDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1053
public static Decimal128 TanPi(Decimal128 x) => new Decimal128(Number.TanPiDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1056
public static Decimal128 Tanh(Decimal128 x) => new Decimal128(Number.TanhDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1062
public static Decimal128 Quantize(Decimal128 x, Decimal128 y) => new Decimal128(Number.QuantizeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1067
public static Decimal128 GetQuantum(Decimal128 x) => new Decimal128(Number.QuantumDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower)));
1073
public static bool HaveSameQuantum(Decimal128 x, Decimal128 y) => Number.SameQuantumDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower));
1078
public static Decimal128 Abs(Decimal128 value) => new Decimal128(Number.AbsDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower)));
1123
public static bool IsInteger(Decimal128 value) => Number.IsIntegerDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1128
public static bool IsEvenInteger(Decimal128 value) => Number.IsEvenIntegerDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1133
public static bool IsOddInteger(Decimal128 value) => Number.IsOddIntegerDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1138
public static bool IsNormal(Decimal128 value) => Number.IsNormalDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1143
public static bool IsSubnormal(Decimal128 value) => Number.IsSubnormalDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1149
public static Decimal128 MaxMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1155
public static Decimal128 MaxMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxMagnitudeNumberDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1161
public static Decimal128 MinMagnitude(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1167
public static Decimal128 MinMagnitudeNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinMagnitudeNumberDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1210
public static Decimal128 CopySign(Decimal128 value, Decimal128 sign) => new Decimal128(Number.CopySignDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower), new UInt128(sign._upper, sign._lower)));
1216
public static Decimal128 Max(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1222
public static Decimal128 MaxNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNativeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1228
public static Decimal128 MaxNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MaxNumberDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1234
public static Decimal128 Min(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1240
public static Decimal128 MinNative(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNativeDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1246
public static Decimal128 MinNumber(Decimal128 x, Decimal128 y) => new Decimal128(Number.MinNumberDecimalIeee754<Decimal128,
UInt128
>(new UInt128(x._upper, x._lower), new UInt128(y._upper, y._lower)));
1252
public static int Sign(Decimal128 value) => Number.SignDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1258
static bool INumberBase<Decimal128>.IsCanonical(Decimal128 value) => Number.IsCanonicalDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower), nanReservedMask: new UInt128(0x01FF_C000_0000_0000, 0x0000_0000_0000_0000), nanPayloadMask: NaNPayloadMask, maxNaNPayload: new UInt128(0x0000_314D_C644_8D93, 0x38C1_5B09_FFFF_FFFF));
1267
static bool INumberBase<Decimal128>.IsZero(Decimal128 value) => Number.IsZeroDecimalIeee754<Decimal128,
UInt128
>(new UInt128(value._upper, value._lower));
1402
else if (typeof(TOther) == typeof(
UInt128
))
1404
result = (Decimal128)(
UInt128
)(object)value;
1522
else if (typeof(TOther) == typeof(
UInt128
))
1524
UInt128
actualResult = checked((
UInt128
)value);
1644
else if (typeof(TOther) == typeof(
UInt128
))
1646
result = (TOther)(object)(
UInt128
)value;
1700
private static readonly
UInt128
[] UInt128Powers10 =
1739
static string IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.ToDecStr(
UInt128
significand)
1744
static unsafe
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NumberToSignificand(ref Number.NumberBuffer number, int digits)
1757
static Decimal128 IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.Construct(
UInt128
value) => new Decimal128(value);
1759
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.ConvertToExponent(
UInt128
value) => (int)value;
1761
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.Power10(int exponent) => UInt128Powers10[exponent];
1763
static (
UInt128
Quotient,
UInt128
Remainder) IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.DivRemPow10(
UInt128
value, int exponent)
1765
UInt128
power = UInt128Powers10[exponent];
1766
return
UInt128
.DivRem(value, power);
1769
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.CountDigits(
UInt128
significand) => FormattingHelpers.CountDigits(significand);
1771
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.Precision => Precision;
1773
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.BufferLength => Number.Decimal128NumberBufferLength;
1775
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MaxExponent => MaxExponent;
1777
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MinExponent => MinExponent;
1779
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MaxAdjustedExponent => MaxExponent - Precision + 1;
1781
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MinAdjustedExponent => MinExponent - Precision + 1;
1783
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.PositiveInfinity => PositiveInfinityValue;
1785
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NegativeInfinity => NegativeInfinityValue;
1787
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.Zero => ZeroValue;
1789
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NaN => QuietNaNValue;
1791
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MostSignificantBitOfSignificandMask => new UInt128(0x0002_0000_0000_0000, 0);
1793
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NaNMask => new UInt128(NaNMaskUpper, 0);
1795
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.SNaNMask => new UInt128(SNaNMaskUpper, 0);
1797
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NaNPayloadMask => NaNPayloadMask;
1799
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.SignMask => new UInt128(SignMaskUpper, 0);
1801
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.G0G1Mask => new UInt128(0x6000_0000_0000_0000, 0);
1803
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.ExponentBias => ExponentBias;
1805
static int IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.NumberBitsSignificand => 110;
1807
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.G0ToGwPlus1ExponentMask => new UInt128(0x7FFE_0000_0000_0000, 0);
1809
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.G2ToGwPlus3ExponentMask => new UInt128(0x1FFF_8000_0000_0000, 0);
1811
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.GwPlus2ToGwPlus4SignificandMask => new UInt128(0x0001_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1813
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.GwPlus4SignificandMask => new UInt128(0x0000_7FFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1815
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.MaxSignificand => new UInt128(upper: 0x0001_ED09_BEAD_87C0, lower: 0x378D_8E63_FFFF_FFFF); // 9_999_999_999_999_999_999_999_999_999_999_999;
1817
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsNaN(
UInt128
decimalBits) => IsNaN(new Decimal128(decimalBits));
1819
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsNegative(
UInt128
decimalBits) => IsNegative(new Decimal128(decimalBits));
1821
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsFinite(
UInt128
decimalBits) => IsFinite(new Decimal128(decimalBits));
1823
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsInfinity(
UInt128
decimalBits) => IsInfinity(new Decimal128(decimalBits));
1825
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsPositiveInfinity(
UInt128
decimalBits) => IsPositiveInfinity(new Decimal128(decimalBits));
1827
static bool IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.IsNegativeInfinity(
UInt128
decimalBits) => IsNegativeInfinity(new Decimal128(decimalBits));
1829
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.EncodeExponentToG0ThroughGwPlus1(uint biasedExponent)
1831
return ((
UInt128
)biasedExponent) << 113;
1834
static
UInt128
IDecimalIeee754ParseAndFormatInfo<Decimal128,
UInt128
>.EncodeExponentToG2ThroughGwPlus3(uint biasedExponent)
1836
return ((
UInt128
)biasedExponent) << 111;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal32.cs (21)
437
/// <summary>Explicitly converts a <see cref="System.
UInt128
" /> value to its nearest representable <see cref="System.Numerics.Decimal32" /> value.</summary>
441
public static explicit operator Decimal32(
UInt128
value) => new Decimal32(Number.ConvertIntegerToDecimalIeee754<Decimal32, uint,
UInt128
>(value));
466
public static explicit operator Decimal32(Decimal128 value) => new Decimal32(Number.ConvertDecimalIeee754<Decimal128,
UInt128
, Decimal32, uint>(new UInt128(value._upper, value._lower)));
619
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.
UInt128
" /> value.</summary>
621
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
623
public static explicit operator
UInt128
(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint,
UInt128
>(value._value, isChecked: false);
625
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal32" /> value to its nearest representable <see cref="System.
UInt128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
627
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
628
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
UInt128
" />.</exception>
630
public static explicit operator checked
UInt128
(Decimal32 value) => Number.ConvertDecimalIeee754ToInteger<Decimal32, uint,
UInt128
>(value._value, isChecked: true);
696
public static implicit operator Decimal128(Decimal32 value) => new Decimal128(Number.ConvertDecimalIeee754<Decimal32, uint, Decimal128,
UInt128
>(value._value));
1425
else if (typeof(TOther) == typeof(
UInt128
))
1427
result = (Decimal32)(
UInt128
)(object)value;
1545
else if (typeof(TOther) == typeof(
UInt128
))
1547
UInt128
actualResult = checked((
UInt128
)value);
1667
else if (typeof(TOther) == typeof(
UInt128
))
1669
result = (TOther)(object)(
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Decimal64.cs (21)
427
/// <summary>Explicitly converts a <see cref="System.
UInt128
" /> value to its nearest representable <see cref="System.Numerics.Decimal64" /> value.</summary>
431
public static explicit operator Decimal64(
UInt128
value) => new Decimal64(Number.ConvertIntegerToDecimalIeee754<Decimal64, ulong,
UInt128
>(value));
451
public static explicit operator Decimal64(Decimal128 value) => new Decimal64(Number.ConvertDecimalIeee754<Decimal128,
UInt128
, Decimal64, ulong>(new UInt128(value._upper, value._lower)));
604
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.
UInt128
" /> value.</summary>
606
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
608
public static explicit operator
UInt128
(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong,
UInt128
>(value._value, isChecked: false);
610
/// <summary>Explicitly converts a <see cref="System.Numerics.Decimal64" /> value to its nearest representable <see cref="System.
UInt128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
612
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="System.
UInt128
" /> value.</returns>
613
/// <exception cref="System.OverflowException"><paramref name="value" /> is not representable by <see cref="System.
UInt128
" />.</exception>
615
public static explicit operator checked
UInt128
(Decimal64 value) => Number.ConvertDecimalIeee754ToInteger<Decimal64, ulong,
UInt128
>(value._value, isChecked: true);
687
public static implicit operator Decimal128(Decimal64 value) => new Decimal128(Number.ConvertDecimalIeee754<Decimal64, ulong, Decimal128,
UInt128
>(value._value));
1416
else if (typeof(TOther) == typeof(
UInt128
))
1418
result = (Decimal64)(
UInt128
)(object)value;
1536
else if (typeof(TOther) == typeof(
UInt128
))
1538
UInt128
actualResult = checked((
UInt128
)value);
1658
else if (typeof(TOther) == typeof(
UInt128
))
1660
result = (TOther)(object)(
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (1)
86
return CompareDecimal<Decimal128,
UInt128
>(new UInt128(xValue._upper, xValue._lower), new UInt128(yValue._upper, yValue._lower));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
322
typeof(T) == typeof(
UInt128
))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (24)
420
/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="
UInt128
" /> value.</summary>
422
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
UInt128
" /> value.</returns>
425
public static explicit operator
UInt128
(NFloat value) => (
UInt128
)(value._value);
427
/// <summary>Explicitly converts a native-sized floating-point value to its nearest representable <see cref="
UInt128
" /> value, throwing an overflow exception for any values that fall outside the representable range.</summary>
429
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="
UInt128
" /> value.</returns>
430
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
433
public static explicit operator checked
UInt128
(NFloat value) => checked((
UInt128
)(value._value));
499
return -(NFloat)(
UInt128
)(value);
501
return (NFloat)(
UInt128
)(value);
544
/// <summary>Explicitly converts <see cref="
UInt128
"/> to its nearest representable native-sized floating-point value.</summary>
549
public static explicit operator NFloat(
UInt128
value) => (NFloat)(double)(value);
1434
else if (typeof(TOther) == typeof(
UInt128
))
1436
UInt128
actualValue = (
UInt128
)(object)value;
1547
else if (typeof(TOther) == typeof(
UInt128
))
1549
UInt128
actualResult = checked((
UInt128
)value);
1688
else if (typeof(TOther) == typeof(
UInt128
))
1690
UInt128
actualResult = (value >= 340282366920938463463374607431768211455.0) ?
UInt128
.MaxValue :
1691
(value <= 0.0) ?
UInt128
.MinValue : (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SByte.cs (10)
1124
else if (typeof(TOther) == typeof(
UInt128
))
1126
UInt128
actualResult = checked((
UInt128
)value);
1192
else if (typeof(TOther) == typeof(
UInt128
))
1194
UInt128
actualResult = (value <= 0) ?
UInt128
.MinValue : (
UInt128
)value;
1260
else if (typeof(TOther) == typeof(
UInt128
))
1262
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (6)
1381
else if (typeof(TOther) == typeof(
UInt128
))
1383
UInt128
actualResult = checked((
UInt128
)value);
1491
else if (typeof(TOther) == typeof(
UInt128
))
1493
UInt128
actualResult = (
UInt128
)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
5595
(sizeof(TResult) == sizeof(
UInt128
) && *(
UInt128
*)&result == default))
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (361)
20
: IBinaryInteger<
UInt128
>,
21
IMinMaxValue<
UInt128
>,
22
IUnsignedNumber<
UInt128
>,
24
IBinaryIntegerParseAndFormatInfo<
UInt128
>
36
/// <summary>Initializes a new instance of the <see cref="
UInt128
" /> struct.</summary>
53
if (value is
UInt128
other)
68
public int CompareTo(
UInt128
value)
87
return (obj is
UInt128
other) && Equals(other);
91
public bool Equals(
UInt128
other)
131
public static
UInt128
Parse(string s) => Parse(s, NumberStyles.Integer, provider: null);
133
public static
UInt128
Parse(string s, NumberStyles style) => Parse(s, style, provider: null);
135
public static
UInt128
Parse(string s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
137
public static
UInt128
Parse(string s, NumberStyles style, IFormatProvider? provider)
143
public static
UInt128
Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
146
return Number.ParseBinaryInteger<char,
UInt128
>(s, style, NumberFormatInfo.GetInstance(provider));
149
public static bool TryParse([NotNullWhen(true)] string? s, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
151
public static bool TryParse(ReadOnlySpan<char> s, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider: null, out result);
157
public static bool TryParse(ReadOnlySpan<byte> utf8Text, out
UInt128
result) => TryParse(utf8Text, NumberStyles.Integer, provider: null, out result);
159
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
165
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
178
public static explicit operator byte(
UInt128
value) => (byte)value._lower;
183
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
184
public static explicit operator checked byte(
UInt128
value)
196
public static explicit operator char(
UInt128
value) => (char)value._lower;
201
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
202
public static explicit operator checked char(
UInt128
value)
214
public static explicit operator decimal(
UInt128
value)
232
public static explicit operator double(
UInt128
value)
282
public static explicit operator Half(
UInt128
value) => (Half)(double)(value);
287
public static explicit operator short(
UInt128
value) => (short)value._lower;
292
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
293
public static explicit operator checked short(
UInt128
value)
305
public static explicit operator int(
UInt128
value) => (int)value._lower;
310
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
311
public static explicit operator checked int(
UInt128
value)
323
public static explicit operator long(
UInt128
value) => (long)value._lower;
328
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
329
public static explicit operator checked long(
UInt128
value)
342
public static explicit operator Int128(
UInt128
value) => new Int128(value._upper, value._lower);
347
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
349
public static explicit operator checked Int128(
UInt128
value)
361
public static explicit operator nint(
UInt128
value) => (nint)value._lower;
366
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
367
public static explicit operator checked nint(
UInt128
value)
380
public static explicit operator sbyte(
UInt128
value) => (sbyte)value._lower;
385
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
387
public static explicit operator checked sbyte(
UInt128
value)
399
public static explicit operator float(
UInt128
value) => (float)(double)(value);
405
public static explicit operator ushort(
UInt128
value) => (ushort)value._lower;
410
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
412
public static explicit operator checked ushort(
UInt128
value)
425
public static explicit operator uint(
UInt128
value) => (uint)value._lower;
430
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
432
public static explicit operator checked uint(
UInt128
value)
445
public static explicit operator ulong(
UInt128
value) => value._lower;
450
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
452
public static explicit operator checked ulong(
UInt128
value)
465
public static explicit operator nuint(
UInt128
value) => (nuint)value._lower;
470
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
472
public static explicit operator checked nuint(
UInt128
value)
488
public static explicit operator
UInt128
(decimal value)
502
public static explicit operator
UInt128
(double value)
521
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
522
public static explicit operator checked
UInt128
(double value)
537
internal static
UInt128
ToUInt128(double value)
559
UInt128
result = new UInt128((bits << 12) >> 1 | 0x8000_0000_0000_0000, 0x0000_0000_0000_0000);
573
public static explicit operator
UInt128
(short value)
582
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
583
public static explicit operator checked
UInt128
(short value)
595
public static explicit operator
UInt128
(int value)
604
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
605
public static explicit operator checked
UInt128
(int value)
617
public static explicit operator
UInt128
(long value)
626
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
627
public static explicit operator checked
UInt128
(long value)
639
public static explicit operator
UInt128
(nint value)
648
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
649
public static explicit operator checked
UInt128
(nint value)
662
public static explicit operator
UInt128
(sbyte value)
671
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
673
public static explicit operator checked
UInt128
(sbyte value)
685
public static explicit operator
UInt128
(float value) => (
UInt128
)(double)(value);
690
/// <exception cref="OverflowException"><paramref name="value" /> is not representable by <see cref="
UInt128
" />.</exception>
691
public static explicit operator checked
UInt128
(float value) => checked((
UInt128
)(double)(value));
700
public static implicit operator
UInt128
(byte value) => new UInt128(0, value);
705
public static implicit operator
UInt128
(char value) => new UInt128(0, value);
711
public static implicit operator
UInt128
(ushort value) => new UInt128(0, value);
717
public static implicit operator
UInt128
(uint value) => new UInt128(0, value);
723
public static implicit operator
UInt128
(ulong value) => new UInt128(0, value);
729
public static implicit operator
UInt128
(nuint value) => new UInt128(0, value);
736
public static
UInt128
operator +(
UInt128
left,
UInt128
right)
749
public static
UInt128
operator checked +(
UInt128
left,
UInt128
right)
766
static
UInt128
IAdditiveIdentity<
UInt128
,
UInt128
>.AdditiveIdentity => default;
773
public static (
UInt128
Quotient,
UInt128
Remainder) DivRem(
UInt128
left,
UInt128
right)
789
static (ulong Quotient,
UInt128
Remainder) DivideSlow(
UInt128
left,
UInt128
right)
836
UInt128
valMiLo = new UInt128(valMi, valLo);
846
UInt128
divisor = new UInt128(divHi, divLo);
847
UInt128
chkMiLo = new UInt128(chkMi, chkLo);
860
UInt128
rem = valMiLo - chkMiLo;
866
static (
UInt128
Quotient, ulong Remainder) Divide128BitsBy64Bits(
UInt128
left, ulong divisor)
1005
public static
UInt128
LeadingZeroCount(
UInt128
value)
1010
private static int LeadingZeroCountAsInt32(
UInt128
value)
1020
public static
UInt128
Log10(
UInt128
value)
1036
internal static ReadOnlySpan<
UInt128
> PowersOf10 => s_powersOf10;
1038
private static readonly
UInt128
[] s_powersOf10 =
1082
public static
UInt128
PopCount(
UInt128
value)
1086
public static
UInt128
RotateLeft(
UInt128
value, int rotateAmount)
1090
public static
UInt128
RotateRight(
UInt128
value, int rotateAmount)
1094
public static
UInt128
TrailingZeroCount(
UInt128
value)
1104
static bool IBinaryInteger<
UInt128
>.TryReadBigEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
1106
UInt128
result = default;
1152
static bool IBinaryInteger<
UInt128
>.TryReadLittleEndian(ReadOnlySpan<byte> source, bool isUnsigned, out
UInt128
value)
1154
UInt128
result = default;
1191
UInt128
part = source[i];
1203
int IBinaryInteger<
UInt128
>.GetShortestBitLength()
1209
int IBinaryInteger<
UInt128
>.GetByteCount() => Size;
1212
bool IBinaryInteger<
UInt128
>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
1225
bool IBinaryInteger<
UInt128
>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
1242
static
UInt128
IBinaryNumber<
UInt128
>.AllBitsSet => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1245
public static bool IsPow2(
UInt128
value) => PopCount(value) == 1U;
1248
public static
UInt128
Log2(
UInt128
value)
1262
public static
UInt128
operator &(
UInt128
left,
UInt128
right) => new UInt128(left._upper & right._upper, left._lower & right._lower);
1265
public static
UInt128
operator |(
UInt128
left,
UInt128
right) => new UInt128(left._upper | right._upper, left._lower | right._lower);
1268
public static
UInt128
operator ^(
UInt128
left,
UInt128
right) => new UInt128(left._upper ^ right._upper, left._lower ^ right._lower);
1271
public static
UInt128
operator ~(
UInt128
value) => new UInt128(~value._upper, ~value._lower);
1278
public static bool operator <(
UInt128
left,
UInt128
right)
1285
public static bool operator <=(
UInt128
left,
UInt128
right)
1292
public static bool operator >(
UInt128
left,
UInt128
right)
1299
public static bool operator >=(
UInt128
left,
UInt128
right)
1310
public static
UInt128
operator --(
UInt128
value) => value - One;
1313
public static
UInt128
operator checked --(
UInt128
value) => checked(value - One);
1320
public static
UInt128
operator /(
UInt128
left,
UInt128
right)
1324
public static
UInt128
operator checked /(
UInt128
left,
UInt128
right) => left / right;
1331
public static bool operator ==(
UInt128
left,
UInt128
right) => (left._lower == right._lower) && (left._upper == right._upper);
1334
public static bool operator !=(
UInt128
left,
UInt128
right) => (left._lower != right._lower) || (left._upper != right._upper);
1341
public static
UInt128
operator ++(
UInt128
value) => value + One;
1344
public static
UInt128
operator checked ++(
UInt128
value) => checked(value + One);
1351
public static
UInt128
MinValue => new UInt128(0, 0);
1354
public static
UInt128
MaxValue => new UInt128(0xFFFF_FFFF_FFFF_FFFF, 0xFFFF_FFFF_FFFF_FFFF);
1361
public static
UInt128
operator %(
UInt128
left,
UInt128
right)
1369
static
UInt128
IMultiplicativeIdentity<
UInt128
,
UInt128
>.MultiplicativeIdentity => One;
1376
public static
UInt128
operator *(
UInt128
left,
UInt128
right)
1384
public static
UInt128
operator checked *(
UInt128
left,
UInt128
right)
1386
UInt128
upper = BigMul(left, right, out
UInt128
lower);
1401
public static
UInt128
BigMul(
UInt128
left,
UInt128
right, out
UInt128
lower)
1415
UInt128
mull = Math.BigMul(al, bl);
1416
UInt128
t = Math.BigMul(ah, bl) + mull._upper;
1417
UInt128
tl = Math.BigMul(al, bh) + t._lower;
1428
public static
UInt128
Clamp(
UInt128
value,
UInt128
min,
UInt128
max)
1448
static
UInt128
INumber<
UInt128
>.CopySign(
UInt128
value,
UInt128
sign) => value;
1451
public static
UInt128
Max(
UInt128
x,
UInt128
y) => (x >= y) ? x : y;
1454
static
UInt128
INumber<
UInt128
>.MaxNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1457
public static
UInt128
Min(
UInt128
x,
UInt128
y) => (x <= y) ? x : y;
1460
static
UInt128
INumber<
UInt128
>.MinNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1463
public static int Sign(
UInt128
value) => (value == 0U) ? 0 : 1;
1470
public static
UInt128
One => new UInt128(0, 1);
1473
static int INumberBase<
UInt128
>.Radix => 2;
1476
public static
UInt128
Zero => default;
1479
static
UInt128
INumberBase<
UInt128
>.Abs(
UInt128
value) => value;
1483
public static
UInt128
CreateChecked<TOther>(TOther value)
1486
UInt128
result;
1488
if (typeof(TOther) == typeof(
UInt128
))
1490
result = (
UInt128
)(object)value;
1502
public static
UInt128
CreateSaturating<TOther>(TOther value)
1505
UInt128
result;
1507
if (typeof(TOther) == typeof(
UInt128
))
1509
result = (
UInt128
)(object)value;
1521
public static
UInt128
CreateTruncating<TOther>(TOther value)
1524
UInt128
result;
1526
if (typeof(TOther) == typeof(
UInt128
))
1528
result = (
UInt128
)(object)value;
1539
static bool INumberBase<
UInt128
>.IsCanonical(
UInt128
value) => true;
1542
static bool INumberBase<
UInt128
>.IsComplexNumber(
UInt128
value) => false;
1545
public static bool IsEvenInteger(
UInt128
value) => (value._lower & 1) == 0;
1548
static bool INumberBase<
UInt128
>.IsFinite(
UInt128
value) => true;
1551
static bool INumberBase<
UInt128
>.IsImaginaryNumber(
UInt128
value) => false;
1554
static bool INumberBase<
UInt128
>.IsInfinity(
UInt128
value) => false;
1557
static bool INumberBase<
UInt128
>.IsInteger(
UInt128
value) => true;
1560
static bool INumberBase<
UInt128
>.IsNaN(
UInt128
value) => false;
1563
static bool INumberBase<
UInt128
>.IsNegative(
UInt128
value) => false;
1566
static bool INumberBase<
UInt128
>.IsNegativeInfinity(
UInt128
value) => false;
1569
static bool INumberBase<
UInt128
>.IsNormal(
UInt128
value) => value != 0U;
1572
public static bool IsOddInteger(
UInt128
value) => (value._lower & 1) != 0;
1575
static bool INumberBase<
UInt128
>.IsPositive(
UInt128
value) => true;
1578
static bool INumberBase<
UInt128
>.IsPositiveInfinity(
UInt128
value) => false;
1581
static bool INumberBase<
UInt128
>.IsRealNumber(
UInt128
value) => true;
1584
static bool INumberBase<
UInt128
>.IsSubnormal(
UInt128
value) => false;
1587
static bool INumberBase<
UInt128
>.IsZero(
UInt128
value) => (value == 0U);
1590
static
UInt128
INumberBase<
UInt128
>.MaxMagnitude(
UInt128
x,
UInt128
y) => Max(x, y);
1593
static
UInt128
INumberBase<
UInt128
>.MaxMagnitudeNumber(
UInt128
x,
UInt128
y) => Max(x, y);
1596
static
UInt128
INumberBase<
UInt128
>.MinMagnitude(
UInt128
x,
UInt128
y) => Min(x, y);
1599
static
UInt128
INumberBase<
UInt128
>.MinMagnitudeNumber(
UInt128
x,
UInt128
y) => Min(x, y);
1602
static
UInt128
INumberBase<
UInt128
>.MultiplyAddEstimate(
UInt128
left,
UInt128
right,
UInt128
addend) => (left * right) + addend;
1606
static bool INumberBase<
UInt128
>.TryConvertFromChecked<TOther>(TOther value, out
UInt128
result) => TryConvertFromChecked(value, out result);
1609
private static bool TryConvertFromChecked<TOther>(TOther value, out
UInt128
result)
1636
result = checked((
UInt128
)actualValue);
1672
static bool INumberBase<
UInt128
>.TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result) => TryConvertFromSaturating(value, out result);
1675
private static bool TryConvertFromSaturating<TOther>(TOther value, out
UInt128
result)
1702
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1738
static bool INumberBase<
UInt128
>.TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result) => TryConvertFromTruncating(value, out result);
1741
private static bool TryConvertFromTruncating<TOther>(TOther value, out
UInt128
result)
1768
result = (actualValue < 0) ? MinValue : (
UInt128
)actualValue;
1804
static bool INumberBase<
UInt128
>.TryConvertToChecked<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1878
static bool INumberBase<
UInt128
>.TryConvertToSaturating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
1958
static bool INumberBase<
UInt128
>.TryConvertToTruncating<TOther>(
UInt128
value, [MaybeNullWhen(false)] out TOther result)
2031
public static bool TryParsePartial([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out
UInt128
result, out int charsConsumed)
2038
public static bool TryParsePartial(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out
UInt128
result, out int charsConsumed)
2045
public static bool TryParsePartial(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
UInt128
result, out int bytesConsumed)
2056
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2063
public static
UInt128
operator <<(
UInt128
value, int shiftAmount)
2096
public static
UInt128
operator >>(
UInt128
value, int shiftAmount) => value >>> shiftAmount;
2099
public static
UInt128
operator >>>(
UInt128
value, int shiftAmount)
2136
public static
UInt128
Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s, NumberStyles.Integer, provider);
2139
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out
UInt128
result) => TryParse(s, NumberStyles.Integer, provider, out result);
2146
public static
UInt128
operator -(
UInt128
left,
UInt128
right)
2159
public static
UInt128
operator checked -(
UInt128
left,
UInt128
right)
2176
public static
UInt128
operator -(
UInt128
value) => Zero - value;
2179
public static
UInt128
operator checked -(
UInt128
value) => checked(Zero - value);
2186
public static
UInt128
operator +(
UInt128
value) => value;
2193
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style = NumberStyles.Integer, IFormatProvider? provider = null)
2196
return Number.ParseBinaryInteger<byte,
UInt128
>(utf8Text, style, NumberFormatInfo.GetInstance(provider));
2200
public static bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider? provider, out
UInt128
result)
2207
public static
UInt128
Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider) => Parse(utf8Text, NumberStyles.Integer, provider);
2210
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out
UInt128
result) => TryParse(utf8Text, NumberStyles.Integer, provider, out result);
2216
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsSigned => false;
2218
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxDigitCount => 39; // 340_282_366_920_938_463_463_374_607_431_768_211_455
2220
static int IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxHexDigitCount => 32; // 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
2222
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MaxValueDiv10 => new UInt128(0x1999_9999_9999_9999, 0x9999_9999_9999_9999);
2224
static string IBinaryIntegerParseAndFormatInfo<
UInt128
>.OverflowMessage => SR.Overflow_UInt128;
2226
static bool IBinaryIntegerParseAndFormatInfo<
UInt128
>.IsGreaterThanAsUnsigned(
UInt128
left,
UInt128
right) => left > right;
2228
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy10(
UInt128
value) => value * 10;
2230
static
UInt128
IBinaryIntegerParseAndFormatInfo<
UInt128
>.MultiplyBy16(
UInt128
value) => value * 16;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt16.cs (9)
731
else if (typeof(TOther) == typeof(
UInt128
))
733
UInt128
actualValue = (
UInt128
)(object)value;
798
else if (typeof(TOther) == typeof(
UInt128
))
800
UInt128
actualValue = (
UInt128
)(object)value;
865
else if (typeof(TOther) == typeof(
UInt128
))
867
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (9)
796
else if (typeof(TOther) == typeof(
UInt128
))
798
UInt128
actualValue = (
UInt128
)(object)value;
863
else if (typeof(TOther) == typeof(
UInt128
))
865
UInt128
actualValue = (
UInt128
)(object)value;
930
else if (typeof(TOther) == typeof(
UInt128
))
932
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (10)
51
public static
UInt128
BigMul(ulong left, ulong right) => Math.BigMul(left, right);
803
else if (typeof(TOther) == typeof(
UInt128
))
805
UInt128
actualValue = (
UInt128
)(object)value;
870
else if (typeof(TOther) == typeof(
UInt128
))
872
UInt128
actualValue = (
UInt128
)(object)value;
937
else if (typeof(TOther) == typeof(
UInt128
))
939
UInt128
actualValue = (
UInt128
)(object)value;
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (10)
186
UInt128
result = ulong.BigMul(left, right);
804
else if (typeof(TOther) == typeof(
UInt128
))
806
UInt128
actualValue = (
UInt128
)(object)value;
871
else if (typeof(TOther) == typeof(
UInt128
))
873
UInt128
actualValue = (
UInt128
)(object)value;
938
else if (typeof(TOther) == typeof(
UInt128
))
940
UInt128
actualValue = (
UInt128
)(object)value;
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
889
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
UInt128
))]
System.Runtime.Numerics (93)
System\Number.BigInteger.cs (4)
596
UInt128
p = (
UInt128
)bits[i] * multiplier + carry;
1541
UInt128
p = (
UInt128
)multiplier * bits2[i] + carry;
System\Numerics\BigInteger.cs (37)
2326
UInt128
uu;
2330
uu = len > 1 ? new UInt128(value._bits[1], value._bits[0]) : (
UInt128
)(ulong)value._bits[0];
2342
? (
UInt128
)((ulong)(uint)value._bits[1] << 32 | (uint)value._bits[0])
2343
: (
UInt128
)(uint)value._bits[0];
2435
/// <summary>Explicitly converts a big integer to a <see cref="
UInt128
" /> value.</summary>
2437
/// <returns><paramref name="value" /> converted to <see cref="
UInt128
" /> value.</returns>
2439
public static explicit operator
UInt128
(BigInteger value)
2443
return checked((
UInt128
)value._sign);
2458
: (
UInt128
)(ulong)value._bits[0];
2551
UInt128
x;
2554
x = (
UInt128
)(-value);
2559
x = (
UInt128
)value;
2616
/// <summary>Implicitly converts a <see cref="
UInt128
" /> value to a big integer.</summary>
2620
public static implicit operator BigInteger(
UInt128
value)
4371
else if (typeof(TOther) == typeof(
UInt128
))
4373
UInt128
actualValue = (
UInt128
)(object)value;
4494
else if (typeof(TOther) == typeof(
UInt128
))
4496
UInt128
actualValue = (
UInt128
)(object)value;
4617
else if (typeof(TOther) == typeof(
UInt128
))
4619
UInt128
actualValue = (
UInt128
)(object)value;
4742
else if (typeof(TOther) == typeof(
UInt128
))
4744
UInt128
actualResult = checked((
UInt128
)value);
4939
else if (typeof(TOther) == typeof(
UInt128
))
4941
UInt128
actualResult = (value >=
UInt128
.MaxValue) ?
UInt128
.MaxValue :
4942
IsNegative(value) ?
UInt128
.MinValue : (
UInt128
)value;
5147
UInt128
bits = new(upperBits, lowerBits);
5301
else if (typeof(TOther) == typeof(
UInt128
))
5303
UInt128
actualResult;
5341
UInt128
bits = new(upperBits, lowerBits);
5352
actualResult = (
UInt128
)(Int128)(long)value._sign;
System\Numerics\BigIntegerCalculator.PowMod.cs (10)
190
UInt128
prod = (
UInt128
)(ulong)result * (ulong)value;
195
UInt128
sq = (
UInt128
)(ulong)value * (ulong)value;
234
UInt128
prod = (
UInt128
)(ulong)result * (ulong)value;
240
UInt128
sq = (
UInt128
)(ulong)value * (ulong)value;
692
UInt128
p = (
UInt128
)m * modulus[j] + value[i + j] + carry;
System\Numerics\BigIntegerCalculator.SquMul.cs (7)
164
UInt128
carry = 0;
168
UInt128
digit1 = (
UInt128
)(ulong)bits[i + j] + carry;
169
UInt128
digit2 = (
UInt128
)(ulong)value[j] * (ulong)v;
177
UInt128
digits = (
UInt128
)(ulong)v * (ulong)v + carry;
System\Numerics\BigIntegerCalculator.Utils.cs (33)
198
UInt128
value = ((
UInt128
)(ulong)hi << 64) | (ulong)lo;
199
UInt128
digit = value / (ulong)divisor;
230
UInt128
p0 = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)carry;
233
UInt128
p1 = (
UInt128
)(ulong)left[i + 1] * (ulong)multiplier + (ulong)(p0 >> 64);
236
UInt128
p2 = (
UInt128
)(ulong)left[i + 2] * (ulong)multiplier + (ulong)(p1 >> 64);
239
UInt128
p3 = (
UInt128
)(ulong)left[i + 3] * (ulong)multiplier + (ulong)(p2 >> 64);
247
UInt128
product = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)carry;
284
UInt128
p0 = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry;
287
UInt128
p1 = (
UInt128
)(ulong)left[i + 1] * (ulong)multiplier + (ulong)result[i + 1] + (ulong)(p0 >> 64);
290
UInt128
p2 = (
UInt128
)(ulong)left[i + 2] * (ulong)multiplier + (ulong)result[i + 2] + (ulong)(p1 >> 64);
293
UInt128
p3 = (
UInt128
)(ulong)left[i + 3] * (ulong)multiplier + (ulong)result[i + 3] + (ulong)(p2 >> 64);
301
UInt128
product = (
UInt128
)(ulong)left[i] * (ulong)multiplier + (ulong)result[i] + (ulong)carry;
336
UInt128
prod0 = (
UInt128
)(ulong)right[i] * (ulong)multiplier + (ulong)carry;
343
UInt128
prod1 = (
UInt128
)(ulong)right[i + 1] * (ulong)multiplier + (ulong)hi0;
350
UInt128
prod2 = (
UInt128
)(ulong)right[i + 2] * (ulong)multiplier + (ulong)hi1;
357
UInt128
prod3 = (
UInt128
)(ulong)right[i + 3] * (ulong)multiplier + (ulong)hi2;
369
UInt128
product = (
UInt128
)(ulong)right[i] * (ulong)multiplier + (ulong)carry;
System\Numerics\Complex.cs (2)
373
/// <summary>Explicitly converts a <see cref="
UInt128
" /> value to a double-precision complex number.</summary>
377
public static explicit operator Complex(
UInt128
value)
System.Text.Json (17)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
102
if (type == typeof(Half) || type == typeof(
UInt128
) || type == typeof(Int128))
System\Text\Json\Serialization\Converters\Value\UInt128Converter.cs (12)
12
internal sealed class UInt128Converter : JsonPrimitiveConverter<
UInt128
>
21
public override
UInt128
Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
36
public override void Write(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options)
47
private static unsafe
UInt128
ReadCore(ref Utf8JsonReader reader)
57
if (!
UInt128
.TryParse(buffer.Slice(0, written), CultureInfo.InvariantCulture, out
UInt128
result))
70
private static unsafe void WriteCore(Utf8JsonWriter writer,
UInt128
value)
77
internal override
UInt128
ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
83
internal override unsafe void WriteAsPropertyNameCore(Utf8JsonWriter writer,
UInt128
value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
90
internal override
UInt128
ReadNumberWithCustomHandling(ref Utf8JsonReader reader, JsonNumberHandling handling, JsonSerializerOptions options)
106
internal override unsafe void WriteNumberWithCustomHandling(Utf8JsonWriter writer,
UInt128
value, JsonNumberHandling handling)
133
UInt128
value, out int written)
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (3)
124
/// Returns a <see cref="JsonConverter{T}"/> instance that converts <see cref="
UInt128
"/> values.
128
public static JsonConverter<
UInt128
> UInt128Converter => s_uint128Converter ??= new UInt128Converter();
129
private static JsonConverter<
UInt128
>? s_uint128Converter;
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (1)
726
potentialNumberType == typeof(
UInt128
) ||