C# BigInteger BigInteger(Int64)

Description

BigInteger BigInteger(Int64) Initializes a new instance of the BigInteger structure using a 64-bit signed integer value.

Syntax

BigInteger.BigInteger(Int64) has the following syntax.


public BigInteger(
  long value
)

Parameters

BigInteger.BigInteger(Int64) has the following parameters.

  • value - A 64-bit signed integer.

Example


using System;/*ww w  . jav  a 2s.co m*/
using System.Numerics;

public class Example
{
   public static void Main()
   {
        long[] longs = { Int64.MinValue, -123123, -189, 0, 17, 123123,
                         Int64.MaxValue };
        BigInteger constructed, assigned;
        
        foreach (long number in longs)
        {
           constructed = new BigInteger(number);
           assigned = number;
           Console.WriteLine("{0} = {1}: {2}", constructed, assigned, 
                             constructed.Equals(assigned)); 
        }                                                  
                                             

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex