X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Ffloat-tran.lisp;h=51cf1dd65026ac6d8145c8a0f5972836311cb939;hb=02f7f85a6554b1ec233e9a515c4c511fe092565e;hp=b5cd53666819cb99a14bd609655f78ef211060e5;hpb=436b2ab0276f547e8537b6c1fb52b11fa1f53975;p=sbcl.git diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index b5cd536..51cf1dd 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -326,12 +326,14 @@ (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)) @@ -791,9 +793,9 @@ ;; 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) @@ -972,17 +974,20 @@ (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)))) @@ -1004,17 +1009,20 @@ (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)))) @@ -1024,20 +1032,24 @@ ((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)))) @@ -1449,8 +1461,8 @@ ;; 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