Skip to content
Snippets Groups Projects
Commit 9e569d9d authored by toy's avatar toy
Browse files

UPGRADED-COMPLEX-PART-TYPE:

o CMUCL doesn't have a specialized complex type to hold rationals, so
  don't return 'RATIONAL.
o Return 'REAL instead of T for any type real type.
o Give an error if it's something that can't be a component of a
  complex number.
parent f8b2b0b5
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.43 2002/07/10 16:15:59 toy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.44 2002/08/12 21:12:46 toy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -280,9 +280,24 @@ ...@@ -280,9 +280,24 @@
#+long-float #+long-float
((subtypep spec 'long-float) ((subtypep spec 'long-float)
'long-float) 'long-float)
((subtypep spec 'rational) ((subtypep spec 'real)
'rational) ;; CMUCL doesn't have a specialized type for any other type
(t))) ;; of complex---only single-float and double-float (and
;; long-float) have specialized complex types.
'real)
((kernel::hairy-type-p (specifier-type spec))
;; Do we really want to produce this error here?
(cerror "Assume this is a subtype of REAL anyway."
"Cannot determine if ~S is a subtype of REAL."
spec)
'real)
(t
;; Expected type really should be something else...
(error 'type-error
:datum spec
:expected-type 'real
:format-control "Complex numbers cannot have components of type ~S."
:format-arguments (list spec)))))
(defun complex (realpart &optional (imagpart 0)) (defun complex (realpart &optional (imagpart 0))
"Builds a complex number from the specified components." "Builds a complex number from the specified components."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment