Changeset 10017

Show
Ignore:
Timestamp:
01/09/04 04:20:59 (5 years ago)
Author:
toy
Message:

The EXPT derive-type optimizer was incorrectly deriving the type for
(expt <rational> <rational>). The result can be a rational, a float,
or a complex single-float.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/compiler/float-tran.lisp

    r9790 r9990  
    2323(defknown %double-float (real) double-float (movable foldable flushable)) 
    2424 
    25 (deftransform float ((n &optional f) (* &optional single-float) * 
    26                      :when :both) 
     25(deftransform float ((n prototype) (* single-float) * :when :both) 
    2726  '(%single-float n)) 
    2827 
    29 (deftransform float ((n f) (* double-float) * :when :both) 
     28(deftransform float ((n prototype) (* double-float) * :when :both) 
    3029  '(%double-float n)) 
     30 
     31(deftransform float ((n) *) 
     32  `(if (floatp n) n (%single-float n))) 
    3133 
    3234(deftransform %single-float ((n) (single-float) * :when :both) 
     
    12621264                 '(complex (- (realpart w) z) (imagpart w))) 
    12631265               (deftransform - ((z w) (real (complex ,type)) *) 
    1264                  '(complex (- z (realpart w)) (- (imagpart w)))) 
     1266                 ;; The 0 for the imaginary part is needed so we get 
     1267                 ;; the correct signed zero. 
     1268                 '(complex (- z (realpart w)) (- 0 (imagpart w)))) 
    12651269               ;; Multiply and divide two complex numbers 
    12661270               (deftransform * ((x y) ((complex ,type) (complex ,type)) *) 
     
    13381342         (deftransform = ((w z) (real (complex ,type)) *) 
    13391343           '(and (= (realpart z) w) (zerop (imagpart z)))) 
     1344         (deftransform - ((z w) (real (complex ,type)) *) 
     1345           ;; The 0 for the imaginary part is needed so we get 
     1346           ;; the correct signed zero. 
     1347           '(complex (- z (realpart w)) (- 0 (imagpart w)))) 
    13401348         ))) 
    13411349