Mono Class Library: System.Math Overview | Members

System.Math.Sign Method

Returns a value indicating the sign of the specified double. [Edit]

public static int Sign (double value)

Parameters

value
A double whose sign is to be determined. [Edit]

Returns

A int indicating the sign of value.

[The 'table' type of list has not been implemented in the ECMA stylesheet.] [Edit]

Exceptions

TypeReason
ArithmeticExceptionvalue is equal to double.NaN. [Edit]

Remarks

Documentation for this section has not yet been entered. [Edit]

Example

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

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0