Returns a value indicating the sign of the specified double.
- value
- A double whose sign is to be determined.
A int indicating the sign of value.
Number Description -1 value < 0. 0 value == 0. 1 value > 0.
Type Reason ArithmeticException value is equal to double.NaN.
Documentation for this section has not yet been entered.
The following example demonstrates using the Math.Sign(sbyte)(double) method.
C# Example
using System; public class MathSignExample { public static void Main() { Double d1 = Math.Sign(4.4); Double d2 = Math.Sign(0.0); Double d3 = Math.Sign(-4.5); Console.WriteLine("Math.Sign(4.4) returns {0}", d1); Console.WriteLine("Math.Sign(0.0) returns {0}", d2); Console.WriteLine("Math.Sign(-4.5) returns {0}", d3); } }The output is
Math.Sign(4.4) returns 1
Math.Sign(0.0) returns 0
Math.Sign(-4.5) returns -1
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0