Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/m68k/fpe Break a loop off to avoid a long loop even...
details: https://anonhg.NetBSD.org/src/rev/ae664ea46f92
branches: trunk
changeset: 786213:ae664ea46f92
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Apr 20 04:38:51 2013 +0000
description:
Break a loop off to avoid a long loop even if the precision is not enough.
diffstat:
sys/arch/m68k/fpe/fpu_exp.c | 9 ++++++---
sys/arch/m68k/fpe/fpu_hyperb.c | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diffs (66 lines):
diff -r fd8c95ff1f54 -r ae664ea46f92 sys/arch/m68k/fpe/fpu_exp.c
--- a/sys/arch/m68k/fpe/fpu_exp.c Sat Apr 20 03:37:55 2013 +0000
+++ b/sys/arch/m68k/fpe/fpu_exp.c Sat Apr 20 04:38:51 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_exp.c,v 1.6 2013/04/20 03:06:19 isaki Exp $ */
+/* $NetBSD: fpu_exp.c,v 1.7 2013/04/20 04:38:51 isaki Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@@ -32,10 +32,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.6 2013/04/20 03:06:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_exp.c,v 1.7 2013/04/20 04:38:51 isaki Exp $");
#include "fpu_emulate.h"
+/* The number of items to terminate the Taylor expansion */
+#define MAX_ITEMS (2000)
+
/*
* fpu_exp.c: defines fpu_etox(), fpu_etoxm1(), fpu_tentox(), and fpu_twotox();
*/
@@ -64,7 +67,7 @@
CPYFPN(&res, r);
k = 2;
- for (;; k++) {
+ for (; k < MAX_ITEMS; k++) {
/* s1 = s0 * x / k */
CPYFPN(&fe->fe_f1, &s0);
CPYFPN(&fe->fe_f2, &x);
diff -r fd8c95ff1f54 -r ae664ea46f92 sys/arch/m68k/fpe/fpu_hyperb.c
--- a/sys/arch/m68k/fpe/fpu_hyperb.c Sat Apr 20 03:37:55 2013 +0000
+++ b/sys/arch/m68k/fpe/fpu_hyperb.c Sat Apr 20 04:38:51 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_hyperb.c,v 1.10 2013/04/19 14:05:12 isaki Exp $ */
+/* $NetBSD: fpu_hyperb.c,v 1.11 2013/04/20 04:38:51 isaki Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@@ -57,10 +57,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.10 2013/04/19 14:05:12 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_hyperb.c,v 1.11 2013/04/20 04:38:51 isaki Exp $");
#include "fpu_emulate.h"
+/* The number of items to terminate the Taylor expansion */
+#define MAX_ITEMS (2000)
+
/*
* fpu_hyperb.c: defines the following functions
*
@@ -159,7 +162,7 @@
sign = 1; /* sign := (-1)^n */
- for (;;) {
+ for (; f < (2 * MAX_ITEMS); ) {
/* (f1 :=) s0 * x^2 */
CPYFPN(&fe->fe_f1, s0);
CPYFPN(&fe->fe_f2, &x2);
Home |
Main Index |
Thread Index |
Old Index