diff --git a/CHANGELOG.md b/CHANGELOG.md index 952157f1c..4d1bf6906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -[v1.18.0](https://github.com/boriel-basic/zxbasic/tree/v1.18.1) +[v1.18.1](https://github.com/boriel-basic/zxbasic/tree/v1.18.1) === + ! Fixes crash on simple cast from i32 to u32 and vice versa diff --git a/docs/overrides/stylesheets/extra.css b/docs/overrides/stylesheets/extra.css index 166c3ec81..3a81f3722 100644 --- a/docs/overrides/stylesheets/extra.css +++ b/docs/overrides/stylesheets/extra.css @@ -34,7 +34,7 @@ } /* Responsive adjustments for smaller screens */ -@media screen and (max-width: 768px) { +@media screen and (max-width: 1220px) { [data-md-color-scheme="default"] .md-header { height: 3.5rem; } @@ -107,7 +107,7 @@ } .md-header__button { - margin: 0; + margin: 2px; padding: 2px; } diff --git a/docs/sgn.md b/docs/sgn.md new file mode 100644 index 000000000..c314471c0 --- /dev/null +++ b/docs/sgn.md @@ -0,0 +1,34 @@ +# SGN + +## Syntax +```basic +SGN(expression) +``` + +## Description + +Returns the sign of a numeric expression as follows: +* -1 if the number is negative +* 0 if the number is zero +* 1 if the number is positive + +The returned value type is [byte](types.md#Byte). + +## Examples + +```basic +REM Print sign of different numbers +PRINT "Sign of -5 is "; SGN(-5) ' Prints -1 +PRINT "Sign of 0 is "; SGN(0) ' Prints 0 +PRINT "Sign of 3.14 is "; SGN(3.14) ' Prints 1 +``` + +## Remarks + +* This function is 100% Sinclair BASIC Compatible +* If the argument is an unsigned value, the result will always be either 0 or 1 +* Using SGN with string expressions will result in a compile-time error + +## See also + +* [ABS](abs.md)