source: trunk/source/level-0/l0-complex.lisp @ 16685

Last change on this file since 16685 was 16685, checked in by rme, 4 years ago

Update copyright/license headers in files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1;;;-*- Mode: Lisp; Package: CCL -*-
2;;;
3;;; Copyright 1994-2009 Clozure Associates
4;;;
5;;; Licensed under the Apache License, Version 2.0 (the "License");
6;;; you may not use this file except in compliance with the License.
7;;; You may obtain a copy of the License at
8;;;
9;;;     http://www.apache.org/licenses/LICENSE-2.0
10;;;
11;;; Unless required by applicable law or agreed to in writing, software
12;;; distributed under the License is distributed on an "AS IS" BASIS,
13;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14;;; See the License for the specific language governing permissions and
15;;; limitations under the License.
16
17(in-package "CCL")
18
19(eval-when (:compile-toplevel)
20  (require "NUMBER-MACROS"))
21
22(defun coerce-to-complex-type (num type)
23  (cond ((complexp num)
24         (let ((real (%realpart num))
25               (imag (%imagpart num)))
26           (if (and (typep real type)
27                    (typep imag type))
28             num
29             (complex (coerce real type)
30                      (coerce imag type)))))
31        (t (complex (coerce num type)))))
32
33;;; end of l0-complex.lisp
Note: See TracBrowser for help on using the repository browser.