Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
common-math
common-math
Commits
5c3df410
Commit
5c3df410
authored
Jan 08, 2020
by
Marco Antoniotti
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a few little things fixed other ones. This is just a checkpoint commit.
parent
d848e383
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
4 deletions
+77
-4
.gitignore
.gitignore
+1
-0
common-math-package.lisp
common-math-package.lisp
+4
-0
common-math.lisp
common-math.lisp
+50
-1
ieee-base.lisp
ieee-base.lisp
+6
-0
impl-dependent/no-impl-dependent-code.lisp
impl-dependent/no-impl-dependent-code.lisp
+3
-1
numerics-base.lisp
numerics-base.lisp
+5
-2
prologue.lisp
prologue.lisp
+8
-0
No files found.
.gitignore
View file @
5c3df410
...
...
@@ -4,3 +4,4 @@ docs/
tmp/
.bin/
.cmbin/
.iabin/
common-math-package.lisp
View file @
5c3df410
...
...
@@ -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
...
...
common-math.lisp
View file @
5c3df410
...
...
@@ -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 give
n
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
))
)
...
...
ieee-base.lisp
View file @
5c3df410
...
...
@@ -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
...
...
impl-dependent/no-impl-dependent-code.lisp
View file @
5c3df410
...
...
@@ -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
numerics-base.lisp
View file @
5c3df410
...
...
@@ -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
...
...
prologue.lisp
View file @
5c3df410
...
...
@@ -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
)))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment