This documentation is archived and is not being maintained.

BigInteger Constructor (Double)

Initializes a new instance of the BigInteger structure using a double-precision floating-point value.

Namespace:  System.Numerics
Assembly:  System.Numerics (in System.Numerics.dll)

public:
BigInteger(
	double value
)

Parameters

value
Type: System::Double
A double-precision floating-point value.

ExceptionCondition
OverflowException

The value of value is Double::NaN.

-or-

The value of value is Double::NegativeInfinity.

-or-

The value of value is Double::PositiveInfinity.

Any fractional part of the value parameter is truncated when instantiating a BigInteger object.

Because of the lack of precision of the Double data type, calling this constructor can cause data loss.

The BigInteger value that results from calling this constructor is identical to the value that results from explicitly assigning a Double value to a BigInteger.

The following example illustrates the use of the BigInteger(Double) constructor to instantiate a BigInteger object. It also illustrates the loss of precision that may occur when you use the Double data type. A Double is assigned a large value, which is then assigned to a BigInteger object. As the output shows, this assignment involves a loss of precision. Both values are then incremented by one. The output shows that the BigInteger object reflects the changed value, whereas the Double object does not.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: