Math.Sign
using System; public class MainClass { public static void Main() { Console.WriteLine("Math.Sign(1) = {0}", Math.Sign(1)); Console.WriteLine("Math.Sign(-1) = {0}", Math.Sign(-1)); Console.WriteLine("Math.Sign(0) = {0}", Math.Sign(0)); } }