C# Tutorial C# Advanced C# Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

C# - Math BitDecrement() Method



The C# Math BitDecrement() method returns the next smallest value that compares less than the argument. In special cases it returns the following:

  • If the argument is NaN, the method returns NaN.
  • If the argument is NegativeInfinity, the method returns NegativeInfinity.

Syntax

public static double BitIncrement (double arg);

Parameters

arg Specify the value to decrement.

Return Value

Returns the next smallest value that compares less than the argument.

Example:

In the example below, BitDecrement() method returns the next smallest value that compares less than the argument.

using System;

class MyProgram {
  static void Main(string[] args) {
    Console.WriteLine(Math.BitDecrement(2)); 
    Console.WriteLine(Math.BitDecrement(10.1)); 
    Console.WriteLine(Math.BitDecrement(32.23));  
  }
}

The output of the above code will be:

1.9999999999999998
10.099999999999998
32.22999999999999

❮ C# Math Methods

5