C# - Math BitIncrement() Method
The C# Math BitIncrement() method returns the next largest value that compares greater than the argument. In special cases it returns the following:
- If the argument is NaN, the method returns NaN.
- If the argument is PositiveInfinity, the method returns PositiveInfinity.
Syntax
public static double BitIncrement (double arg);
Parameters
arg |
Specify the value to increment. |
Return Value
Returns the next largest value that compares greater than the argument.
Example:
In the below example, BitIncrement() method returns the next largest value that compares greater than the argument.
using System; class MyProgram { static void Main(string[] args) { Console.WriteLine(Math.BitIncrement(2)); Console.WriteLine(Math.BitIncrement(10.1)); Console.WriteLine(Math.BitIncrement(32.23)); } }
The output of the above code will be:
2.0000000000000004 10.100000000000001 32.230000000000004
❮ C# Math Methods