This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: _FP_SETCW()
- To: Philippe Després <p0663835 at magellan dot umontreal dot ca>
- Subject: Re: _FP_SETCW()
- From: David Berthelot <davidb at Magma-DA dot COM>
- Date: Tue, 08 May 2001 11:02:07 -0700
- CC: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- References: <3AF82430.E896A05E@magellan.umontreal.ca>
Question about your problem:
Are you sure that the numbers are different, did you compare the binary
representations ?
May be it's the printf that has a different behavior depending if it's
VC++ one or glibc one ?
--
David
Philippe Després wrote:
> Hello,
>
> anyone know how to set the control word from fpu_control.h to obtain a
> floating point behavior like the one on Windows (VC++), i.e. that for a
> double,
>
> double x=cos(0.2);
>
> printf("%20.20f",x); on windows gives
> x=0.98006657784124163000 (zeros after the 17th digit)
>
> on linux, those zeros are filled with something else and my results
> depends on this...
>
> Actually, I use
>
> fpu_control_t fp_ctrl;
> fp_ctrl=(_FPU_DEFAULT & ~ _FPU_EXTENDED)|_FPU_DOUBLE;
> _FPU_SETCW(fp_ctrl);
>
> before calculation.
> Thanks
> Philippe