There may be something wrong with the rest of your code, please post it.

Go through your code slowly to find the issue:

With this line, you can manually find the reason C = 16
var dword c= (a*b)/1000

200*5000 = hex 0xF4240, or as a word it is truncated to 0x4240
0x4240 = 16960
16960 / 1000 = 16

The compiler did what it is supposed to do.

what result do you get with (dword(a)*b)/1000? Is your casting correct in 
the rest of the program?

Matt.


On Sunday, March 31, 2019 at 5:27:06 PM UTC-4, Rian De Rous wrote:
>
> Casting one or both variables when performing the multiply operation does 
> not fix this. 
>
> Tried 
>
> var word a = 5000
> var word b = 200
> var dword c
>
>
> -- tried this, but none of these produce the right output on the display
> c = a*b/1000
> c = dword(a)*b/1000  
> c = a*dword(b)/1000 
> c = dword(a*b)/1000
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to