Skip to content

Commit 5b5e293

Browse files
committed
Emulisp: ** implementation.
1 parent e3b53b5 commit 5b5e293

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

emulisp/emulisp_core.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,13 @@ var coreFunctions = {
12311231
"/": function(c) { return div(c, function(a, b) { return a / b; }); }, // floating point division
12321232
"/t": function(c) { return div(c, function(a, b) { var d = a / b;
12331233
return (d >= 0) ? Math.floor(d) : Math.ceil(d); }); }, // truncated division
1234+
"**": function(c) {
1235+
var a = evalLisp(c.car);
1236+
var b = evalLisp(c.cdr.car);
1237+
if (a == NIL) return NIL;
1238+
if (b == NIL) return new Number(0);
1239+
return new Number(Math.pow(a, b));
1240+
},
12341241
"%": function(c) { return div(c, function(a, b) { return a % b; }); },
12351242
"=": function(c) { var cv = evalLisp(c.car), d = c, dv;
12361243
while (d.cdr !== NIL) { d = d.cdr; dv = evalLisp(d.car); if (!eqVal(cv, dv)) return NIL; }; return T; },

0 commit comments

Comments
 (0)