C# BigInteger Explicit(Single to BigInteger)
Description
BigInteger Explicit(Single to BigInteger)
Defines
an explicit conversion of a Single object to a BigInteger value.
Syntax
BigInteger.Explicit(Single to BigInteger)
has the following syntax.
public static explicit operator BigInteger (
float value
)
Parameters
BigInteger.Explicit(Single to BigInteger)
has the following parameters.
value
- The value to convert to a BigInteger.
Returns
BigInteger.Explicit(Single to BigInteger)
method returns An object that contains the value of the value parameter.
Example
/* w w w .ja va 2 s .com*/
using System;
using System.IO;
using System.Numerics;
public class Example
{
public static void Main()
{
float[] singles = { Single.MinValue, Single.MaxValue, Single.PositiveInfinity,
Single.NegativeInfinity, Single.NaN };
BigInteger number;
Console.WriteLine("{0,37} {1,37}\n", "Single", "BigInteger");
foreach (float value in singles)
{
try {
number = (BigInteger) value;
Console.WriteLine("{0,37} {1,37}", value, number);
}
catch (OverflowException) {
Console.WriteLine("{0,37} {1,37}", value, "OverflowException");
}
}
}
}
The code above generates the following result.