strange equalisation?

Ziltard
04-05-2003, 10:43 AM
Here is a direct cut'n-paste from my "immediat window"

?FrmMapEditor2.Height \ (Screen.TwipsPerPixelX * 32)
7
?(Screen.TwipsPerPixelX * 32)
480
?7*(screen.TwipsPerPixelX*32)
3360
?frmMapEditor2.Height \ (Screen.TwipsPerPixelX * 32) * (Screen.TwipsPerPixelX * 32)
0


Can somebody tell me why the last result is zero?

Robse
04-05-2003, 01:15 PM
Either

1. Because frmMapEditor2.Height < (Screen.TwipsPerPixelX * 32) * (Screen.TwipsPerPixelX * 32)

or

2. Because frmMapEditor2.Height = 0

Compare

?5\6

and

?5/6

Ziltard
04-05-2003, 03:37 PM
Well, sorry boy, neither of them whas right.

It was because of the brackets. (for some reason it is always the brackets :P)
"*" is above "/" (and" \") so I had to add extra brackets to solve the problem.

Appreciate your reply though :D

Robse
04-05-2003, 04:03 PM
You are right about the precedence but exactly for this reason
will the outcome of an expression

TermA \ TermB

be equal to 0 only if either TermA < TermB or if TermA = 0,
if the terms contain operators of precedence no lower than
that of integer division, which is the case in your example.
(Well really correct would be the absolute terms)

By the way "/" has the same precedence as "*".

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum