Home  |  Delphi .net Home  |  System.Math  |  Sign Method
  
Sign  
Method  
Returns an indication of the sign (polarity) of a number
Math Class
System NameSpace
CF1.  Function Sign ( Value : ShortInt ) : Integer; Static;
CF2.  Function Sign ( Value : SmallInt ) : Integer; Static;
CF3.  Function Sign ( Value : Integer ) : Integer; Static;
CF4.  Function Sign ( Value : Int64 ) : Integer; Static;
CF5.  Function Sign ( Value : Single ) : Integer; Static;
CF6.  Function Sign ( Value : Double ) : Integer; Static;
CF7.  Function Sign ( Value : Decimal ) : Integer; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns an indication of the sign of Value as follows :
 
Value < 0  Give -1
Value = 0  Give  0
Value > 0  Give +1
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Math
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  result : Integer;
begin
  result := System.Math.Sign(-22);
  Console.WriteLine('Sign(-22)    = {0}', result.ToString);

  result := System.Math.Sign(0);
  Console.WriteLine('Sign(0)      = {0}', result.ToString);

  result := System.Math.Sign(0.0001);
  Console.WriteLine('Sign(0.0001) = {0}', result.ToString);

  Console.ReadLine;
end.
   Sign(-22)    = -1
   Sign(0)      = 0
   Sign(0.0001) = 1
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author