01: package kawa.standard;
02:
03: import gnu.math.*;
04: import gnu.mapping.*;
05:
06: /** Implement the standard Scheme procedure "expt". */
07:
08: public class expt extends Procedure2 {
09: public static final expt expt = new expt("expt");
10:
11: public expt(String name) {
12: super (name);
13: }
14:
15: public static IntNum expt(IntNum x, int y) {
16: return IntNum.power(x, y);
17: }
18:
19: public static Numeric expt(Object arg1, Object arg2) {
20: if (arg2 instanceof IntNum)
21: return ((Numeric) arg1).power((IntNum) arg2);
22: return Complex.power((Complex) arg1, (Complex) arg2);
23: }
24:
25: public Object apply2(Object arg1, Object arg2) {
26: return expt(arg1, arg2);
27: }
28: }
|