[interval] using crlibm for transcendental functions

I am using a custom rounding policy for transcendental functions, based on crlibm and defined in the manner of libs/numeric/interval/examples/transc.cpp In the documentation of crlibm, it is recommended to call the init function crlibm_init() before calling one of their transcendental functions. My question now is: does anybody know if calling this init function collides with any of the boost.numeric.interval internal algorithms? On i686 and amd64 crlibm_init() instructs the FPU not to use extended arithmetics: /* An init function which sets FPU flags when needed */ unsigned long long crlibm_init() { /* Set FPU flags to use double, not double extended, with rounding to nearest */ cw = (_FPU_DEFAULT & ~_FPU_EXTENDED)|_FPU_DOUBLE; _FPU_SETCW(cw); ... } Is it necessary to reset the old state after a call of a crlibm function, for correct interval arithmetics, or is one call of crlibm_init() for the whole program sufficient? Thanks, Tobias Munk --------------------------------- NEU: Fragen stellen - Wissen, Meinungen und Erfahrungen teilen. Jetzt auf Yahoo! Clever.

Le jeudi 25 janvier 2007 à 10:25 +0100, Tobias Munk a écrit :
I am using a custom rounding policy for transcendental functions, based on crlibm and defined in the manner of
libs/numeric/interval/examples/transc.cpp
In the documentation of crlibm, it is recommended to call the init function crlibm_init() before calling one of their transcendental functions. My question now is: does anybody know if calling this init function collides with any of the boost.numeric.interval internal algorithms?
If you are using crlibm functions outside of the interval functions, you can use a single crlibm_init for your whole program, as the interval functions do not assume anything about the state of the floating-point unit. Interval functions, however, relies on a special rounding mode. So, at the entry points of your policy, the rounding mode may not be what crlibm expects, so crlibm_init has to be called in your policy functions. And you have to call crlibm_exit to restore the rounding mode before they return, as the interval computations may not be finished yet. Best regards, Guillaume
participants (2)
-
Guillaume Melquiond
-
Tobias Munk