Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOGICAL Expression 1

Status
Not open for further replies.

Panavia

Technical User
Nov 14, 2010
15
DE
Hi,

I'm still working on the translation of some Fortran code peaces into Visual Basic 2010 and tripped over an expression which doesn't make sense to me:

Code:
PARAMETER(IWINDO=4)
LOGICAL LODD
LODD=(IWINDO/2)*2.NE.IWINDO

If(LODD) THEN
...
ENDIF

For my understaning "LODD" is a boolean which will be true if "IWINDO" is not equal to "(IWINDO/2)*2. That doesn't make sense to divide by 2 an then multiply by 2 again, or does it?
Or is there some Fortran typical consideration I'm missing?
The code is from an official agancy and a simple mathematical mistake like that shouldn't be there.

Thanks, Tobias
 
Integer division in Fortran (examples):
5/2 = 2
4/2 = 2
3/2 = 1
2/2 = 1
ans so on...
So (5/2)*2 = 4 and it's not a trivial code ;)

 
Ah, I totally missed the integer considerations.
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top