Commit 5c3df410 authored by Marco Antoniotti's avatar Marco Antoniotti

Added a few little things fixed other ones. This is just a checkpoint commit.

parent d848e383
......@@ -4,3 +4,4 @@ docs/
tmp/
.bin/
.cmbin/
.iabin/
......@@ -20,6 +20,7 @@ indicating the single argument, and dyadic ones have two, indicating
both arguments. E.g.,
Monadic minus: -.
Dyadic minus: .-.
All fixed arity generic functions also have an optional argument
......@@ -64,6 +65,9 @@ argument as the optional one.
"IS-INFINITY"
"INFINITY-P"
"IS-FINITE"
"FINITE-P"
)
(:export
......
......@@ -23,7 +23,7 @@
(:default-initargs :arguments () :operator nil)
(:documentation "The Undefined Operation Condition.
An ERROR that is generated when a give operation is not (yet) defined.")
An ERROR that is generated when a given operation is not (yet) defined.")
)
......@@ -45,6 +45,19 @@ An ERROR that is generated when a give operation is not (yet) defined.")
;;; ============================
;;; Predicates on numbers.
;;; ----------------------
(defun is-finite (x)
(declare (type real x))
(cl:< +negative-infinity+ x +positive-infinity+))
(defun finite-p (x)
(declare (type real x))
(is-finite x))
;;; Boolean Operations
;;; ------------------
......@@ -782,7 +795,25 @@ error types than the TYPE-ERROR mentioned in the ANSI standard.
(defgeneric .gcd. (n m &optional r)
(:documentation "The dyadic GCD operation.
Returns the greatest common divisor of N and M, possibly
modifying R. If R is modified than it is returned as the result of
the operation.
Arguments and Values:
N : a 'divisible' object.
M : a 'divisible' object.
R : a 'divisible' object.
Notes:
This generic function is necessary to properly implement the n-ary
operators.")
(:method ((n integer) (m integer) &optional r)
"Invoking .GCD. on two INTEGERs falls back to invoking CL:GCD."
(declare (ignore r))
(cl:gcd n m))
)
......@@ -814,7 +845,25 @@ error types than the TYPE-ERROR mentioned in the ANSI standard.
(defgeneric .lcm. (n m &optional r)
(:documentation "The dyadic LCM operation.
Returns the least common multiple of N and M, possibly
modifying R. If R is modified than it is returned as the result of
the operation.
Arguments and Values:
N : a 'multipliable' object.
M : a 'multipliable' object.
R : a 'multipliable' object.
Notes:
This generic function is necessary to properly implement the n-ary
operators.")
(:method ((n integer) (m integer) &optional r)
"Invoking .LCM. on two INTEGERs falls back to invoking CL:LCM."
(declare (ignore r))
(cl:lcm n m))
)
......
......@@ -8,6 +8,12 @@
(in-package "CL.EXT.MATH")
(deftype rounding-modes ()
"The Rounding Modes Union Type.
Notes:
Currently unused."
'(member :positive ; C99 FE_UPWARD
:negative ; C99 FE_DOWNWARD
:zero ; C99 FE_TOWARDZERO
......
......@@ -16,7 +16,9 @@
in the implementation.~@
~@
Many features will not work and many functions, variables and constants ~@
will be undefined."))
will be undefined."
(lisp-implementation-type)
))
;;;; end of file -- no-impl-dependent-code.lisp
......@@ -11,13 +11,16 @@
(eval-when (:load-toplevel :compile-toplevel :execute)
(defun unit-roundoff (base precision)
;; BASE is "beta" and PRECISION is "p" in the standard Numerical
;; Analisys terminology.
"Returns the numerical unit roundoff available on the platform.
BASE is \"beta\" and PRECISION is \"p\" in the standard Numerical
Analisys terminology."
(declare (type fixnum base precision)) ; This should do it.
(cl:* 1/2 (cl:expt base (cl:- 1 precision))))
)
#-sbcl
(progn
......
......@@ -9,6 +9,14 @@
(define-condition unimplemented-function (undefined-function)
()
(:documentation "The Unimplemented Function Condition.
A condition signalled that specifically signals a shortcoming of the
library.
If caught, a message should be sent to the maintainers.
")
(:report (lambda (uf stream)
(format stream "Function ~A in not (yet) implemented in CL.EXT.MATH."
(cell-error-name uf)))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment