Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Intel Fortran compiler

ksasidhar
Beginner
465 Views

Hello,

I am using intel fortran 10.0.023 for my simulations. I am trying to carry out specific computation which works on few computers and does not work on others. The statement is as follows.

DO i=1,3
IF (position(i) == TWOPI) THEN
position(i) = TWOPI - 1E-6
END IF
END DO

Can you please let me know ifthere is anythingto be changed here?

Thanks in advance.

Regards,

Sasidhar

0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
465 Views

Sasidhar,

Is position real(4) or real(8)?
is TWOPI real(4) or real(8)?

If TWOPI = 3.14159..., is 3.14159... a single precisionor double precision constant? (Match the literal type with the variable type as constants are not promoted)

1E-6 is single precision. Subtracting a 1E-6 from a 3E+0 will require 7 digits of precision which are not available in single precision.

If position and TWOPI are real(8) then use 1D-6 for the literal or perhapse you are looking for

position(i) = TWOPI- TINY(TWOPI)

This will produce the largest number less than TWOPI representable in the precision of what is used for TWOPI. (Hopefully position is the same precision as TWOPI).

Jim Dempsey

0 Kudos
Reply