C# BigInteger UnaryNegation

Description

BigInteger UnaryNegation Negates a specified BigInteger value.

Syntax

BigInteger.UnaryNegation has the following syntax.


public static BigInteger operator -(
  BigInteger value
)

Parameters

BigInteger.UnaryNegation has the following parameters.

  • value - The value to negate.

Returns

BigInteger.UnaryNegation method returns The result of the value parameter multiplied by negative one (-1).

Example


   /*from  w ww.  j a va 2 s  . c om*/
using System;
using System.IO;
using System.Numerics;

public class Example
{
   public static void Main()
   {
        BigInteger number = 123123123;
        
        Console.WriteLine(BigInteger.Negate(number));       
        Console.WriteLine(-number);                          
        Console.WriteLine(number * BigInteger.MinusOne); 
            
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex