Re: Change FPU round mode



On Nov 1, 7:20 pm, Yipkei Kwok <yipkeik...@xxxxxxxxx> wrote:
Hi,

Here is my system specification.

Intel P4 Xeon
CentOS 5.3
Linux kernel 2.6.18-128.1.6.el5
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)

You want to update ASAP. 4.1.2 is too old and broken.

The default x87 FPU rounding mode is `round to the nearest'.

Is there any Fortran command that I can use to change the rounding
mode to `round to 0'?

Not with gfortran. gfortran doesn't support the IEEE 754 intrinsic
module, yet.

But if such a command is not available, I know how to change the
rounding mode using assembly instructions. Is there any way to inline
assembly code in Fortran code with the gfortran compiler?

Newer versions of gfortran support the ISO C binding facility. You
could bind to the fenv functions to toggle the rounding mode.
gfortran
does not support in-line assembly. Also note, that at least constant
folding assumed round-to-nearest and you can change that unless you
hack on the source code and I suspect that libgfortran assumes
round-to-nearest.

Please feel free to provide pointer to locations where I can find more
information.

UTSL.

--
steve
.