[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: i386 extended vs. double precision math
Bruce Fletcher <bruce@homeperformance.com> wrote:
> This is the section of code which I am having trouble
> with. I don't know what platform this was written for,
> but apparently fpu_control.h is supposed to be a system
> header.
>
> /* FPU control. We MUST have only double precision
> (not extended precision) */
> #include <fpu_control.h>
Linux.
> static fpu_control_t fpu_round_double =
> (_FPU_DEFAULT & ~ _FPU_EXTENDED)|_FPU_DOUBLE;
> static fpu_control_t fpu_init;
> #define FPU_ROUND_DOUBLE {_FPU_GETCW(fpu_init); \
> _FPU_SETCW(fpu_round_double);}
> #define FPU_RESTORE {_FPU_SETCW(fpu_init);}
>
> Any idea how to get this running?
On FreeBSD/i386 this could be handled by fpgetprec(3) and fpsetprec(3),
however those seem to be missing from OpenBSD. You'll need to
implement those yourself through asm{}. That's ugly, but we're
firmly in MD territory here anyway. You can probably get all that's
needed from the definition of the FreeBSD macros:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/include/floatingpoint.h?rev=1.10&content-type=text/x-cvsweb-markup
--
Christian "naddy" Weisgerber naddy@mips.inka.de