gfortran - What are TRUE and FALSE constants (without the surrounding periods ('.')) in Fortran? -
consider below program
program print*,.true.,.false. print*,true,false end program this program prints different values in pgfortan , gfortran.
pgfortran output
t f 0.00000000 0.00000000 gfortran output
t f 4.59135442e-41 5.87982594e-39 question - logical constants .true. , .false. displayed t , f. these constants true , false, there no . around constants?
as suggested albert, true , false have no intrinsic meaning in fortran - ordinary identifiers must declared , assigned value. application uses module bunch of vendor-supplied declarations , these might include declarations of true , false named constants, on windows platform.
in example, true , false implicitly declared, uninitialized variables. since uninitialized, value undefined. implementations might give uninitialized variables 0 value, not. it's better not default values zero, aware of programming errors earlier.
and while we're on topic of logical values, i'll point an old post of mine on subject.
Comments
Post a Comment