Unary minus is being developed in version 1.23

master
bixb922 2024-05-02 09:29:57 -04:00
rodzic 12dfabab39
commit 90613a34bf
1 zmienionych plików z 1 dodań i 0 usunięć

@ -234,6 +234,7 @@ A viper ```int``` is not an object, and thus does not support methods such as ``
The \*\* operator (exponentiation, `__pow__`) is not implemented for viper ```int```.
In versions MicroPython 1.22 and prior, unary minus is not implemented, instead of `x=-a` use `x=0-a`. In version 1.23 the unary minus is being implemented, but not completely yet.
Be aware: Do not use shift left or right with a negative value, i.e. `x<<(-1)` or `x>>(-1)` should not be used because the result is undefined. This mirrors the C language definition for shifting. Unlike regular MicroPython, there is no check (no exception raised) for negative shift amounts.