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

Floor Function

JohnNichols
Valued Contributor III
1,102 Views
write(*,300)count,SUMDW1,floor(STRNS),CGT,YB-CGT,CGTLMT

the third element of the write statement prints as 0.00 instead of 30.00. STRNS has a value of 30.9

If I pull it out and set a variable first it prints as normal.  Is this expected?

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
1,094 Views

You will have to show the 300 FORMAT statement to make sense out of the behavior.

 

Jim

0 Kudos
JohnNichols
Valued Contributor III
1,082 Views
300 Format("                                  ",i2,"    ",F6.0,"        ",F3.0,"    ",F6.2,"    ",F6.2,"     ",F6.2) 
0 Kudos
JohnNichols
Valued Contributor III
1,080 Views

Floor function returns an integer,  I should have checked. 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,067 Views

Yes. So either change F3.0 to I3 or use

write(*,300)count,SUMDW1,real(floor(STRNS)),CGT,YB-CGT,CGTLMT

 

Jim Dempsey

0 Kudos
Reply