Precision problems of real numbers in Fortran [duplicate]
This question already has an answer here: Is floating point math broken? 30 answers I've been trying to use Fortran for my research project, with the GNU Fortran compiler (gfortran), latest version, but I've been encountering some problems in the way it processes real numbers. If you have for example the code: program test implicit none real :: y = 23.234, z z = y * 100000 write(*,*) y, z end program You'll get as output: 23.23999 2323400.0 I find this really strange. Can someone tell me what's exactly happening here? Looking at z I can see that y does retain its precision, so for calculations