Does "gfortran -O0" truncate floating point numbers to their expected precision?

Guan Xin guanx.bac@gmail.com
Wed Jul 10 12:22:00 GMT 2013


On Wed, 03 Jul 2013 08:04:59 -0400, Tim Prince <n8tm@aol.com> wrote:
> This doesn't look to me like F77, although it contains some F66.

Sorry, I write broken Fortran.

>
> If you are using 32-bit gfortran, the i486 code with x87 instructions is particularly prone to this kind of problem. Did you try -march=native, or, if using an extremely old CPU, -ffloat-store?
>
> --
> Tim Prince

I am using gfortran for x86 and x86_64 and got similar problems on both.
Met this problem when I used "-march=native -O4". Problem disappeared
with "-march=native -O4 -ffloat-store".
Thank you for mentioning "-ffloat-store". This is exactly what I was
looking for.

BTW, The performance impact is significant. Now I have modified my
algorithm so that it does not rely on the precision given by
-ffloat-store.

Guan



More information about the Gcc-help mailing list