Sgn


Definition: Returns an integer indicating the sign of a number.

 

Quick: is that a negative number or a positive number? An easy way to verify that in Windows PowerShell is to use the System.Mathclass and the Signmethod. For example, this command uses the Sign method to determine the sign of -453:

 

$a = [math]: :sign(-453)

 

When you run this command and then echo back the value of $ a youshould get the following:

 

-1

 

If you check the sign of a positive number (e.g., 453) you should get back something like this (actually, you should get back something   exactlylike this):

 

1