BigInteger Struktura
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem.
public value class BigInteger : IComparable, IComparable<System::Numerics::BigInteger>, IEquatable<System::Numerics::BigInteger>, IFormattable
public value class BigInteger : IComparable<System::Numerics::BigInteger>, IEquatable<System::Numerics::BigInteger>, IParsable<System::Numerics::BigInteger>, ISpanParsable<System::Numerics::BigInteger>, IUtf8SpanParsable<System::Numerics::BigInteger>, System::Numerics::IAdditionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IAdditiveIdentity<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IBinaryInteger<System::Numerics::BigInteger>, System::Numerics::IBinaryNumber<System::Numerics::BigInteger>, System::Numerics::IBitwiseOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IComparisonOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, bool>, System::Numerics::IDecrementOperators<System::Numerics::BigInteger>, System::Numerics::IDivisionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IEqualityOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, bool>, System::Numerics::IIncrementOperators<System::Numerics::BigInteger>, System::Numerics::IModulusOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IMultiplicativeIdentity<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IMultiplyOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::INumber<System::Numerics::BigInteger>, System::Numerics::INumberBase<System::Numerics::BigInteger>, System::Numerics::IShiftOperators<System::Numerics::BigInteger, int, System::Numerics::BigInteger>, System::Numerics::ISignedNumber<System::Numerics::BigInteger>, System::Numerics::ISubtractionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IUnaryNegationOperators<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IUnaryPlusOperators<System::Numerics::BigInteger, System::Numerics::BigInteger>
public value class BigInteger : IComparable, IComparable<System::Numerics::BigInteger>, IEquatable<System::Numerics::BigInteger>, ISpanFormattable
public value class BigInteger : IComparable<System::Numerics::BigInteger>, IEquatable<System::Numerics::BigInteger>, IParsable<System::Numerics::BigInteger>, ISpanParsable<System::Numerics::BigInteger>, System::Numerics::IAdditionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IAdditiveIdentity<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IBinaryInteger<System::Numerics::BigInteger>, System::Numerics::IBinaryNumber<System::Numerics::BigInteger>, System::Numerics::IBitwiseOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IComparisonOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, bool>, System::Numerics::IDecrementOperators<System::Numerics::BigInteger>, System::Numerics::IDivisionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IEqualityOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, bool>, System::Numerics::IIncrementOperators<System::Numerics::BigInteger>, System::Numerics::IModulusOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IMultiplicativeIdentity<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IMultiplyOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::INumber<System::Numerics::BigInteger>, System::Numerics::INumberBase<System::Numerics::BigInteger>, System::Numerics::IShiftOperators<System::Numerics::BigInteger, int, System::Numerics::BigInteger>, System::Numerics::ISignedNumber<System::Numerics::BigInteger>, System::Numerics::ISubtractionOperators<System::Numerics::BigInteger, System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IUnaryNegationOperators<System::Numerics::BigInteger, System::Numerics::BigInteger>, System::Numerics::IUnaryPlusOperators<System::Numerics::BigInteger, System::Numerics::BigInteger>
public struct BigInteger : IComparable, IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IFormattable
public readonly struct BigInteger : IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IParsable<System.Numerics.BigInteger>, ISpanParsable<System.Numerics.BigInteger>, IUtf8SpanParsable<System.Numerics.BigInteger>, System.Numerics.IAdditionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IAdditiveIdentity<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IBinaryInteger<System.Numerics.BigInteger>, System.Numerics.IBinaryNumber<System.Numerics.BigInteger>, System.Numerics.IBitwiseOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IComparisonOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,bool>, System.Numerics.IDecrementOperators<System.Numerics.BigInteger>, System.Numerics.IDivisionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IEqualityOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,bool>, System.Numerics.IIncrementOperators<System.Numerics.BigInteger>, System.Numerics.IModulusOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IMultiplicativeIdentity<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IMultiplyOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.INumber<System.Numerics.BigInteger>, System.Numerics.INumberBase<System.Numerics.BigInteger>, System.Numerics.IShiftOperators<System.Numerics.BigInteger,int,System.Numerics.BigInteger>, System.Numerics.ISignedNumber<System.Numerics.BigInteger>, System.Numerics.ISubtractionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IUnaryNegationOperators<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IUnaryPlusOperators<System.Numerics.BigInteger,System.Numerics.BigInteger>
public readonly struct BigInteger : IComparable, IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IFormattable
public readonly struct BigInteger : IComparable, IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, ISpanFormattable
public readonly struct BigInteger : IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IParsable<System.Numerics.BigInteger>, ISpanParsable<System.Numerics.BigInteger>, System.Numerics.IAdditionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IAdditiveIdentity<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IBinaryInteger<System.Numerics.BigInteger>, System.Numerics.IBinaryNumber<System.Numerics.BigInteger>, System.Numerics.IBitwiseOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IComparisonOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,bool>, System.Numerics.IDecrementOperators<System.Numerics.BigInteger>, System.Numerics.IDivisionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IEqualityOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,bool>, System.Numerics.IIncrementOperators<System.Numerics.BigInteger>, System.Numerics.IModulusOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IMultiplicativeIdentity<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IMultiplyOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.INumber<System.Numerics.BigInteger>, System.Numerics.INumberBase<System.Numerics.BigInteger>, System.Numerics.IShiftOperators<System.Numerics.BigInteger,int,System.Numerics.BigInteger>, System.Numerics.ISignedNumber<System.Numerics.BigInteger>, System.Numerics.ISubtractionOperators<System.Numerics.BigInteger,System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IUnaryNegationOperators<System.Numerics.BigInteger,System.Numerics.BigInteger>, System.Numerics.IUnaryPlusOperators<System.Numerics.BigInteger,System.Numerics.BigInteger>
[System.Serializable]
public struct BigInteger : IComparable, IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IFormattable
type BigInteger = struct
interface IFormattable
type BigInteger = struct
interface IFormattable
interface IParsable<BigInteger>
interface ISpanFormattable
interface ISpanParsable<BigInteger>
interface IAdditionOperators<BigInteger, BigInteger, BigInteger>
interface IAdditiveIdentity<BigInteger, BigInteger>
interface IBinaryInteger<BigInteger>
interface IBinaryNumber<BigInteger>
interface IBitwiseOperators<BigInteger, BigInteger, BigInteger>
interface IComparisonOperators<BigInteger, BigInteger, bool>
interface IEqualityOperators<BigInteger, BigInteger, bool>
interface IDecrementOperators<BigInteger>
interface IDivisionOperators<BigInteger, BigInteger, BigInteger>
interface IIncrementOperators<BigInteger>
interface IModulusOperators<BigInteger, BigInteger, BigInteger>
interface IMultiplicativeIdentity<BigInteger, BigInteger>
interface IMultiplyOperators<BigInteger, BigInteger, BigInteger>
interface INumber<BigInteger>
interface INumberBase<BigInteger>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<BigInteger>
interface ISubtractionOperators<BigInteger, BigInteger, BigInteger>
interface IUnaryNegationOperators<BigInteger, BigInteger>
interface IUnaryPlusOperators<BigInteger, BigInteger>
interface IShiftOperators<BigInteger, int, BigInteger>
interface ISignedNumber<BigInteger>
type BigInteger = struct
interface IFormattable
interface IParsable<BigInteger>
interface ISpanFormattable
interface ISpanParsable<BigInteger>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<BigInteger>
interface IAdditionOperators<BigInteger, BigInteger, BigInteger>
interface IAdditiveIdentity<BigInteger, BigInteger>
interface IBinaryInteger<BigInteger>
interface IBinaryNumber<BigInteger>
interface IBitwiseOperators<BigInteger, BigInteger, BigInteger>
interface IComparisonOperators<BigInteger, BigInteger, bool>
interface IEqualityOperators<BigInteger, BigInteger, bool>
interface IDecrementOperators<BigInteger>
interface IDivisionOperators<BigInteger, BigInteger, BigInteger>
interface IIncrementOperators<BigInteger>
interface IModulusOperators<BigInteger, BigInteger, BigInteger>
interface IMultiplicativeIdentity<BigInteger, BigInteger>
interface IMultiplyOperators<BigInteger, BigInteger, BigInteger>
interface INumber<BigInteger>
interface INumberBase<BigInteger>
interface ISubtractionOperators<BigInteger, BigInteger, BigInteger>
interface IUnaryNegationOperators<BigInteger, BigInteger>
interface IUnaryPlusOperators<BigInteger, BigInteger>
interface IShiftOperators<BigInteger, int, BigInteger>
interface ISignedNumber<BigInteger>
type BigInteger = struct
interface ISpanFormattable
interface IFormattable
type BigInteger = struct
interface IFormattable
interface IParsable<BigInteger>
interface ISpanFormattable
interface ISpanParsable<BigInteger>
interface IAdditionOperators<BigInteger, BigInteger, BigInteger>
interface IAdditiveIdentity<BigInteger, BigInteger>
interface IBinaryInteger<BigInteger>
interface IBinaryNumber<BigInteger>
interface IBitwiseOperators<BigInteger, BigInteger, BigInteger>
interface IComparisonOperators<BigInteger, BigInteger, bool>
interface IEqualityOperators<BigInteger, BigInteger, bool>
interface IDecrementOperators<BigInteger>
interface IDivisionOperators<BigInteger, BigInteger, BigInteger>
interface IIncrementOperators<BigInteger>
interface IModulusOperators<BigInteger, BigInteger, BigInteger>
interface IMultiplicativeIdentity<BigInteger, BigInteger>
interface IMultiplyOperators<BigInteger, BigInteger, BigInteger>
interface INumber<BigInteger>
interface INumberBase<BigInteger>
interface ISubtractionOperators<BigInteger, BigInteger, BigInteger>
interface IUnaryNegationOperators<BigInteger, BigInteger>
interface IUnaryPlusOperators<BigInteger, BigInteger>
interface IShiftOperators<BigInteger, int, BigInteger>
interface ISignedNumber<BigInteger>
type BigInteger = struct
interface IFormattable
interface IParsable<BigInteger>
interface ISpanFormattable
interface ISpanParsable<BigInteger>
interface IAdditionOperators<BigInteger, BigInteger, BigInteger>
interface IAdditiveIdentity<BigInteger, BigInteger>
interface IBinaryInteger<BigInteger>
interface IBinaryNumber<BigInteger>
interface IBitwiseOperators<BigInteger, BigInteger, BigInteger>
interface IComparisonOperators<BigInteger, BigInteger, bool>
interface IEqualityOperators<BigInteger, BigInteger, bool>
interface IDecrementOperators<BigInteger>
interface IDivisionOperators<BigInteger, BigInteger, BigInteger>
interface IIncrementOperators<BigInteger>
interface IModulusOperators<BigInteger, BigInteger, BigInteger>
interface IMultiplicativeIdentity<BigInteger, BigInteger>
interface IMultiplyOperators<BigInteger, BigInteger, BigInteger>
interface INumber<BigInteger>
interface INumberBase<BigInteger>
interface ISubtractionOperators<BigInteger, BigInteger, BigInteger>
interface IUnaryNegationOperators<BigInteger, BigInteger>
interface IUnaryPlusOperators<BigInteger, BigInteger>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<BigInteger>
interface IShiftOperators<BigInteger, int, BigInteger>
interface ISignedNumber<BigInteger>
[<System.Serializable>]
type BigInteger = struct
interface IFormattable
Public Structure BigInteger
Implements IComparable, IComparable(Of BigInteger), IEquatable(Of BigInteger), IFormattable
Public Structure BigInteger
Implements IAdditionOperators(Of BigInteger, BigInteger, BigInteger), IAdditiveIdentity(Of BigInteger, BigInteger), IBinaryInteger(Of BigInteger), IBinaryNumber(Of BigInteger), IBitwiseOperators(Of BigInteger, BigInteger, BigInteger), IComparable(Of BigInteger), IComparisonOperators(Of BigInteger, BigInteger, Boolean), IDecrementOperators(Of BigInteger), IDivisionOperators(Of BigInteger, BigInteger, BigInteger), IEqualityOperators(Of BigInteger, BigInteger, Boolean), IEquatable(Of BigInteger), IIncrementOperators(Of BigInteger), IModulusOperators(Of BigInteger, BigInteger, BigInteger), IMultiplicativeIdentity(Of BigInteger, BigInteger), IMultiplyOperators(Of BigInteger, BigInteger, BigInteger), INumber(Of BigInteger), INumberBase(Of BigInteger), IParsable(Of BigInteger), IShiftOperators(Of BigInteger, Integer, BigInteger), ISignedNumber(Of BigInteger), ISpanParsable(Of BigInteger), ISubtractionOperators(Of BigInteger, BigInteger, BigInteger), IUnaryNegationOperators(Of BigInteger, BigInteger), IUnaryPlusOperators(Of BigInteger, BigInteger), IUtf8SpanParsable(Of BigInteger)
Public Structure BigInteger
Implements IComparable, IComparable(Of BigInteger), IEquatable(Of BigInteger), ISpanFormattable
Public Structure BigInteger
Implements IAdditionOperators(Of BigInteger, BigInteger, BigInteger), IAdditiveIdentity(Of BigInteger, BigInteger), IBinaryInteger(Of BigInteger), IBinaryNumber(Of BigInteger), IBitwiseOperators(Of BigInteger, BigInteger, BigInteger), IComparable(Of BigInteger), IComparisonOperators(Of BigInteger, BigInteger, Boolean), IDecrementOperators(Of BigInteger), IDivisionOperators(Of BigInteger, BigInteger, BigInteger), IEqualityOperators(Of BigInteger, BigInteger, Boolean), IEquatable(Of BigInteger), IIncrementOperators(Of BigInteger), IModulusOperators(Of BigInteger, BigInteger, BigInteger), IMultiplicativeIdentity(Of BigInteger, BigInteger), IMultiplyOperators(Of BigInteger, BigInteger, BigInteger), INumber(Of BigInteger), INumberBase(Of BigInteger), IParsable(Of BigInteger), IShiftOperators(Of BigInteger, Integer, BigInteger), ISignedNumber(Of BigInteger), ISpanParsable(Of BigInteger), ISubtractionOperators(Of BigInteger, BigInteger, BigInteger), IUnaryNegationOperators(Of BigInteger, BigInteger), IUnaryPlusOperators(Of BigInteger, BigInteger)
- Dziedziczenie
- Atrybuty
- Implementuje
-
IComparable IComparable<BigInteger> IEquatable<BigInteger> IFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<BigInteger> IParsable<TSelf> ISpanFormattable ISpanParsable<BigInteger> ISpanParsable<TSelf> IUtf8SpanFormattable IUtf8SpanParsable<BigInteger> IUtf8SpanParsable<TSelf> IAdditionOperators<BigInteger,BigInteger,BigInteger> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<BigInteger,BigInteger> IAdditiveIdentity<TSelf,TSelf> IBinaryInteger<BigInteger> IBinaryNumber<BigInteger> IBinaryNumber<TSelf> IBitwiseOperators<BigInteger,BigInteger,BigInteger> IBitwiseOperators<TSelf,TSelf,TSelf> IComparisonOperators<BigInteger,BigInteger,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<BigInteger> IDecrementOperators<TSelf> IDivisionOperators<BigInteger,BigInteger,BigInteger> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<BigInteger,BigInteger,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IIncrementOperators<BigInteger> IIncrementOperators<TSelf> IModulusOperators<BigInteger,BigInteger,BigInteger> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<BigInteger,BigInteger> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<BigInteger,BigInteger,BigInteger> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<BigInteger> INumber<TSelf> INumberBase<BigInteger> INumberBase<TSelf> IShiftOperators<BigInteger,Int32,BigInteger> IShiftOperators<TSelf,Int32,TSelf> ISignedNumber<BigInteger> ISubtractionOperators<BigInteger,BigInteger,BigInteger> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<BigInteger,BigInteger> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<BigInteger,BigInteger> IUnaryPlusOperators<TSelf,TSelf>
Uwagi
Typ BigInteger jest niezmiennym typem reprezentującym dowolnie dużą liczbę całkowitą, której wartość teoretycznie nie ma granic górnych ani dolnych. Elementy członkowskie typu BigInteger ściśle odpowiadają elementom innych typów całkowitych (Byte, Int16, Int32, Int64, SByte, UInt16, UInt32 i UInt64). Ten typ różni się od innych typów całkowitych na platformie .NET, które mają zakres wskazywany przez właściwości MinValue i MaxValue.
Note
Ponieważ typ jest niezmienny (zobacz BigInteger) i ponieważ nie ma granic górnej lub dolnej, może być rzucony dla każdej operacji, która powoduje, że wartość OutOfMemoryException rośnie zbyt duża.
Utworzenie obiektu BigInteger
Możesz utworzyć instancję obiektu BigInteger na kilka sposobów.
Możesz użyć słowa kluczowego
newi podać dowolną wartość całkowitą lub zmiennoprzecinkową jako parametr konstruktora BigInteger . (Wartości zmiennoprzecinkowe są obcinane, zanim zostaną przypisane do BigInteger.) W poniższym przykładzie pokazano, jak używać słowa kluczowegonewdo inicjowania instancji wartości BigInteger.BigInteger bigIntFromDouble = new BigInteger(179032.6541); Console.WriteLine(bigIntFromDouble); BigInteger bigIntFromInt64 = new BigInteger(934157136952); Console.WriteLine(bigIntFromInt64); // The example displays the following output: // 179032 // 934157136952Dim bigIntFromDouble As New BigInteger(179032.6541) Console.WriteLine(bigIntFromDouble) Dim bigIntFromInt64 As New BigInteger(934157136952) Console.WriteLine(bigIntFromInt64) ' The example displays the following output: ' 179032 ' 934157136952Można zadeklarować zmienną BigInteger i przypisać jej wartość tak samo jak dowolny typ liczbowy, o ile ta wartość jest typem całkowitym. W poniższym przykładzie użyto przypisania w celu utworzenia BigInteger wartości na podstawie elementu Int64.
long longValue = 6315489358112; BigInteger assignedFromLong = longValue; Console.WriteLine(assignedFromLong); // The example displays the following output: // 6315489358112Dim longValue As Long = 6315489358112 Dim assignedFromLong As BigInteger = longValue Console.WriteLine(assignedFromLong) ' The example displays the following output: ' 6315489358112Można przypisać wartość dziesiętną lub zmiennoprzecinkową do BigInteger obiektu, jeśli najpierw rzutujesz wartość lub konwertujesz ją jako pierwszą. Poniższy przykład jawnie rzutuje (w języku C#) lub konwertuje (w Visual Basic) wartość Double i Decimal na wartość BigInteger.
BigInteger assignedFromDouble = (BigInteger) 179032.6541; Console.WriteLine(assignedFromDouble); BigInteger assignedFromDecimal = (BigInteger) 64312.65m; Console.WriteLine(assignedFromDecimal); // The example displays the following output: // 179032 // 64312Dim assignedFromDouble As BigInteger = CType(179032.6541, BigInteger) Console.WriteLine(assignedFromDouble) Dim assignedFromDecimal As BigInteger = CType(64312.65D, BigInteger) Console.WriteLine(assignedFromDecimal) ' The example displays the following output: ' 179032 ' 64312
Te metody umożliwiają utworzenie wystąpienia obiektu BigInteger, którego wartość znajduje się w zakresie tylko jednego z istniejących typów liczbowych. Można utworzyć wystąpienie obiektu BigInteger, którego wartość może przekroczyć zakres istniejących typów liczbowych na jeden z trzech sposobów:
Możesz użyć słowa kluczowego
newi przekazać tablicę bajtów dowolnego rozmiaru do konstruktora BigInteger.BigInteger. Przykład:byte[] byteArray = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; BigInteger newBigInt = new BigInteger(byteArray); Console.WriteLine($"The value of newBigInt is {newBigInt} (or 0x{newBigInt:x})."); // The example displays the following output: // The value of newBigInt is 4759477275222530853130 (or 0x102030405060708090a).Dim byteArray() As Byte = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0} Dim newBigInt As New BigInteger(byteArray) Console.WriteLine("The value of newBigInt is {0} (or 0x{0:x}).", newBigInt) ' The example displays the following output: ' The value of newBigInt is 4759477275222530853130 (or 0x102030405060708090a).Aby przekonwertować reprezentację liczby jako ciąg na Parse, można wywołać metody TryParse lub BigInteger. Przykład:
string positiveString = "91389681247993671255432112000000"; string negativeString = "-90315837410896312071002088037140000"; BigInteger posBigInt = 0; BigInteger negBigInt = 0; try { posBigInt = BigInteger.Parse(positiveString); Console.WriteLine(posBigInt); } catch (FormatException) { Console.WriteLine($"Unable to convert the string '{positiveString}' to a BigInteger value."); } if (BigInteger.TryParse(negativeString, out negBigInt)) Console.WriteLine(negBigInt); else Console.WriteLine($"Unable to convert the string '{negativeString}' to a BigInteger value."); // The example displays the following output: // 9.1389681247993671255432112E+31 // -9.0315837410896312071002088037E+34Dim positiveString As String = "91389681247993671255432112000000" Dim negativeString As String = "-90315837410896312071002088037140000" Dim posBigInt As BigInteger = 0 Dim negBigInt As BigInteger = 0 Try posBigInt = BigInteger.Parse(positiveString) Console.WriteLine(posBigInt) Catch e As FormatException Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.", positiveString) End Try If BigInteger.TryParse(negativeString, negBigInt) Then Console.WriteLine(negBigInt) Else Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.", negativeString) End If ' The example displays the following output: ' 9.1389681247993671255432112E+31 ' -9.0315837410896312071002088037E+34Można wywołać metodę
static(Sharedw Visual Basic), BigInteger która wykonuje jakąś operację na wyrażeniu liczbowym i zwraca wynik obliczeniowy BigInteger . W poniższym przykładzie można to zrobić, buforując i przypisując UInt64.MaxValue wynik do obiektu BigInteger.BigInteger number = BigInteger.Pow(UInt64.MaxValue, 3); Console.WriteLine(number); // The example displays the following output: // 6277101735386680762814942322444851025767571854389858533375Dim number As BigInteger = BigInteger.Pow(UInt64.MaxValue, 3) Console.WriteLine(number) ' The example displays the following output: ' 6277101735386680762814942322444851025767571854389858533375
Niezainicjowana wartość elementu BigInteger to Zero.
Wykonywanie operacji na wartościach BigInteger
Możesz użyć instancji BigInteger, tak jak w przypadku dowolnego innego typu całkowitego.
BigInteger przeciąża standardowe operatory liczbowe, aby umożliwić wykonywanie podstawowych operacji matematycznych, takich jak dodawanie, odejmowanie, dzielenie, mnożenie i negacja jednoargumentowa. Można również użyć standardowych operatorów liczbowych, aby porównać dwie BigInteger wartości ze sobą. Podobnie jak w przypadku innych typów całkowitych, BigInteger obsługuje również operatory bitowe And, Or, XOr, przesunięcie w lewo i przesunięcie w prawo. W przypadku języków, które nie obsługują operatorów niestandardowych, BigInteger struktura udostępnia również równoważne metody wykonywania operacji matematycznych. Należą do nich Add, Divide, Multiply, Negate, Subtract i kilka innych.
Wiele elementów członkowskich BigInteger struktury odpowiada bezpośrednio członkom innych typów całkowitych. Ponadto BigInteger dodaje członków takich jak następujący:
Sign, który zwraca wartość wskazującą, jaki jest znak wartości BigInteger.
Abs, która zwraca wartość bezwzględną BigInteger.
DivRem, który zwraca zarówno iloraz, jak i resztę z operacji dzielenia.
GreatestCommonDivisor, który zwraca największy wspólny dzielnika dwóch BigInteger wartości.
Wiele z tych dodatkowych składowych odpowiada członkom Math klasy, co zapewnia funkcjonalność pracy z typami liczb pierwotnymi.
Możliwość mutowania
Poniższy przykład tworzy obiekt BigInteger, a następnie zwiększa jego wartość o jeden.
BigInteger number = BigInteger.Multiply(Int64.MaxValue, 3);
number++;
Console.WriteLine(number);
Dim number As BigInteger = BigInteger.Multiply(Int64.MaxValue, 3)
number += 1
Console.WriteLine(number)
Mimo że ten przykład wydaje się modyfikować wartość istniejącego obiektu, nie jest tak. BigInteger obiekty są niezmienne, co oznacza, że wewnętrznie środowisko uruchomieniowe języka wspólnego tworzy nowy BigInteger obiekt i przypisuje mu wartość większą niż poprzednia wartość. Ten nowy obiekt zostanie następnie zwrócony do obiektu wywołującego.
Note
Inne typy liczbowe na platformie .NET są również niezmienne. Jednak ze względu na to, że typ BigInteger nie ma granic górnych ani dolnych, jego wartości mogą osiągać znaczne rozmiary i mieć wymierny wpływ na wydajność.
Mimo że ten proces jest niewidoczny dla elementu wywołującego, wiąże się z pogorszeniem wydajności. W niektórych przypadkach, zwłaszcza gdy powtarzające się operacje są wykonywane w pętli na bardzo dużych wartościach BigInteger, spadek wydajności może być znaczący. Na przykład w poniższym przykładzie operacja jest wykonywana powtarzalnie do miliona razy, a BigInteger wartość jest zwiększana o jeden za każdym razem, gdy operacja zakończy się pomyślnie.
BigInteger number = Int64.MaxValue ^ 5;
int repetitions = 1000000;
// Perform some repetitive operation 1 million times.
for (int ctr = 0; ctr <= repetitions; ctr++)
{
// Perform some operation. If it fails, exit the loop.
if (!SomeOperationSucceeds()) break;
// The following code executes if the operation succeeds.
number++;
}
Dim number As BigInteger = Int64.MaxValue ^ 5
Dim repetitions As Integer = 1000000
' Perform some repetitive operation 1 million times.
For ctr As Integer = 0 To repetitions
' Perform some operation. If it fails, exit the loop.
If Not SomeOperationSucceeds() Then Exit For
' The following code executes if the operation succeeds.
number += 1
Next
W takim przypadku można zwiększyć wydajność, wykonując wszystkie przypisania pośrednie do zmiennej Int32 . Ostateczna wartość zmiennej można następnie przypisać do obiektu po zakończeniu BigInteger pętli. Poniższy przykład stanowi ilustrację.
BigInteger number = Int64.MaxValue ^ 5;
int repetitions = 1000000;
int actualRepetitions = 0;
// Perform some repetitive operation 1 million times.
for (int ctr = 0; ctr <= repetitions; ctr++)
{
// Perform some operation. If it fails, exit the loop.
if (!SomeOperationSucceeds()) break;
// The following code executes if the operation succeeds.
actualRepetitions++;
}
number += actualRepetitions;
Dim number As BigInteger = Int64.MaxValue ^ 5
Dim repetitions As Integer = 1000000
Dim actualRepetitions As Integer = 0
' Perform some repetitive operation 1 million times.
For ctr As Integer = 0 To repetitions
' Perform some operation. If it fails, exit the loop.
If Not SomeOperationSucceeds() Then Exit For
' The following code executes if the operation succeeds.
actualRepetitions += 1
Next
number += actualRepetitions
Tablice bajtowe i ciągi szesnastkowe
W przypadku konwertowania BigInteger wartości na tablice bajtów lub konwersji tablic bajtowych na BigInteger wartości należy wziąć pod uwagę kolejność bajtów. Struktura BigInteger oczekuje, że poszczególne bajty w tablicy bajtów pojawią się w małej kolejności endian (czyli bajty niższej kolejności wartości poprzedzają bajty wyższego rzędu). Można przeprowadzić operację round-trip dla wartości BigInteger, wywołując metodę ToByteArray, a następnie przekazując wynikową tablicę bajtów do konstruktora BigInteger(Byte[]), co ilustruje poniższy przykład.
BigInteger number = BigInteger.Pow(Int64.MaxValue, 2);
Console.WriteLine(number);
// Write the BigInteger value to a byte array.
byte[] bytes = number.ToByteArray();
// Display the byte array.
foreach (byte byteValue in bytes)
Console.Write("0x{0:X2} ", byteValue);
Console.WriteLine();
// Restore the BigInteger value from a Byte array.
BigInteger newNumber = new BigInteger(bytes);
Console.WriteLine(newNumber);
// The example displays the following output:
// 8.5070591730234615847396907784E+37
// 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x3F
//
// 8.5070591730234615847396907784E+37
Dim number As BigInteger = BigInteger.Pow(Int64.MaxValue, 2)
Console.WriteLine(number)
' Write the BigInteger value to a byte array.
Dim bytes() As Byte = number.ToByteArray()
' Display the byte array.
For Each byteValue As Byte In bytes
Console.Write("0x{0:X2} ", byteValue)
Next
Console.WriteLine()
' Restore the BigInteger value from a Byte array.
Dim newNumber As BigInteger = New BigInteger(bytes)
Console.WriteLine(newNumber)
' The example displays the following output:
' 8.5070591730234615847396907784E+37
' 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x3F
'
' 8.5070591730234615847396907784E+37
Aby zobrazować wartość BigInteger z tablicy bajtów reprezentującej wartość innego typu całkowitego, można przekazać wartość całkowitą do metody BitConverter.GetBytes, a następnie przekazać wynikową tablicę bajtów do konstruktora BigInteger(Byte[]). Poniższy przykład tworzy wystąpienie BigInteger wartości z tablicy bajtów, reprezentującą wartość Int16.
short originalValue = 30000;
Console.WriteLine(originalValue);
// Convert the Int16 value to a byte array.
byte[] bytes = BitConverter.GetBytes(originalValue);
// Display the byte array.
foreach (byte byteValue in bytes)
Console.Write("0x{0} ", byteValue.ToString("X2"));
Console.WriteLine();
// Pass byte array to the BigInteger constructor.
BigInteger number = new BigInteger(bytes);
Console.WriteLine(number);
// The example displays the following output:
// 30000
// 0x30 0x75
// 30000
Dim originalValue As Short = 30000
Console.WriteLine(originalValue)
' Convert the Int16 value to a byte array.
Dim bytes() As Byte = BitConverter.GetBytes(originalValue)
' Display the byte array.
For Each byteValue As Byte In bytes
Console.Write("0x{0} ", byteValue.ToString("X2"))
Next
Console.WriteLine()
' Pass byte array to the BigInteger constructor.
Dim number As BigInteger = New BigInteger(bytes)
Console.WriteLine(number)
' The example displays the following output:
' 30000
' 0x30 0x75
' 30000
Struktura BigInteger zakłada, że wartości ujemne są przechowywane przy użyciu reprezentacji uzupełniającej dwóch. BigInteger Ponieważ struktura reprezentuje wartość liczbową bez stałej długości, BigInteger(Byte[]) konstruktor zawsze interpretuje najbardziej znaczący bit ostatniego bajtu w tablicy jako bit znaku. Aby uniemożliwić konstruktorowi BigInteger(Byte[]) pomylenie reprezentacji wartości ujemnej z reprezentacją wartości dodatniej w postaci znaku i wielkości, wartości dodatnie, w których najbardziej znaczący bit ostatniego bajtu w tablicy bajtów normalnie byłby ustawiony, powinny zawierać dodatkowy bajt o wartości 0. Na przykład 0xC0 0xBD 0xF0 0xFF jest szesnastkową reprezentacją w formacie little-endian liczby -1 000 000 lub 4 293 967 296. Ponieważ najbardziej znaczący bit ostatniego bajtu w tej tablicy jest włączony, wartość tablicy bajtów będzie interpretowana przez BigInteger(Byte[]) konstruktora jako -1000 000. Aby utworzyć BigInteger wystąpienie, którego wartość jest dodatnia, tablica bajtów, której elementy są 0xC0 0xBD 0xF0 0xFF 0x00 musi zostać przekazana do konstruktora. Ilustruje to przykład poniżej.
int negativeNumber = -1000000;
uint positiveNumber = 4293967296;
byte[] negativeBytes = BitConverter.GetBytes(negativeNumber);
BigInteger negativeBigInt = new BigInteger(negativeBytes);
Console.WriteLine(negativeBigInt.ToString("N0"));
byte[] tempPosBytes = BitConverter.GetBytes(positiveNumber);
byte[] positiveBytes = new byte[tempPosBytes.Length + 1];
Array.Copy(tempPosBytes, positiveBytes, tempPosBytes.Length);
BigInteger positiveBigInt = new BigInteger(positiveBytes);
Console.WriteLine(positiveBigInt.ToString("N0"));
// The example displays the following output:
// -1,000,000
// 4,293,967,296
Dim negativeNumber As Integer = -1000000
Dim positiveNumber As UInteger = 4293967296
Dim negativeBytes() As Byte = BitConverter.GetBytes(negativeNumber)
Dim negativeBigInt As New BigInteger(negativeBytes)
Console.WriteLine(negativeBigInt.ToString("N0"))
Dim tempPosBytes() As Byte = BitConverter.GetBytes(positiveNumber)
Dim positiveBytes(tempposBytes.Length) As Byte
Array.Copy(tempPosBytes, positiveBytes, tempPosBytes.Length)
Dim positiveBigInt As New BigInteger(positiveBytes)
Console.WriteLine(positiveBigInt.ToString("N0"))
' The example displays the following output:
' -1,000,000
' 4,293,967,296
Tablice bajtów utworzone przez metodę ToByteArray z wartości dodatnich obejmują ten dodatkowy bajt zerowej wartości. W związku z tym struktura może pomyślnie przekonwertować wartości, przypisując je do struktury BigInteger, a następnie przywracając je z tablic bajtowych, jak pokazuje poniższy przykład.
BigInteger positiveValue = 15777216;
BigInteger negativeValue = -1000000;
Console.WriteLine("Positive value: " + positiveValue.ToString("N0"));
byte[] bytes = positiveValue.ToByteArray();
foreach (byte byteValue in bytes)
Console.Write("{0:X2} ", byteValue);
Console.WriteLine();
positiveValue = new BigInteger(bytes);
Console.WriteLine("Restored positive value: " + positiveValue.ToString("N0"));
Console.WriteLine();
Console.WriteLine("Negative value: " + negativeValue.ToString("N0"));
bytes = negativeValue.ToByteArray();
foreach (byte byteValue in bytes)
Console.Write("{0:X2} ", byteValue);
Console.WriteLine();
negativeValue = new BigInteger(bytes);
Console.WriteLine("Restored negative value: " + negativeValue.ToString("N0"));
// The example displays the following output:
// Positive value: 15,777,216
// C0 BD F0 00
// Restored positive value: 15,777,216
//
// Negative value: -1,000,000
// C0 BD F0
// Restored negative value: -1,000,000
Dim positiveValue As BigInteger = 15777216
Dim negativeValue As BigInteger = -1000000
Console.WriteLine("Positive value: " + positiveValue.ToString("N0"))
Dim bytes() As Byte = positiveValue.ToByteArray()
For Each byteValue As Byte In bytes
Console.Write("{0:X2} ", byteValue)
Next
Console.WriteLine()
positiveValue = New BigInteger(bytes)
Console.WriteLine("Restored positive value: " + positiveValue.ToString("N0"))
Console.WriteLine()
Console.WriteLIne("Negative value: " + negativeValue.ToString("N0"))
bytes = negativeValue.ToByteArray()
For Each byteValue As Byte In bytes
Console.Write("{0:X2} ", byteValue)
Next
Console.WriteLine()
negativeValue = New BigInteger(bytes)
Console.WriteLine("Restored negative value: " + negativeValue.ToString("N0"))
' The example displays the following output:
' Positive value: 15,777,216
' C0 BD F0 00
' Restored positive value: 15,777,216
'
' Negative value: -1,000,000
' C0 BD F0
' Restored negative value: -1,000,000
Może jednak być konieczne dodanie tego dodatkowego bajtu o wartości zerowej do tablic bajtów tworzonych dynamicznie przez dewelopera lub zwracanych przez metody, które konwertują niepodpisane liczby całkowite na tablice bajtów (takie jak BitConverter.GetBytes(UInt16), BitConverter.GetBytes(UInt32)i BitConverter.GetBytes(UInt64)).
Podczas analizowania ciągu szesnastkowego, metody BigInteger.Parse(String, NumberStyles) oraz BigInteger.Parse(String, NumberStyles, IFormatProvider) zakładają, że jeśli najbardziej znaczący bit pierwszego bajtu w ciągu jest ustawiony, lub jeśli pierwsza cyfra szesnastkowa ciągu reprezentuje dolne cztery bity wartości bajtowej, wartość jest reprezentowana przy użyciu reprezentacji uzupełniania do dwóch. Na przykład wartości "FF01" i "F01" reprezentują wartość dziesiętną -255. Aby odróżnić wartości dodatnie od wartości ujemnych, wartości dodatnie powinny zawierać zero wiodące. Odpowiednie przeciążenia metody ToString, gdy przekazuje się ciąg formatu "X", dodają wiodące zero do zwracanych ciągów szesnastkowych dla wartości dodatnich. Dzięki temu można umożliwić dwustronną konwersję wartości BigInteger przy użyciu metod ToString i Parse, jak pokazano w poniższym przykładzie.
BigInteger negativeNumber = -1000000;
BigInteger positiveNumber = 15777216;
string negativeHex = negativeNumber.ToString("X");
string positiveHex = positiveNumber.ToString("X");
BigInteger negativeNumber2, positiveNumber2;
negativeNumber2 = BigInteger.Parse(negativeHex,
NumberStyles.HexNumber);
positiveNumber2 = BigInteger.Parse(positiveHex,
NumberStyles.HexNumber);
Console.WriteLine($"Converted {negativeNumber:N0} to {negativeHex} back to {negativeNumber2:N0}.");
Console.WriteLine($"Converted {positiveNumber:N0} to {positiveHex} back to {positiveNumber2:N0}.");
// The example displays the following output:
// Converted -1,000,000 to F0BDC0 back to -1,000,000.
// Converted 15,777,216 to 0F0BDC0 back to 15,777,216.
Dim negativeNumber As BigInteger = -1000000
Dim positiveNumber As BigInteger = 15777216
Dim negativeHex As String = negativeNumber.ToString("X")
Dim positiveHex As string = positiveNumber.ToString("X")
Dim negativeNumber2, positiveNumber2 As BigInteger
negativeNumber2 = BigInteger.Parse(negativeHex,
NumberStyles.HexNumber)
positiveNumber2 = BigInteger.Parse(positiveHex,
NumberStyles.HexNumber)
Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
negativeNumber, negativeHex, negativeNumber2)
Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
positiveNumber, positiveHex, positiveNumber2)
' The example displays the following output:
' Converted -1,000,000 to F0BDC0 back to -1,000,000.
' Converted 15,777,216 to 0F0BDC0 back to 15,777,216.
Jednak ciągi szesnastkowe utworzone przez wywołanie metod ToString innych typów całkowitych lub przeciążeń metody ToString, które zawierają parametr toBase, nie wskazują znaku wartości ani typu danych źródłowych, z którego pochodzi ciąg szesnastkowy. Pomyślne utworzenie instancji BigInteger wartości z takiego ciągu wymaga dodatkowej logiki. Poniższy przykład przedstawia jedną z możliwych implementacji.
using System;
using System.Globalization;
using System.Numerics;
public struct HexValue
{
public int Sign;
public string Value;
}
public class ByteHexExample2
{
public static void Main()
{
uint positiveNumber = 4039543321;
int negativeNumber = -255423975;
// Convert the numbers to hex strings.
HexValue hexValue1, hexValue2;
hexValue1.Value = positiveNumber.ToString("X");
hexValue1.Sign = Math.Sign(positiveNumber);
hexValue2.Value = Convert.ToString(negativeNumber, 16);
hexValue2.Sign = Math.Sign(negativeNumber);
// Round-trip the hexadecimal values to BigInteger values.
string hexString;
BigInteger positiveBigInt, negativeBigInt;
hexString = (hexValue1.Sign == 1 ? "0" : "") + hexValue1.Value;
positiveBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber);
Console.WriteLine($"Converted {positiveNumber} to {hexValue1.Value} and back to {positiveBigInt}.");
hexString = (hexValue2.Sign == 1 ? "0" : "") + hexValue2.Value;
negativeBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber);
Console.WriteLine($"Converted {negativeNumber} to {hexValue2.Value} and back to {negativeBigInt}.");
}
}
// The example displays the following output:
// Converted 4039543321 to F0C68A19 and back to 4039543321.
// Converted -255423975 to f0c68a19 and back to -255423975.
Imports System.Globalization
Imports System.Numerics
Public Structure HexValue
Public Sign As Integer
Public Value As String
End Structure
Module Example2
Public Sub Main()
Dim positiveNumber As UInteger = 4039543321
Dim negativeNumber As Integer = -255423975
' Convert the numbers to hex strings.
Dim hexValue1, hexValue2 As HexValue
hexValue1.Value = positiveNumber.ToString("X")
hexValue1.Sign = Math.Sign(positiveNumber)
hexValue2.Value = Convert.ToString(negativeNumber, 16)
hexValue2.Sign = Math.Sign(negativeNumber)
' Round-trip the hexadecimal values to BigInteger values.
Dim hexString As String
Dim positiveBigInt, negativeBigInt As BigInteger
hexString = CStr(IIf(hexValue1.Sign = 1, "0", "")) + hexValue1.Value
positiveBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber)
Console.WriteLine("Converted {0} to {1} and back to {2}.",
positiveNumber, hexValue1.Value, positiveBigInt)
hexString = CStr(IIf(hexValue2.Sign = 1, "0", "")) + hexValue2.Value
negativeBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber)
Console.WriteLine("Converted {0} to {1} and back to {2}.",
negativeNumber, hexValue2.Value, negativeBigInt)
End Sub
End Module
' The example displays the following output:
' Converted 4039543321 to F0C68A19 and back to 4039543321.
' Converted -255423975 to f0c68a19 and back to -255423975.
Konstruktory
| Nazwa | Opis |
|---|---|
| BigInteger(Byte[]) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu wartości w tablicy bajtów. |
| BigInteger(Decimal) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu Decimal wartości. |
| BigInteger(Double) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu wartości zmiennoprzecinkowej o podwójnej precyzji. |
| BigInteger(Int32) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu 32-bitowej wartości całkowitej ze znakiem. |
| BigInteger(Int64) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu 64-bitowej wartości całkowitej ze znakiem. |
| BigInteger(ReadOnlySpan<Byte>, Boolean, Boolean) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu wartości w zakresie tylko do odczytu bajtów i opcjonalnie wskazuje kodowanie podpisywania i kolejność bajtów endianness. |
| BigInteger(Single) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu wartości zmiennoprzecinkowej o pojedynczej precyzji. |
| BigInteger(UInt32) |
Inicjuje nowe wystąpienie BigInteger struktury przy użyciu niepodpisanej 32-bitowej wartości całkowitej. |
| BigInteger(UInt64) |
Inicjuje nowe wystąpienie BigInteger struktury z niepodpisaną 64-bitową wartością całkowitą. |
Właściwości
| Nazwa | Opis |
|---|---|
| IsEven |
Wskazuje, czy wartość bieżącego BigInteger obiektu jest liczbą parzystą. |
| IsOne |
Wskazuje, czy wartość bieżącego BigInteger obiektu to One. |
| IsPowerOfTwo |
Wskazuje, czy wartość bieżącego BigInteger obiektu jest potęgą dwóch. |
| IsZero |
Wskazuje, czy wartość bieżącego BigInteger obiektu to Zero. |
| MinusOne |
Pobiera wartość reprezentującą liczbę ujemną (-1). |
| One |
Pobiera wartość reprezentującą liczbę jedną (1). |
| Sign |
Pobiera liczbę wskazującą znak (ujemny, dodatni lub zero) bieżącego BigInteger obiektu. |
| Zero |
Pobiera wartość reprezentującą liczbę 0 (zero). |
Metody
| Nazwa | Opis |
|---|---|
| Abs(BigInteger) |
Pobiera wartość bezwzględną BigInteger obiektu. |
| Add(BigInteger, BigInteger) |
Dodaje dwie BigInteger wartości i zwraca wynik. |
| Clamp(BigInteger, BigInteger, BigInteger) |
Zaciska wartość do wartości minimalnej i maksymalnej. |
| Compare(BigInteger, BigInteger) |
Porównuje dwie BigInteger wartości i zwraca liczbę całkowitą, która wskazuje, czy pierwsza wartość jest mniejsza niż, równa lub większa niż druga wartość. |
| CompareTo(BigInteger) |
Porównuje to wystąpienie z sekundą BigInteger i zwraca liczbę całkowitą wskazującą, czy wartość tego wystąpienia jest mniejsza niż, równa lub większa niż wartość określonego obiektu. |
| CompareTo(Int64) |
Porównuje to wystąpienie z podpisaną 64-bitową liczbą całkowitą i zwraca liczbę całkowitą wskazującą, czy wartość tego wystąpienia jest mniejsza niż, równa lub większa niż wartość podpisanej liczby całkowitej 64-bitowej. |
| CompareTo(Object) |
Porównuje to wystąpienie z określonym obiektem i zwraca liczbę całkowitą wskazującą, czy wartość tego wystąpienia jest mniejsza niż, równa lub większa niż wartość określonego obiektu. |
| CompareTo(UInt64) |
Porównuje to wystąpienie z niepodpisaną 64-bitową liczbą całkowitą i zwraca liczbę całkowitą wskazującą, czy wartość tego wystąpienia jest mniejsza niż, równa lub większa niż wartość niepodpisanej liczby całkowitej 64-bitowej. |
| CopySign(BigInteger, BigInteger) |
Kopiuje znak wartości do znaku innej wartości. |
| CreateChecked<TOther>(TOther) |
Tworzy wystąpienie bieżącego typu na podstawie wartości, zgłaszając wyjątek przepełnienia dla wszystkich wartości, które mieszczą się poza dopuszczalnym zakresem bieżącego typu. |
| CreateSaturating<TOther>(TOther) |
Tworzy wystąpienie bieżącego typu na podstawie wartości, usytując wszystkie wartości, które wykraczają poza reprezentowany zakres bieżącego typu. |
| CreateTruncating<TOther>(TOther) |
Tworzy wystąpienie bieżącego typu na podstawie wartości, obcinając wszystkie wartości, które wykraczają poza reprezentowany zakres bieżącego typu. |
| Divide(BigInteger, BigInteger) |
Dzieli jedną BigInteger wartość przez inną i zwraca wynik. |
| DivRem(BigInteger, BigInteger, BigInteger) |
Dzieli jedną BigInteger wartość przez inną, zwraca wynik i zwraca resztę w parametrze wyjściowym. |
| DivRem(BigInteger, BigInteger) |
Oblicza iloraz i pozostałą część dwóch wartości. |
| Equals(BigInteger) |
Zwraca wartość wskazującą, czy bieżące wystąpienie i określony BigInteger obiekt mają tę samą wartość. |
| Equals(Int64) |
Zwraca wartość wskazującą, czy bieżące wystąpienie i podpisana liczba całkowita 64-bitowa mają tę samą wartość. |
| Equals(Object) |
Zwraca wartość wskazującą, czy bieżące wystąpienie i określony obiekt mają tę samą wartość. |
| Equals(UInt64) |
Zwraca wartość wskazującą, czy bieżące wystąpienie i niepodpisane 64-bitowe liczby całkowite mają tę samą wartość. |
| GetBitLength() |
Pobiera liczbę bitów wymaganych przez najkrótszą reprezentację bieżącego wystąpienia bez bitu znaku. |
| GetByteCount(Boolean) |
Pobiera liczbę bajtów, które będą wyjściowe według ToByteArray(Boolean, Boolean) i TryWriteBytes(Span<Byte>, Int32, Boolean, Boolean). |
| GetHashCode() |
Zwraca kod skrótu dla bieżącego BigInteger obiektu. |
| GreatestCommonDivisor(BigInteger, BigInteger) |
Znajduje największy wspólny dzielnika dwóch BigInteger wartości. |
| IsEvenInteger(BigInteger) |
Określa, czy wartość reprezentuje liczbę całkowitą parzystą. |
| IsNegative(BigInteger) |
Określa, czy wartość jest ujemna. |
| IsOddInteger(BigInteger) |
Określa, czy wartość reprezentuje nieparzystną liczbę całkowitą. |
| IsPositive(BigInteger) |
Określa, czy wartość jest dodatnia. |
| IsPow2(BigInteger) |
Określa, czy wartość jest potęgą dwóch. |
| LeadingZeroCount(BigInteger) |
Oblicza liczbę zer wiodących w wartości. |
| Log(BigInteger, Double) |
Zwraca logarytm określonej liczby w określonej bazie. |
| Log(BigInteger) |
Zwraca logarytm naturalny (podstawowy |
| Log10(BigInteger) |
Zwraca logarytm podstawowy 10 określonej liczby. |
| Log2(BigInteger) |
Oblicza dziennik2 wartości. |
| Max(BigInteger, BigInteger) |
Zwraca większą z dwóch BigInteger wartości. |
| MaxMagnitude(BigInteger, BigInteger) |
Porównuje dwie wartości z obliczeniami, które są większe. |
| Min(BigInteger, BigInteger) |
Zwraca mniejsze z dwóch BigInteger wartości. |
| MinMagnitude(BigInteger, BigInteger) |
Porównuje dwie wartości z obliczeniami, które są mniejsze. |
| ModPow(BigInteger, BigInteger, BigInteger) |
Wykonuje podział modulu na liczbę podniesioną do potęgi innej liczby. |
| Multiply(BigInteger, BigInteger) |
Zwraca produkt dwóch BigInteger wartości. |
| Negate(BigInteger) |
Neguje określoną BigInteger wartość. |
| Parse(ReadOnlySpan<Byte>, IFormatProvider) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| Parse(ReadOnlySpan<Char>, IFormatProvider) |
Analizuje zakres znaków w wartości. |
| Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
Konwertuje reprezentację liczby zawartej w określonym zakresie znaków tylko do odczytu w określonym stylu na jego BigInteger odpowiednik. |
| Parse(String, IFormatProvider) |
Konwertuje reprezentację ciągu liczby w określonym formacie specyficznym dla kultury na jego BigInteger odpowiednik. |
| Parse(String, NumberStyles, IFormatProvider) |
Konwertuje reprezentację ciągu liczby w określonym stylu i formacie specyficznym dla kultury na jego BigInteger odpowiednik. |
| Parse(String, NumberStyles) |
Konwertuje reprezentację ciągu liczby w określonym stylu na jej BigInteger odpowiednik. |
| Parse(String) |
Konwertuje reprezentację ciągu liczby na jej BigInteger odpowiednik. |
| PopCount(BigInteger) |
Oblicza liczbę bitów ustawionych w wartości. |
| Pow(BigInteger, Int32) |
BigInteger Podnosi wartość do potęgi określonej wartości. |
| Remainder(BigInteger, BigInteger) |
Wykonuje dzielenie całkowite na dwie BigInteger wartości i zwraca resztę. |
| RotateLeft(BigInteger, Int32) |
Obraca wartość pozostawioną przez daną kwotę. |
| RotateRight(BigInteger, Int32) |
Obraca wartość w prawo o daną kwotę. |
| Subtract(BigInteger, BigInteger) |
Odejmuje jedną BigInteger wartość z innej i zwraca wynik. |
| ToByteArray() |
Konwertuje BigInteger wartość na tablicę bajtów. |
| ToByteArray(Boolean, Boolean) |
Zwraca wartość tej BigInteger wartości jako tablicy bajtów przy użyciu najmniejszej możliwej liczby bajtów. Jeśli wartość jest równa zero, zwraca tablicę jednego bajtu, którego element jest 0x00. |
| ToString() |
Konwertuje wartość liczbową bieżącego BigInteger obiektu na równoważną reprezentację ciągu. |
| ToString(IFormatProvider) |
Konwertuje wartość liczbową bieżącego BigInteger obiektu na równoważną reprezentację ciągu przy użyciu określonych informacji formatowania specyficznych dla kultury. |
| ToString(String, IFormatProvider) |
Konwertuje wartość liczbową bieżącego BigInteger obiektu na równoważną reprezentację ciągu przy użyciu określonego formatu i informacji o formacie specyficznym dla kultury. |
| ToString(String) |
Konwertuje wartość liczbową bieżącego BigInteger obiektu na równoważną reprezentację ciągu przy użyciu określonego formatu. |
| TrailingZeroCount(BigInteger) |
Oblicza liczbę końcowych zer w wartości. |
| TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Formatuje to duże wystąpienie liczb całkowitych na zakres znaków. |
| TryParse(ReadOnlySpan<Byte>, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| TryParse(ReadOnlySpan<Byte>, IFormatProvider, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| TryParse(ReadOnlySpan<Char>, BigInteger) |
Próbuje przekonwertować reprezentację liczby zawartej w określonym zakresie znaków tylko do odczytu na jej BigInteger odpowiednik i zwraca wartość wskazującą, czy konwersja zakończyła się pomyślnie. |
| TryParse(ReadOnlySpan<Char>, IFormatProvider, BigInteger) |
Próbuje przeanalizować zakres znaków w wartości. |
| TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, BigInteger) |
Próbuje przekonwertować reprezentację ciągu liczby na jej BigInteger odpowiednik i zwraca wartość wskazującą, czy konwersja zakończyła się pomyślnie. |
| TryParse(String, BigInteger) |
Próbuje przekonwertować reprezentację ciągu liczby na jej BigInteger odpowiednik i zwraca wartość wskazującą, czy konwersja zakończyła się pomyślnie. |
| TryParse(String, IFormatProvider, BigInteger) |
Próbuje przeanalizować ciąg w wartości. |
| TryParse(String, NumberStyles, IFormatProvider, BigInteger) |
Próbuje przekonwertować reprezentację ciągu liczby w określonym stylu i formacie specyficznym dla kultury na jego BigInteger odpowiednik i zwraca wartość wskazującą, czy konwersja zakończyła się pomyślnie. |
| TryWriteBytes(Span<Byte>, Int32, Boolean, Boolean) |
Kopiuje wartość tego BigInteger dwubajtowego dwubajta, używając najmniejszej możliwej liczby bajtów. Jeśli wartość ma wartość zero, zwraca jeden bajt, którego element jest 0x00. |
Operatory
| Nazwa | Opis |
|---|---|
| Addition(BigInteger, BigInteger) |
Dodaje wartości dwóch określonych BigInteger obiektów. |
| BitwiseAnd(BigInteger, BigInteger) |
Wykonuje bitową |
| BitwiseOr(BigInteger, BigInteger) |
Wykonuje bitową |
| Decrement(BigInteger) |
Dekrementuje BigInteger wartość o 1. |
| Division(BigInteger, BigInteger) |
Dzieli określoną BigInteger wartość przez inną określoną BigInteger wartość przy użyciu dzielenia całkowitego. |
| Equality(BigInteger, BigInteger) |
Zwraca wartość wskazującą, czy wartości dwóch BigInteger obiektów są równe. |
| Equality(BigInteger, Int64) |
Zwraca wartość wskazującą, czy BigInteger wartość i podpisana długa liczba całkowita są równe. |
| Equality(BigInteger, UInt64) |
Zwraca wartość wskazującą, czy BigInteger wartość i niepodpisane długie wartości całkowite są równe. |
| Equality(Int64, BigInteger) |
Zwraca wartość wskazującą, czy podpisana długa liczba całkowita i BigInteger wartość są równe. |
| Equality(UInt64, BigInteger) |
Zwraca wartość wskazującą, czy niepodpisane długie liczby całkowite i BigInteger wartość są równe. |
| ExclusiveOr(BigInteger, BigInteger) |
Wykonuje bitową operację wykluczania |
| Explicit(BFloat16 to BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| Explicit(BigInteger to BFloat16) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| Explicit(BigInteger to Byte) |
Definiuje jawną konwersję BigInteger obiektu na niepodpisaną wartość bajtu. |
| Explicit(BigInteger to Char) |
Jawnie konwertuje dużą liczbę całkowitą na Char wartość. |
| Explicit(BigInteger to Decimal) |
Definiuje jawną konwersję BigIntegerDecimal obiektu na wartość. |
| Explicit(BigInteger to Double) |
Definiuje jawną konwersję BigIntegerDouble obiektu na wartość. |
| Explicit(BigInteger to Half) |
Jawnie konwertuje dużą liczbę całkowitą na Half wartość. |
| Explicit(BigInteger to Int128) |
Jawnie konwertuje dużą liczbę całkowitą na Int128 wartość. |
| Explicit(BigInteger to Int16) |
Definiuje jawną konwersję BigInteger obiektu na 16-bitową wartość całkowitą ze znakiem. |
| Explicit(BigInteger to Int32) |
Definiuje jawną konwersję BigInteger obiektu na 32-bitową wartość całkowitą ze znakiem. |
| Explicit(BigInteger to Int64) |
Definiuje jawną konwersję BigInteger obiektu na 64-bitową wartość całkowitą ze znakiem. |
| Explicit(BigInteger to IntPtr) |
Jawnie konwertuje dużą liczbę całkowitą na IntPtr wartość. |
| Explicit(BigInteger to SByte) |
Definiuje jawną konwersję BigInteger obiektu na podpisaną wartość 8-bitową. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Int16. |
| Explicit(BigInteger to Single) |
Definiuje jawną konwersję BigInteger obiektu na wartość zmiennoprzecinkową o pojedynczej precyzji. |
| Explicit(BigInteger to UInt128) |
Jawnie konwertuje dużą liczbę całkowitą na UInt128 wartość. |
| Explicit(BigInteger to UInt16) |
Definiuje jawną konwersję BigInteger obiektu na niepodpisaną 16-bitową wartość całkowitą. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Int32. |
| Explicit(BigInteger to UInt32) |
Definiuje jawną konwersję BigInteger obiektu na niepodpisaną wartość całkowitą 32-bitową. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Int64. |
| Explicit(BigInteger to UInt64) |
Definiuje jawną konwersję BigInteger obiektu na niepodpisaną wartość całkowitą 64-bitową. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Double. |
| Explicit(BigInteger to UIntPtr) |
Jawnie konwertuje dużą liczbę całkowitą na UIntPtr wartość. |
| Explicit(Complex to BigInteger) |
Jawnie konwertuje Complex wartość na dużą liczbę całkowitą. |
| Explicit(Decimal to BigInteger) |
Definiuje jawną konwersję DecimalBigInteger obiektu na wartość. |
| Explicit(Double to BigInteger) |
Definiuje jawną konwersję DoubleBigInteger wartości na wartość. |
| Explicit(Half to BigInteger) |
Jawnie konwertuje Half wartość na dużą liczbę całkowitą. |
| Explicit(Single to BigInteger) |
Definiuje jawną konwersję SingleBigInteger wartości na wartość. |
| GreaterThan(BigInteger, BigInteger) |
Zwraca wartość wskazującą BigInteger , czy wartość jest większa niż inna BigInteger wartość. |
| GreaterThan(BigInteger, Int64) |
Zwraca wartość wskazującą, czy BigInteger wartość całkowita z podpisem 64-bitowym jest większa. |
| GreaterThan(BigInteger, UInt64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest większa niż 64-bitowa liczba całkowita bez znaku. |
| GreaterThan(Int64, BigInteger) |
Zwraca wartość wskazującą, czy liczba całkowita ze znakiem BigInteger 64-bitowym jest większa niż wartość. |
| GreaterThan(UInt64, BigInteger) |
Zwraca wartość wskazującą BigInteger , czy wartość jest większa niż 64-bitowa liczba całkowita bez znaku. |
| GreaterThanOrEqual(BigInteger, BigInteger) |
Zwraca wartość wskazującą BigInteger , czy wartość jest większa niż lub równa innej BigInteger wartości. |
| GreaterThanOrEqual(BigInteger, Int64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest większa niż lub równa 64-bitowej wartości całkowitej ze znakiem. |
| GreaterThanOrEqual(BigInteger, UInt64) |
Zwraca wartość wskazującą, czy BigInteger wartość jest większa niż lub równa 64-bitowej wartości całkowitej bez znaku. |
| GreaterThanOrEqual(Int64, BigInteger) |
Zwraca wartość wskazującą, czy liczba całkowita ze znakiem BigInteger 64-bitowym jest większa lub równa wartości. |
| GreaterThanOrEqual(UInt64, BigInteger) |
Zwraca wartość wskazującą, czy 64-bitowa liczba całkowita bez znaku jest większa niż lub równa BigInteger wartości. |
| Implicit(Byte to BigInteger) |
Definiuje niejawną konwersję niepodpisanego bajtu BigInteger na wartość. |
| Implicit(Char to BigInteger) |
Niejawnie konwertuje Char wartość na dużą liczbę całkowitą. |
| Implicit(Int128 to BigInteger) |
Niejawnie konwertuje Int128 wartość na dużą liczbę całkowitą. |
| Implicit(Int16 to BigInteger) |
Definiuje niejawną konwersję BigInteger podpisanej liczby całkowitej 16-bitowej na wartość. |
| Implicit(Int32 to BigInteger) |
Definiuje niejawną konwersję BigInteger podpisanej liczby całkowitej 32-bitowej na wartość. |
| Implicit(Int64 to BigInteger) |
Definiuje niejawną konwersję BigInteger podpisanej liczby całkowitej 64-bitowej na wartość. |
| Implicit(IntPtr to BigInteger) |
Niejawnie konwertuje IntPtr wartość na dużą liczbę całkowitą. |
| Implicit(SByte to BigInteger) |
Definiuje niejawną konwersję 8-bitowej liczby całkowitej ze znakiem BigInteger na wartość. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to BigInteger(Int32). |
| Implicit(UInt128 to BigInteger) |
Niejawnie konwertuje UInt128 wartość na dużą liczbę całkowitą. |
| Implicit(UInt16 to BigInteger) |
Definiuje niejawną konwersję BigInteger 16-bitowej liczby całkowitej bez znaku na wartość. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Implicit(Int32 to BigInteger). |
| Implicit(UInt32 to BigInteger) |
Definiuje niejawną konwersję BigInteger 32-bitowej liczby całkowitej bez znaku na wartość. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Implicit(Int64 to BigInteger). |
| Implicit(UInt64 to BigInteger) |
Definiuje niejawną konwersję 64-bitowej liczby całkowitej BigInteger bez znaku na wartość. Ten interfejs API nie jest zgodny ze specyfikacją CLS. Zgodna alternatywa to Double. |
| Implicit(UIntPtr to BigInteger) |
Niejawnie konwertuje UIntPtr wartość na dużą liczbę całkowitą. |
| Increment(BigInteger) |
Zwiększa BigInteger wartość o 1. |
| Inequality(BigInteger, BigInteger) |
Zwraca wartość wskazującą, czy dwa BigInteger obiekty mają różne wartości. |
| Inequality(BigInteger, Int64) |
Zwraca wartość wskazującą BigInteger , czy wartość i 64-bitowa liczba całkowita ze znakiem nie są równe. |
| Inequality(BigInteger, UInt64) |
Zwraca wartość wskazującą, czy BigInteger wartość i 64-bitowa liczba całkowita niepodpisane nie są równe. |
| Inequality(Int64, BigInteger) |
Zwraca wartość wskazującą, czy liczba całkowita ze znakiem BigInteger 64-bitowym i wartość nie są równe. |
| Inequality(UInt64, BigInteger) |
Zwraca wartość wskazującą, czy 64-bitowa liczba całkowita bez znaku i BigInteger wartość nie są równe. |
| LeftShift(BigInteger, Int32) |
BigInteger Przesuwa wartość określoną liczbę bitów po lewej stronie. |
| LessThan(BigInteger, BigInteger) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza niż inna BigInteger wartość. |
| LessThan(BigInteger, Int64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza niż 64-bitowa liczba całkowita ze znakiem. |
| LessThan(BigInteger, UInt64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza niż 64-bitowa liczba całkowita bez znaku. |
| LessThan(Int64, BigInteger) |
Zwraca wartość wskazującą, czy liczba całkowita ze znakiem BigInteger 64-bitowym jest mniejsza niż wartość. |
| LessThan(UInt64, BigInteger) |
Zwraca wartość wskazującą, czy 64-bitowa liczba całkowita bez znaku jest mniejsza niż BigInteger wartość. |
| LessThanOrEqual(BigInteger, BigInteger) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza, czy równa innej BigInteger wartości. |
| LessThanOrEqual(BigInteger, Int64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza niż lub równa 64-bitowej liczbą całkowitą ze znakiem. |
| LessThanOrEqual(BigInteger, UInt64) |
Zwraca wartość wskazującą BigInteger , czy wartość jest mniejsza niż lub równa 64-bitowej liczbą całkowitą bez znaku. |
| LessThanOrEqual(Int64, BigInteger) |
Zwraca wartość wskazującą, czy liczba całkowita ze znakiem BigInteger 64-bitowym jest mniejsza niż lub równa wartości. |
| LessThanOrEqual(UInt64, BigInteger) |
Zwraca wartość wskazującą, czy 64-bitowa liczba całkowita bez znaku jest mniejsza niż lub równa BigInteger wartości. |
| Modulus(BigInteger, BigInteger) |
Zwraca resztę, która wynika z dzielenia z dwoma określonymi BigInteger wartościami. |
| Multiply(BigInteger, BigInteger) |
Mnoży dwie określone BigInteger wartości. |
| OnesComplement(BigInteger) |
Zwraca bitowe uzupełnienie BigInteger wartości. |
| RightShift(BigInteger, Int32) |
BigInteger Przesuwa wartość określoną liczbę bitów po prawej stronie. |
| Subtraction(BigInteger, BigInteger) |
Odejmuje BigInteger wartość z innej BigInteger wartości. |
| UnaryNegation(BigInteger) |
Neguje określoną wartość BigInteger. |
| UnaryPlus(BigInteger) |
Zwraca wartość operandu BigInteger . (Znak operandu jest niezmieniony). |
| UnsignedRightShift(BigInteger, Int32) |
Przesuwa wartość w prawo o daną kwotę. |
Jawne implementacje interfejsu
| Nazwa | Opis |
|---|---|
| IAdditiveIdentity<BigInteger,BigInteger>.AdditiveIdentity |
Pobiera tożsamość addytywnego bieżącego typu. |
| IBinaryInteger<BigInteger>.GetByteCount() |
Pobiera liczbę bajtów, które zostaną zapisane w ramach elementu TryWriteLittleEndian(Span<Byte>, Int32). |
| IBinaryInteger<BigInteger>.GetShortestBitLength() |
Pobiera długość w bitach najkrótszej reprezentacji wartości bieżącej. |
| IBinaryInteger<BigInteger>.Log10(BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| IBinaryInteger<BigInteger>.TryReadBigEndian(ReadOnlySpan<Byte>, Boolean, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| IBinaryInteger<BigInteger>.TryReadLittleEndian(ReadOnlySpan<Byte>, Boolean, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| IBinaryInteger<BigInteger>.TryWriteBigEndian(Span<Byte>, Int32) |
Próbuje zapisać bieżącą wartość w formacie big-endian do danego zakresu. |
| IBinaryInteger<BigInteger>.TryWriteLittleEndian(Span<Byte>, Int32) |
Próbuje zapisać bieżącą wartość w formacie little-endian do danego zakresu. |
| IBinaryNumber<BigInteger>.AllBitsSet |
Pobiera wystąpienie typu binarnego, w którym są ustawione wszystkie bity. |
| IComparable.CompareTo(Object) |
Porównuje to wystąpienie z określonym obiektem i zwraca liczbę całkowitą wskazującą, czy wartość tego wystąpienia jest mniejsza niż, równa lub większa niż wartość określonego obiektu. |
| IMultiplicativeIdentity<BigInteger,BigInteger>.MultiplicativeIdentity |
Pobiera mnożenie tożsamości bieżącego typu. |
| INumber<BigInteger>.MaxNumber(BigInteger, BigInteger) |
Porównuje dwie wartości do obliczeń, które są większe i zwraca drugą wartość, jeśli jedno dane wejściowe to |
| INumber<BigInteger>.MinNumber(BigInteger, BigInteger) |
Porównuje dwie wartości do obliczeń, które są mniejsze i zwraca drugą wartość, jeśli jedno dane wejściowe to |
| INumber<BigInteger>.Sign(BigInteger) |
Oblicza znak wartości. |
| INumberBase<BigInteger>.IsCanonical(BigInteger) |
Określa, czy wartość znajduje się w jej kanonicznej reprezentacji. |
| INumberBase<BigInteger>.IsComplexNumber(BigInteger) |
Określa, czy wartość reprezentuje liczbę zespolonej. |
| INumberBase<BigInteger>.IsFinite(BigInteger) |
Określa, czy wartość jest skończona. |
| INumberBase<BigInteger>.IsImaginaryNumber(BigInteger) |
Określa, czy wartość reprezentuje czystą liczbę wyimaginowaną. |
| INumberBase<BigInteger>.IsInfinity(BigInteger) |
Określa, czy wartość jest nieskończona. |
| INumberBase<BigInteger>.IsInteger(BigInteger) |
Określa, czy wartość reprezentuje liczbę całkowitą. |
| INumberBase<BigInteger>.IsNaN(BigInteger) |
Określa, czy wartość to NaN. |
| INumberBase<BigInteger>.IsNegativeInfinity(BigInteger) |
Określa, czy wartość jest ujemną nieskończonością. |
| INumberBase<BigInteger>.IsNormal(BigInteger) |
Określa, czy wartość jest normalna. |
| INumberBase<BigInteger>.IsPositiveInfinity(BigInteger) |
Określa, czy wartość jest dodatnią nieskończonością. |
| INumberBase<BigInteger>.IsRealNumber(BigInteger) |
Określa, czy wartość reprezentuje liczbę rzeczywistą. |
| INumberBase<BigInteger>.IsSubnormal(BigInteger) |
Określa, czy wartość jest nienormalna. |
| INumberBase<BigInteger>.IsZero(BigInteger) |
Określa, czy wartość ma wartość zero. |
| INumberBase<BigInteger>.MaxMagnitudeNumber(BigInteger, BigInteger) |
Porównuje dwie wartości z obliczeniami o większej wielkości i zwraca drugą wartość, jeśli jedno dane wejściowe to |
| INumberBase<BigInteger>.MinMagnitudeNumber(BigInteger, BigInteger) |
Porównuje dwie wartości z obliczeniami o mniejszej wielkości i zwraca drugą wartość, jeśli jedno dane wejściowe to |
| INumberBase<BigInteger>.MultiplyAddEstimate(BigInteger, BigInteger, BigInteger) |
Oblicza oszacowanie ( |
| INumberBase<BigInteger>.Radix |
Pobiera podstawę (radix) dla typu. |
| INumberBase<BigInteger>.TryConvertFromChecked<TOther>(TOther, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| INumberBase<BigInteger>.TryConvertFromSaturating<TOther>(TOther, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| INumberBase<BigInteger>.TryConvertFromTruncating<TOther>(TOther, BigInteger) |
Reprezentuje dowolnie dużą liczbę całkowitą ze znakiem. |
| INumberBase<BigInteger>.TryConvertToChecked<TOther>(BigInteger, TOther) |
Próbuje przekonwertować wystąpienie bieżącego typu na inny typ, zgłaszając wyjątek przepełnienia dla wszystkich wartości, które mieszczą się poza dopuszczalnym zakresem bieżącego typu. |
| INumberBase<BigInteger>.TryConvertToSaturating<TOther>(BigInteger, TOther) |
Próbuje przekonwertować wystąpienie bieżącego typu na inny typ, saturując wszystkie wartości, które mieszczą się poza dopuszczalnym zakresem bieżącego typu. |
| INumberBase<BigInteger>.TryConvertToTruncating<TOther>(BigInteger, TOther) |
Próbuje przekonwertować wystąpienie bieżącego typu na inny typ, obcinając wszystkie wartości, które wykraczają poza reprezentowany zakres bieżącego typu. |
| ISignedNumber<BigInteger>.NegativeOne |
Pobiera wartość |