NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-m68k/51645 (exponential and hyperbolic functions are slow on m68k FPU emulator)



It's a nice patch!
It's 10..100 times faster as you wrote.
The accuracy decreased slightly in extended precision but
I think it's not a big problem because faster is better.

I'll add the following diffs to your patch and commit.

--- fpu_exp.c	2016-12-02 15:50:41.000000000 +0900
+++ fpu_exp.c	2016-12-02 15:52:14.000000000 +0900
@@ -133,10 +133,11 @@
 		fp = fpu_etox_taylor(fe);
 		return fp;
 	}
+	/* extract k as integer format from fpn format */
 	j = FP_LG - fp->fp_exp;
 	if (j < 0) {
 		if (fp->fp_sign)
-			fpu_const(&fe->fe_f2, FPU_CONST_0);	/* k < -2^18 */
+			fp->fp_class = FPC_ZERO;		/* k < -2^18 */
 		else
 			fp->fp_class = FPC_INF;			/* k >  2^18 */
 		return fp;
--- fpu_hyperb.c	2016-11-28 13:55:22.000000000 +0900
+++ fpu_hyperb.c	2016-12-02 15:54:43.000000000 +0900
@@ -63,9 +63,6 @@
 
 #include "fpu_emulate.h"
 
-/* The number of items to terminate the Taylor expansion */
-#define MAX_ITEMS	(2000)
-
 /*
  * fpu_hyperb.c: defines the following functions
  *

---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index