This is a field in C# that represents negative infinity. It is constant. One way to get the value of this constant is by dividing a negative number by zero.
public const double NegativeInfinity = -Infinity;
None.
This field has the value negative infinity (-Infinity).
// use Systemusing System;// create classclass DoubleNegativeInfinity{// main methodstatic void Main(){// print field valueConsole.WriteLine(Double.NegativeInfinity);// check if negative infinitystring result1 = -23/0.0 == Double.NegativeInfinity ? "Negative Infinity": "Not Negative Infinity";Console.WriteLine(result1);// check if negative infinitystring result2 = 23/0.0 == Double.NegativeInfinity ? "Negative Infinity": "Not Negative Infinity";Console.WriteLine(result2);}}
Line 10: We print the value of the field Double.NegativeInfinity
.
Line 13 and line 20: We check if -23/0.0
23/0.0
are negative infinity. If true, we print that it is, else we print otherwise to the console.