|
Re: ffloor-derived-type-optimizer: msg#00284lisp.cmucl.devel
>>>>> "Gerd" == Gerd Moellmann <gerd.moellmann@xxxxxxxxxxx> writes: Gerd> gerd.moellmann@xxxxxxxxxxx (Gerd Moellmann) writes: >> (defun foo (n d) >> (declare (type (unsigned-byte 32) n d)) >> (ffloor n d)) [snip] Gerd> That's why Python thinks FOO's return type is NIL. Compiling the file Gerd> natively, C::FFLOOR-DERIVE-TYPE-OPTIMIZER is not called, which Gerd> probably explains the difference in behavior. I wonder why ffloor defoptimizer isn't called when compiling natively? Gerd> Someone knowing that part of the code intimately enough to spot the Gerd> bug immediately? This is probably caused by this bit: (defun ,q-aux (number-type divisor-type) (let* ((number-interval (numeric-type->interval number-type)) (divisor-interval (numeric-type->interval divisor-type)) (quot (,q-name (interval-div number-interval divisor-interval))) (res-type (numeric-contagion number-type divisor-type))) Since number-type and divisor-type are integers, res-type is rational. Since we want a float result, we could test if res-type is not a float of some sort (single-float/double-float) convert it to a float type before returning the desired quotient type. This was probably caused by too much cutting and pasting from the floor/ceiling defoptimizers. Ray |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | ffloor-derived-type-optimizer: 00284, Gerd Moellmann |
|---|---|
| Next by Date: | Re: ffloor-derived-type-optimizer: 00284, Gerd Moellmann |
| Previous by Thread: | ffloor-derived-type-optimizeri: 00284, Gerd Moellmann |
| Next by Thread: | Re: ffloor-derived-type-optimizer: 00284, Gerd Moellmann |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |