From 9e569d9d5ab7a60b93816efbf5b05d888cc3ac54 Mon Sep 17 00:00:00 2001 From: toy <toy> Date: Mon, 12 Aug 2002 21:12:46 +0000 Subject: [PATCH] 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. --- code/numbers.lisp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/code/numbers.lisp b/code/numbers.lisp index 542673cf1..314b9129c 100644 --- a/code/numbers.lisp +++ b/code/numbers.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (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 @@ #+long-float ((subtypep spec 'long-float) 'long-float) - ((subtypep spec 'rational) - 'rational) - (t))) + ((subtypep spec 'real) + ;; CMUCL doesn't have a specialized type for any other type + ;; 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)) "Builds a complex number from the specified components." -- GitLab