X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Ffloat-tran.lisp;h=2ae1e3363ec58de9096748ceb3d67e29c500e760;hb=8e4ec430504f0f563280be26034af590dff50d34;hp=1877cef80747e15dc0ce3da91afcf90f477c638b;hpb=e0aff99a73d836da0dad4602e5559595fbe5ba5c;p=sbcl.git diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index 1877cef..2ae1e33 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -982,9 +982,12 @@ (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)))) @@ -1014,9 +1017,12 @@ (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)))) @@ -1026,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)))) @@ -1219,9 +1229,10 @@ :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))) @@ -1243,7 +1254,7 @@ :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))