## [j-devel] (expt float ratio) patch

 [j-devel] (expt float ratio) patch From: Adam Warner - 2004-08-02 11:00:42 ```Hi Peter and all, Below is a patch to handle the case of EXPT with the base being a float and the power being a ratio, e.g. (expt 2d0 1/12) => 1.0594630943592953 \$ diff -u Primitives.java.original Primitives.java --- Primitives.java.original 2004-08-02 17:29:20.000000000 +1200 +++ Primitives.java 2004-08-02 22:34:50.000000000 +1200 @@ -3861,6 +3861,11 @@ ((Ratio)power).floatValue()); return new LispFloat(d); } + if (base instanceof LispFloat) { + double d = Math.pow(((LispFloat)base).value, + ((Ratio)power).floatValue()); + return new LispFloat(d); + } } signal(new LispError("EXPT: unsupported case")); return NIL; Regards, Adam ```

 [j-devel] (expt float ratio) patch From: Adam Warner - 2004-08-02 11:00:42 ```Hi Peter and all, Below is a patch to handle the case of EXPT with the base being a float and the power being a ratio, e.g. (expt 2d0 1/12) => 1.0594630943592953 \$ diff -u Primitives.java.original Primitives.java --- Primitives.java.original 2004-08-02 17:29:20.000000000 +1200 +++ Primitives.java 2004-08-02 22:34:50.000000000 +1200 @@ -3861,6 +3861,11 @@ ((Ratio)power).floatValue()); return new LispFloat(d); } + if (base instanceof LispFloat) { + double d = Math.pow(((LispFloat)base).value, + ((Ratio)power).floatValue()); + return new LispFloat(d); + } } signal(new LispError("EXPT: unsupported case")); return NIL; Regards, Adam ```
 Re: [j-devel] (expt float ratio) patch From: Peter Graves - 2004-08-02 14:32:51 ```On Mon, 02 Aug 2004 at 22:50:16 +1200, Adam Warner wrote: > Hi Peter and all, > > Below is a patch to handle the case of EXPT with the base being a float > and the power being a ratio, e.g. (expt 2d0 1/12) => 1.0594630943592953 > > \$ diff -u Primitives.java.original Primitives.java > --- Primitives.java.original 2004-08-02 17:29:20.000000000 +1200 > +++ Primitives.java 2004-08-02 22:34:50.000000000 +1200 > @@ -3861,6 +3861,11 @@ > ((Ratio)power).floatValue()); > return new LispFloat(d); > } > + if (base instanceof LispFloat) { > + double d = Math.pow(((LispFloat)base).value, > + ((Ratio)power).floatValue()); > + return new LispFloat(d); > + } > } > signal(new LispError("EXPT: unsupported case")); > return NIL; Committed. Thanks! -Peter ```