|
From: Danny S. <dan...@cl...> - 2005-01-27 08:31:17
|
Greg Chicares wrote:
> How about this?
>
> static long double expm1l (long double x)
> {
> if (-M_LN2 < x && x < M_LN2)
> {
> x *= M_LOG2E;
> __asm__("f2xm1\n\t" : "=t" (x) : "0" (x));
> return x;
> }
> else
> return expl(x) - 1.0L;
> }
>
> It passes my unit tests with MinGW gcc-3.4.2 .
>
> The domain is (-M_LN2, +M_LN2) because F2XM1's input is
> constrained to (-1, +1). Maybe intel means [-1, +1], but
> their documentation is unclear as to whether the interval
> is open or not, so it's safer to assume it's open.
>
Simple
That works in my tests too. I also tried out using
"fldl2e\n\t"
"fmul %st(1)\n\t"
in the asm
to replace x *= M_LOG2E;
but at least with -O2 -fomit-frame-pointer, I couldn't see any perfomance
difference. (Using the M_LOG2E constant may be faster in loops if inline
version is visible)
BTW, do we need long double versions of the M_* defines to ensure enough
precision?
Will you update your patch on the Sourceforge patch tracker?
Danny
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> MinGW-users mailing list
> Min...@li...
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
|