[Commit] nickle math.5c,1.36,1.37 rational.c,1.27,1.28

Keith Packard commit at keithp.com
Mon Sep 15 19:18:32 PDT 2003


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv9232

Modified Files:
	math.5c rational.c 
Log Message:
Speed up detection of large fractional part in rational printing.  Speed up rational power by doing only a single GCD

Index: math.5c
===================================================================
RCS file: /local/src/CVS/nickle/math.5c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- math.5c	2 Jun 2003 03:31:02 -0000	1.36
+++ math.5c	16 Sep 2003 01:18:30 -0000	1.37
@@ -817,6 +817,8 @@
 	real    result;
 	if (is_int (b))
 	{
+	    if (!is_int (a) && is_rational (a))
+		return pow (numerator(a), b) / pow (denominator (a), b);
 	    int flip = 0;
 
 	    if (b < 0)

Index: rational.c
===================================================================
RCS file: /local/src/CVS/nickle/rational.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- rational.c	21 Jul 2003 22:22:10 -0000	1.27
+++ rational.c	16 Sep 2003 01:18:30 -0000	1.28
@@ -711,6 +711,8 @@
 	    return;
 	}
 	offset++;
+	if (prec >= 0 && offset > prec)
+	    break;
 	nden = NaturalDivide (nden, g, &rem);
     }
     if (prec >= 0 && offset >= prec)




More information about the Commit mailing list