Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: Word into Bytes.. why does this not work?? Kategorie: C-Control I V1.2/2.0 (von Achim - 17.05.2008 18:51)
 Als Antwort auf Word into Bytes.. why does this not work?? von Windt H.J. - 17.05.2008 18:35
Achim nutzt:  CC1-Station V1.1
> 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[1]
> put 0
> #start
> 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.

HTH

Bye
 Achim

 Antwort schreiben

Bisherige Antworten:

Re: Word into Bytes.. why does this not work?? (von Windt H.J. - 17.05.2008 19:31)
    Re: Word into Bytes.. why does this not work?? (von Achim - 17.05.2008 21:23)