We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19c3ce0 commit 443459cCopy full SHA for 443459c
1 file changed
docs/sgn.md
@@ -0,0 +1,34 @@
1
+# SGN
2
+
3
+## Syntax
4
+```basic
5
+SGN(expression)
6
+```
7
8
+## Description
9
10
+Returns the sign of a numeric expression as follows:
11
+* -1 if the number is negative
12
+* 0 if the number is zero
13
+* 1 if the number is positive
14
15
+The returned value type is [byte](types.md#Byte).
16
17
+## Examples
18
19
20
+REM Print sign of different numbers
21
+PRINT "Sign of -5 is "; SGN(-5) ' Prints -1
22
+PRINT "Sign of 0 is "; SGN(0) ' Prints 0
23
+PRINT "Sign of 3.14 is "; SGN(3.14) ' Prints 1
24
25
26
+## Remarks
27
28
+* This function is 100% Sinclair BASIC Compatible
29
+* If the argument is an unsigned value, the result will always be either 0 or 1
30
+* Using SGN with string expressions will result in a compile-time error
31
32
+## See also
33
34
+* [ABS](abs.md)
0 commit comments