Re: [Sbcl-devel] Optimization of (epxt -1 n) From: Christophe Rhodes - 2009-06-02 19:37 ```Stas Boukarev writes: > +(deftransform expt ((x y) ((integer -1) integer) *) > + `(if (evenp y) 1 -1)) Without trying to run it, doesn't this trigger for all integers greater than or equal to -1? Best, Christophe ```
 Re: [Sbcl-devel] Optimization of (epxt -1 n) From: Nikodemus Siivola - 2009-06-21 18:19 ```2009/6/2 Stas Boukarev : > Christophe Rhodes writes: > >> Stas Boukarev writes: >> >>> +(deftransform expt ((x y) ((integer -1) integer) *) >>> +  `(if (evenp y) 1 -1)) >> >> Without trying to run it, doesn't this trigger for all integers >> greater than or equal to -1? Merged as 1.0.29.28, thank you! Cheers, -- Nikodemus ```
 Re: [Sbcl-devel] Optimization of (epxt -1 n) From: Stas Boukarev - 2009-06-21 18:36 ```Nikodemus Siivola writes: > 2009/6/2 Stas Boukarev : >> Christophe Rhodes writes: >> >>> Stas Boukarev writes: >>> >>>> +(deftransform expt ((x y) ((integer -1) integer) *) >>>> +  `(if (evenp y) 1 -1)) >>> >>> Without trying to run it, doesn't this trigger for all integers >>> greater than or equal to -1? > > Merged as 1.0.29.28, thank you! > As pointed out by Paul Khuong, (- 1 (* 2 (logand 1 y))) would be better since it doesn't have branching. -- With best regards, Stas. ```
 Re: [Sbcl-devel] Optimization of (epxt -1 n) From: Nikodemus Siivola - 2009-06-25 11:27 ```2009/6/21 Stas Boukarev : > As pointed out by Paul Khuong, (- 1 (* 2 (logand 1 y))) would be better > since it doesn't have branching. In 1.0.29.40. I also made the transform deal with -1.0 and -1.0d0 (using IF ODDP to avoid consing up the return value.) Cheers, -- Nikodemus ```