| Keyword | Abbreviation | Token (hex) | Version(s) | Classification |
| SGN | S{Shift+G} | B4 | 1.0+ | Function |
SGN( value )
| Parameters | Type | Legal Value(s) | Default Value | Note(s) |
| value | Numeric | any | | |
| Returns | Type | Value(s) | Note(s) |
| result | Floating-point | -1, 0, +1 | |
Calculate the arithmetic sign of a number.
The SGN function simply returns a result telling if the original value was positive (result = +1), negative (result = -1), or nuetral (result = 0); in particular it discards the magnitude of the original value. This is useful because multiplying (a presumably different value) by +1 or -1 won't change the magnitude, only (possibly) the sign. Useful for polar to rectangular conversion (among other things).
Not to be confused with the triginometric sine, which is quite different!
You will get TYPE MISMATCH ERROR with a string value.
© H2Obsession, 2014