[oct-scm] [oct-git]OCT: A portable Lisp implementation for quad-double precision floats branch master updated. d2650578689f51edbdc8f0c588fcf330134490c6
Raymond Toy
rtoy at common-lisp.net
Mon Mar 14 12:45:22 UTC 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OCT: A portable Lisp implementation for quad-double precision floats".
The branch, master has been updated
via d2650578689f51edbdc8f0c588fcf330134490c6 (commit)
via d6439bd96cf670d4b164cb78dff2358293539c83 (commit)
from 8ade177a0ce9bbb89b963ff29e46f38f377e9530 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d2650578689f51edbdc8f0c588fcf330134490c6
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Mon Mar 14 08:44:47 2011 -0400
Move +pi+ and friends to its own file.
qd-const2.lisp:
o New file containing +pi+ and friends
qd-methods.lisp:
o Removed constants.
oct.asd:
o Add qd-const2.lisp
diff --git a/oct.asd b/oct.asd
index b1c41f2..89b56ee 100644
--- a/oct.asd
+++ b/oct.asd
@@ -52,6 +52,7 @@
:depends-on ("qd" "qd-const"))
(:file "qd-class"
:depends-on ("qd-fun"))
+ (:file "qd-const2" :depends-on ("qd-class"))
(:file "qd-methods"
:depends-on ("qd-class"))
(:file "qd-reader"
diff --git a/qd-const2.lisp b/qd-const2.lisp
new file mode 100644
index 0000000..2ad911d
--- /dev/null
+++ b/qd-const2.lisp
@@ -0,0 +1,84 @@
+;;;; -*- Mode: lisp -*-
+;;;;
+;;;; Copyright (c) 2007, 2008, 2011 Raymond Toy
+;;;;
+;;;; Permission is hereby granted, free of charge, to any person
+;;;; obtaining a copy of this software and associated documentation
+;;;; files (the "Software"), to deal in the Software without
+;;;; restriction, including without limitation the rights to use,
+;;;; copy, modify, merge, publish, distribute, sublicense, and/or sell
+;;;; copies of the Software, and to permit persons to whom the
+;;;; Software is furnished to do so, subject to the following
+;;;; conditions:
+;;;;
+;;;; The above copyright notice and this permission notice shall be
+;;;; included in all copies or substantial portions of the Software.
+;;;;
+;;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+;;;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+;;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+;;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+;;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+;;;; OTHER DEALINGS IN THE SOFTWARE.
+
+(in-package #:oct)
+
+(defconstant +pi+
+ (make-instance 'qd-real :value octi:+qd-pi+)
+ "Pi represented as a QD-REAL")
+
+(defconstant +pi/2+
+ (make-instance 'qd-real :value octi:+qd-pi/2+)
+ "Pi/2 represented as a QD-REAL")
+
+(defconstant +pi/4+
+ (make-instance 'qd-real :value octi:+qd-pi/4+)
+ "Pi/4 represented as a QD-REAL")
+
+(defconstant +2pi+
+ (make-instance 'qd-real :value octi:+qd-2pi+)
+ "2*pi represented as a QD-REAL")
+
+(defconstant +log2+
+ (make-instance 'qd-real :value octi:+qd-log2+)
+ "Natural log of 2 represented as a QD-REAL")
+
+;; How do we represent infinity for a QD-REAL? For now, we just make
+;; the QD-REAL whose most significant part is infinity. Currently
+;; only supported on CMUCL.
+#+cmu
+(defconstant +quad-double-float-positive-infinity+
+ (make-instance 'qd-real :value (make-qd-d ext:double-float-positive-infinity))
+ "One representation of positive infinity for QD-REAL")
+
+#+cmu
+(defconstant +quad-double-float-negative-infinity+
+ (make-instance 'qd-real :value (make-qd-d ext:double-float-negative-infinity))
+ "One representation of negative infinity for QD-REAL")
+
+(defconstant +most-positive-quad-double-float+
+ (make-instance 'qd-real
+ :value (octi::%make-qd-d most-positive-double-float
+ (cl:scale-float most-positive-double-float (cl:* 1 -53))
+ (cl:scale-float most-positive-double-float (cl:* 2 -53))
+ (cl:scale-float most-positive-double-float (cl:* 3 -53))))
+ "Most positive representable QD-REAL")
+
+(defconstant +least-positive-quad-double-float+
+ (make-instance 'qd-real
+ :value (make-qd-d least-positive-double-float))
+ "Least positive QD-REAL")
+
+;; Not sure this is 100% correct, but I think if the first component
+;; is any smaller than this, the last component would no longer be a
+;; normalized double-float.
+(defconstant +least-positive-normalized-quad-double-float+
+ (make-instance 'qd-real
+ :value (make-qd-d (cl:scale-float least-positive-normalized-double-float (cl:* 3 53))))
+ "Least positive normalized QD-REAL")
+
+(defconstant +qd-real-one+
+ (make-instance 'qd-real :value (make-qd-d 1d0))
+ "QD-REAL representation of 1")
diff --git a/qd-methods.lisp b/qd-methods.lisp
index 966d85f..814672c 100644
--- a/qd-methods.lisp
+++ b/qd-methods.lisp
@@ -25,65 +25,6 @@
(in-package #:oct)
-(defconstant +pi+
- (make-instance 'qd-real :value octi:+qd-pi+)
- "Pi represented as a QD-REAL")
-
-(defconstant +pi/2+
- (make-instance 'qd-real :value octi:+qd-pi/2+)
- "Pi/2 represented as a QD-REAL")
-
-(defconstant +pi/4+
- (make-instance 'qd-real :value octi:+qd-pi/4+)
- "Pi/4 represented as a QD-REAL")
-
-(defconstant +2pi+
- (make-instance 'qd-real :value octi:+qd-2pi+)
- "2*pi represented as a QD-REAL")
-
-(defconstant +log2+
- (make-instance 'qd-real :value octi:+qd-log2+)
- "Natural log of 2 represented as a QD-REAL")
-
-;; How do we represent infinity for a QD-REAL? For now, we just make
-;; the QD-REAL whose most significant part is infinity. Currently
-;; only supported on CMUCL.
-#+cmu
-(defconstant +quad-double-float-positive-infinity+
- (make-instance 'qd-real :value (make-qd-d ext:double-float-positive-infinity))
- "One representation of positive infinity for QD-REAL")
-
-#+cmu
-(defconstant +quad-double-float-negative-infinity+
- (make-instance 'qd-real :value (make-qd-d ext:double-float-negative-infinity))
- "One representation of negative infinity for QD-REAL")
-
-(defconstant +most-positive-quad-double-float+
- (make-instance 'qd-real
- :value (octi::%make-qd-d most-positive-double-float
- (cl:scale-float most-positive-double-float (cl:* 1 -53))
- (cl:scale-float most-positive-double-float (cl:* 2 -53))
- (cl:scale-float most-positive-double-float (cl:* 3 -53))))
- "Most positive representable QD-REAL")
-
-(defconstant +least-positive-quad-double-float+
- (make-instance 'qd-real
- :value (make-qd-d least-positive-double-float))
- "Least positive QD-REAL")
-
-;; Not sure this is 100% correct, but I think if the first component
-;; is any smaller than this, the last component would no longer be a
-;; normalized double-float.
-(defconstant +least-positive-normalized-quad-double-float+
- (make-instance 'qd-real
- :value (make-qd-d (cl:scale-float least-positive-normalized-double-float (cl:* 3 53))))
- "Least positive normalized QD-REAL")
-
-(defconstant +qd-real-one+
- (make-instance 'qd-real :value (make-qd-d 1d0))
- "QD-REAL representation of 1")
-
-
(defmethod make-qd ((x cl:rational))
;; We should do something better than this.
(make-instance 'qd-real :value (rational-to-qd x)))
commit d6439bd96cf670d4b164cb78dff2358293539c83
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Mon Mar 14 08:43:05 2011 -0400
Fix typo; update required accuracy.
o The names of the elliptic functions changed and we forgot to update
the tests to use the new names.
o Reduce required accuracy of some tests.
diff --git a/rt-tests.lisp b/rt-tests.lisp
index 129506a..c624f4a 100644
--- a/rt-tests.lisp
+++ b/rt-tests.lisp
@@ -966,7 +966,7 @@
for n = (random 1d0)
for epi = (elliptic-pi n (/ pi 2) 0)
for true = (/ pi (* 2 (sqrt (- 1 n))))
- for result = (check-accuracy 49 epi true)
+ for result = (check-accuracy 47 epi true)
unless (eq nil result)
append (list (list (list k n) result)))
nil)
@@ -976,7 +976,7 @@
for n = (random #q1)
for epi = (elliptic-pi n (/ (float-pi n) 2) 0)
for true = (/ (float-pi n) (* 2 (sqrt (- 1 n))))
- for result = (check-accuracy 209 epi true)
+ for result = (check-accuracy 208 epi true)
unless (eq nil result)
append (list (list (list k n) result)))
nil)
@@ -1073,7 +1073,7 @@
;; sqrt(2*K/%pi) = theta3(0,q)
(loop for k from 0 below 100
for m = (random 1d0)
- for t3 = (theta3 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-3 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (elliptic-k m)) (float-pi m)))
for result = (check-accuracy 51 t3 true)
when result
@@ -1085,7 +1085,7 @@
;; sqrt(2*K/%pi) = theta3(0,q)
(loop for k from 0 below 100
for m = (random #q1)
- for t3 = (theta3 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-3 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (elliptic-k m)) (float-pi m)))
for result = (check-accuracy 206 t3 true)
when result
@@ -1097,7 +1097,7 @@
;; sqrt(2*sqrt(m)*K/%pi) = theta2(0,q)
(loop for k from 0 below 100
for m = (random 1d0)
- for t3 = (theta2 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-2 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (sqrt m) (elliptic-k m)) (float-pi m)))
for result = (check-accuracy 49 t3 true)
when result
@@ -1109,7 +1109,7 @@
;; sqrt(2*sqrt(m)*K/%pi) = theta2(0,q)
(loop for k from 0 below 100
for m = (random #q1)
- for t3 = (theta2 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-2 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (sqrt m) (elliptic-k m)) (float-pi m)))
for result = (check-accuracy 206 t3 true)
when result
@@ -1121,7 +1121,7 @@
;; sqrt(2*sqrt(1-m)*K/%pi) = theta2(0,q)
(loop for k from 0 below 100
for m = (random 1d0)
- for t3 = (theta4 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-4 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (sqrt (- 1 m)) (elliptic-k m))
(float-pi m)))
for result = (check-accuracy 49 t3 true)
@@ -1134,7 +1134,7 @@
;; sqrt(2*sqrt(1-m)*K/%pi) = theta2(0,q)
(loop for k from 0 below 100
for m = (random #q1)
- for t3 = (theta4 0 (elliptic-nome m))
+ for t3 = (elliptic-theta-4 0 (elliptic-nome m))
for true = (sqrt (/ (* 2 (sqrt (- 1 m)) (elliptic-k m))
(float-pi m)))
for result = (check-accuracy 204 t3 true)
-----------------------------------------------------------------------
Summary of changes:
oct.asd | 1 +
qd-const2.lisp | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
qd-methods.lisp | 59 --------------------------------------
rt-tests.lisp | 16 +++++-----
4 files changed, 93 insertions(+), 67 deletions(-)
create mode 100644 qd-const2.lisp
hooks/post-receive
--
OCT: A portable Lisp implementation for quad-double precision floats
More information about the oct-cvs
mailing list