Skip to content

Commit ab73949

Browse files
authored
Merge pull request #988 from boriel-basic/docs
Adds SGN.md page
2 parents d38a536 + 443459c commit ab73949

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[v1.18.0](https://github.com/boriel-basic/zxbasic/tree/v1.18.1)
1+
[v1.18.1](https://github.com/boriel-basic/zxbasic/tree/v1.18.1)
22
===
33
+ ! Fixes crash on simple cast from i32 to u32 and vice versa
44

docs/overrides/stylesheets/extra.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535

3636
/* Responsive adjustments for smaller screens */
37-
@media screen and (max-width: 768px) {
37+
@media screen and (max-width: 1220px) {
3838
[data-md-color-scheme="default"] .md-header {
3939
height: 3.5rem;
4040
}
@@ -107,7 +107,7 @@
107107
}
108108

109109
.md-header__button {
110-
margin: 0;
110+
margin: 2px;
111111
padding: 2px;
112112
}
113113

docs/sgn.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
```basic
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

Comments
 (0)