Export (0) Print
Expand All

BigInteger Constructor (Single)

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

Namespace:  System.Numerics
Assemblies:   System.Runtime.Numerics (in System.Runtime.Numerics.dll)
  System.Numerics (in System.Numerics.dll)

new : 
        value:float32 -> BigInteger

Parameters

value
Type: System.Single

A single-precision floating-point value.

ExceptionCondition
OverflowException

The value of value is Single.NaN.

-or-

The value of value is Single.NegativeInfinity.

-or-

The value of value is Single.PositiveInfinity.

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

Because of the lack of precision of the Single data type, calling this constructor can result in data loss.

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

The following example illustrates the use of the BigInteger(Single) constructor to instantiate a BigInteger object. It also illustrates the loss of precision that may occur when you use the Single data type. A Single is assigned a large negative 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 Single object does not.

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

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1
Show:
© 2015 Microsoft