INFO - FAQ - CC2-Forum - CCPro-Forum
> Why does the following program not work??|
It "works" for me. Why do you ask? Do you not get what you expected? Well, then your expectations weren't correct ... ;-)
> define x word
> put 0
> x = -1
> print x
> print x / 256
What do you get here? Without testing I'd expect the output 0. Because -1 divided by 256 is the same as 1 divided by 256 just with a minus sign in front. (Division does take the sign into account)
1/256 is 0 since we have an integer division and not float. -0 prints as 0.
> print x mod 255
What do you get here? Without testing I'd expect the output -1.
> print (x and &hff00) shr 8
Totally different operation unless x is positive.
| Antwort schreiben|