(if (< x ,most-negative)
,most-negative
(coerce x ',type)))
- (numeric-type-low num)))
+ (numeric-type-low num)
+ nil))
(hi (bound-func (lambda (x)
(if (< ,most-positive x )
,most-positive
(coerce x ',type)))
- (numeric-type-high num))))
+ (numeric-type-high num)
+ nil)))
(specifier-type `(,',type ,(or lo '*) ,(or hi '*)))))
(defoptimizer (,fun derive-type) ((num))
;; Process the intersection.
(let* ((low (interval-low intersection))
(high (interval-high intersection))
- (res-lo (or (bound-func fun (if increasingp low high))
+ (res-lo (or (bound-func fun (if increasingp low high) nil)
default-low))
- (res-hi (or (bound-func fun (if increasingp high low))
+ (res-hi (or (bound-func fun (if increasingp high low) nil)
default-high))
(format (case (numeric-type-class arg)
((integer rational) 'single-float)
(int-hi (if hi
(ceiling (type-bound-number hi))
'*))
- (f-lo (or (bound-func #'float lo)
+ (f-lo (or (bound-func #'float lo nil)
'*))
- (f-hi (or (bound-func #'float hi)
+ (f-hi (or (bound-func #'float hi nil)
'*)))
(specifier-type `(or (rational ,int-lo ,int-hi)
(single-float ,f-lo, f-hi)))))
(float
;; A positive integer to a float power is a float.
- (modified-numeric-type y-type
- :low (interval-low bnd)
- :high (interval-high bnd)))
+ (let ((format (numeric-type-format y-type)))
+ (aver format)
+ (modified-numeric-type
+ y-type
+ :low (coerce-numeric-bound (interval-low bnd) format)
+ :high (coerce-numeric-bound (interval-high bnd) format))))
(t
;; A positive integer to a number is a number (for now).
(specifier-type 'number))))
(int-hi (if hi
(ceiling (type-bound-number hi))
'*))
- (f-lo (or (bound-func #'float lo)
+ (f-lo (or (bound-func #'float lo nil)
'*))
- (f-hi (or (bound-func #'float hi)
+ (f-hi (or (bound-func #'float hi nil)
'*)))
(specifier-type `(or (rational ,int-lo ,int-hi)
(single-float ,f-lo, f-hi)))))
(float
;; A positive rational to a float power is a float.
- (modified-numeric-type y-type
- :low (interval-low bnd)
- :high (interval-high bnd)))
+ (let ((format (numeric-type-format y-type)))
+ (aver format)
+ (modified-numeric-type
+ y-type
+ :low (coerce-numeric-bound (interval-low bnd) format)
+ :high (coerce-numeric-bound (interval-high bnd) format))))
(t
;; A positive rational to a number is a number (for now).
(specifier-type 'number))))
((or integer rational)
;; A positive float to an integer or rational power is
;; always a float.
- (make-numeric-type
- :class 'float
- :format (numeric-type-format x-type)
- :low (interval-low bnd)
- :high (interval-high bnd)))
+ (let ((format (numeric-type-format x-type)))
+ (aver format)
+ (make-numeric-type
+ :class 'float
+ :format format
+ :low (coerce-numeric-bound (interval-low bnd) format)
+ :high (coerce-numeric-bound (interval-high bnd) format))))
(float
;; A positive float to a float power is a float of the
;; higher type.
- (make-numeric-type
- :class 'float
- :format (float-format-max (numeric-type-format x-type)
- (numeric-type-format y-type))
- :low (interval-low bnd)
- :high (interval-high bnd)))
+ (let ((format (float-format-max (numeric-type-format x-type)
+ (numeric-type-format y-type))))
+ (aver format)
+ (make-numeric-type
+ :class 'float
+ :format format
+ :low (coerce-numeric-bound (interval-low bnd) format)
+ :high (coerce-numeric-bound (interval-high bnd) format))))
(t
;; A positive float to a number is a number (for now)
(specifier-type 'number))))
:complexp :real
:low (numeric-type-low type)
:high (numeric-type-high type))))))
-#-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
+
(defoptimizer (realpart derive-type) ((num))
(one-arg-derive-type num #'realpart-derive-type-aux #'realpart))
+
(defun imagpart-derive-type-aux (type)
(let ((class (numeric-type-class type))
(format (numeric-type-format type)))
:complexp :real
:low (numeric-type-low type)
:high (numeric-type-high type))))))
-#-sb-xc-host ; (See CROSS-FLOAT-INFINITY-KLUDGE.)
+
(defoptimizer (imagpart derive-type) ((num))
(one-arg-derive-type num #'imagpart-derive-type-aux #'imagpart))
;; exactly the same way as the functions themselves do
;; it.
(if (csubtypep arg domain)
- (let ((res-lo (bound-func fun (numeric-type-low arg)))
- (res-hi (bound-func fun (numeric-type-high arg))))
+ (let ((res-lo (bound-func fun (numeric-type-low arg) nil))
+ (res-hi (bound-func fun (numeric-type-high arg) nil)))
(unless increasingp
(rotatef res-lo res-hi))
(make-numeric-type