Permalink
Browse files

Simplify ASDF definition and package forms.

Also updated the year in the copyright and added miscellaneous
FIXME statements.
  • Loading branch information...
1 parent 88ff9c0 commit bf31ebc4cefc1d9cca477e1cd4d5a0f98561f59f Thomas M. Hermann committed Dec 28, 2010
Showing with 40 additions and 39 deletions.
  1. +5 −3 defpackage.lisp
  2. +27 −20 error-analysis.lisp
  3. +6 −14 floating-point.asd
  4. +2 −2 predicates.lisp
View
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009, Thomas M. Hermann
+ Copyright (c) 2009,2010, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,9 @@
|#
-(common-lisp:defpackage :floating-point
+(in-package :common-lisp)
+
+(defpackage :floating-point
(:use :common-lisp)
(:export :*measure* :*epsilon* :*significant-figures*
;; Error analysis
@@ -46,4 +48,4 @@
:sigfig-equal
:norm-equal))
-(pushnew :floating-point common-lisp:*features*)
+(pushnew :floating-point *features*)
View
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009, Thomas M. Hermann
+ Copyright (c) 2009,2010, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@
|#
-(common-lisp:in-package :floating-point)
+(in-package :floating-point)
(defvar *measure* 1
"The default measure of the norm.")
@@ -74,30 +74,33 @@
(defmethod default-epsilon ((value float))
"Return a default epsilon value based on the floating point type."
(typecase value
- (short-float (* 2.0s0 short-float-epsilon))
- (single-float (* 2.0f0 single-float-epsilon))
- (double-float (* 2.0d0 double-float-epsilon))
- (long-float (* 2.0l0 long-float-epsilon))))
+ (short-float (* 2S0 short-float-epsilon))
+ (single-float (* 2F0 single-float-epsilon))
+ (double-float (* 2D0 double-float-epsilon))
+ (long-float (* 2L0 long-float-epsilon))))
(defmethod default-epsilon ((value complex))
"Return a default epsilon value based on the complex type."
(typecase value
- ((complex short-float) (* 2.0s0 short-float-epsilon))
- ((complex single-float) (* 2.0f0 single-float-epsilon))
- ((complex double-float) (* 2.0d0 double-float-epsilon))
- ((complex long-float) (* 2.0l0 long-float-epsilon))
+ ((complex short-float) (* 2S0 short-float-epsilon))
+ ((complex single-float) (* 2F0 single-float-epsilon))
+ ((complex double-float) (* 2D0 double-float-epsilon))
+ ((complex long-float) (* 2L0 long-float-epsilon))
(t 0)))
+;;; FIXME : Use the LOOP
(defmethod default-epsilon ((value list))
"Return the default epsilon based on contents of the list."
(reduce (lambda (x y) (max x (default-epsilon y)))
value :initial-value 0))
+;;; FIXME : Use the LOOP
(defmethod default-epsilon ((value vector))
"Return the default epsilon based on the contents of the vector."
(reduce (lambda (x y) (max x (default-epsilon y)))
value :initial-value 0))
+;;; FIXME : Use the LOOP
(defmethod default-epsilon ((value array))
"Return the default epsilon based on the contents of the array."
(reduce (lambda (x y) (max x (default-epsilon y)))
@@ -106,16 +109,18 @@
:displaced-to value)
:initial-value 0))
-;;; (RELATIVE-ERROR x y) => float
-;;; [NumAlgoC] : Definition 1.3, pg. 2
-;;; modified with Definition 1.1, pg. 1
-;;;
-;;; The definition of relative error in this routine is modified from
-;;; the Definition 1.3 in [NumAlgoC] for cases when either the exact
-;;; or the approximate value equals zero. According to Definition 1.3,
-;;; the relative error is identically equal to 1 in those cases. This
-;;; function returns the absolue error in those cases. This is more
-;;; useful for testing.
+#|
+ (RELATIVE-ERROR x y) => float
+ [NumAlgoC] : Definition 1.3, pg. 2
+ modified with Definition 1.1, pg. 1
+
+ The definition of relative error in this routine is modified from
+ the Definition 1.3 in [NumAlgoC] for cases when either the exact
+ or the approximate value equals zero. According to Definition 1.3,
+ the relative error is identically equal to 1 in those cases. This
+ function returns the absolue error in those cases. This is more
+ useful for testing.
+|#
(defun %relative-error (exact approximate)
"Return the relative error of the numbers."
(abs (if (or (zerop exact) (zerop approximate))
@@ -213,6 +218,7 @@ point value."
;;; (NORM data) => float
(defun %seq-1-norm (data)
"Return the Taxicab norm of the sequence."
+ ;; FIXME : Use the LOOP
(reduce (lambda (x y) (+ x (abs y)))
data :initial-value 0))
@@ -230,6 +236,7 @@ point value."
(defun %seq-inf-norm (data)
"Return the infinity, or maximum, norm of the sequence."
+ ;; FIXME : Use the LOOP
(reduce (lambda (x y) (max x (abs y)))
data :initial-value 0))
View
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009, Thomas M. Hermann
+ Copyright (c) 2009,2010, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,22 +34,14 @@
|#
-(common-lisp:defpackage #:floating-point-system
- (:use #:common-lisp #:asdf))
-
-(common-lisp:in-package #:floating-point-system)
+(in-package :asdf)
(defsystem :floating-point
:description "Floating point functions."
:version "Draft"
- :author "Thomas M. Hermann <tmh.public@gmail.com>"
+ :author "Thomas M. Hermann <thomas.m.hermann@odonata-research.com>"
:license "BSD"
:components
- ((:module
- floating-point
- :components
- ((:file "defpackage")
- (:file "error-analysis" :depends-on ("defpackage"))
- (:file "predicates"
- :depends-on ("defpackage"
- "error-analysis"))))))
+ ((:file "defpackage")
+ (:file "error-analysis" :depends-on ("defpackage"))
+ (:file "predicates" :depends-on ("error-analysis"))))
View
@@ -3,7 +3,7 @@
Floating Point Functions
- Copyright (c) 2009, Thomas M. Hermann
+ Copyright (c) 2009,2010, Thomas M. Hermann
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@
|#
-(common-lisp:in-package :floating-point)
+(in-package :floating-point)
(defvar *epsilon* nil
"The default error epsilon.")

0 comments on commit bf31ebc

Please sign in to comment.