[Nickle] nickle: Branch 'master' - 2 commits

Keith Packard keithp at keithp.com
Wed Jul 7 12:15:53 PDT 2010


 configure.in      |    2 +-
 debian/changelog  |   13 ++++++++++++-
 test/factorial.5c |   28 ++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

New commits:
commit 1491af33c3bca94c6bb604b483a5eabcf038eef1
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jul 7 15:12:21 2010 -0400

    Bump to version 2.70
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.in b/configure.in
index 81fd8a6..65063b4 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ dnl for licensing information.
 AC_PREREQ(2.59)
 
 AC_INIT([nickle],
-	2.69,
+	2.70,
 	[http://nickle.org],
 	nickle)
 
diff --git a/debian/changelog b/debian/changelog
index 6d0e977..3914abb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,17 @@
+nickle (2.70-1) unstable; urgency=low
+
+  * Make parse_csv_t type public
+  * Throw 'bad_csv_parse' exception on unclosed quotes
+  * Add factorial tests
+  * Repliace naïve factorial algorithm with the prime swing
+    algorithm defined by Peter Luschny
+  * Update to standard 3.8.4
+
+ -- Keith Packard <keithp at keithp.com>  Tue, 06 Jul 2010 01:22:30 -0400
+
 nickle (2.69-1) unstable; urgency=low
 
-  * Make debian build epend on libreadline-dev not libreadline5-dev.
+  * Make debian build depend on libreadline-dev not libreadline5-dev.
   * Get math-tables.5c built before tests are run
   * Fix trig boundary conditions.
   * Add tests for math functions.
commit 7334afef7a4235447e11a948a9d57c354dafac67
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jul 6 11:02:33 2010 -0400

    Test factorial function by comparing with Stirling approximation
    
    This checks larger factorial values for gross errors.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/test/factorial.5c b/test/factorial.5c
index b2589cc..3581ad1 100644
--- a/test/factorial.5c
+++ b/test/factorial.5c
@@ -28,6 +28,34 @@ void check_factorial(int max) {
      }
 }
 
+real stirling (real n)
+{
+    n = imprecise (n);
+    return sqrt (2 * pi * n) * (n / Math::e) ** n;
+}
+
+void check_one_stirling(int v) {
+	real s = stirling(v);
+	real f = v!;
+	real r = f/s;
+	real e = 0.1/v;
+	if (r < 1 || r > (1 + e)) {
+		printf("check failed %d! (was %d should be close to %g)\n",
+		       v, f, s);
+		++errors;
+	}
+}
+
+void check_stirling(int rep) {
+	real v = 13;
+	while (rep-- > 0) {
+		int iv = floor(v);
+		check_one_stirling(iv);
+		v = v * 3 + 2;
+	}
+}
+
+check_stirling(10);
 check_factorial(1000);
 
 exit (errors);


More information about the Nickle mailing list