Clint
Clint

Reputation: 9058

Does an assignment of a real to a variable starting with I convert to integer?

Does an assignment of a real to a variable starting with I convert to integer?

real vx;
vx = 2.59808
ix = vx

is ix == 2?

Upvotes: 2

Views: 137

Answers (2)

Dirk Vollmar
Dirk Vollmar

Reputation: 176229

As far as I know the type will be automatically converted.

You can turn of this error-prone behavior by specifying

IMPLICIT NONE

The "implicit none" statement forces the programmer to declare all variables. Otherwise the types will just be implicit and variables starting with i will be of type integer.

Upvotes: 3

Syed Tayyab Ali
Syed Tayyab Ali

Reputation: 3681

as far as i know you need to cast real into integer.

but i not sure, if it is allowed in your language.

Upvotes: -1

Related Questions