Mercurial Hosting > luan
comparison src/luan/interp/PowExpr.java @ 8:8896068e0a4b
finish operators
git-svn-id: https://luan-java.googlecode.com/svn/trunk@9 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 21 Nov 2012 06:57:09 +0000 |
parents | |
children | b7d7069fee58 |
comparison
equal
deleted
inserted
replaced
7:bca8fc5d928b | 8:8896068e0a4b |
---|---|
1 package luan.interp; | |
2 | |
3 import luan.Lua; | |
4 import luan.LuaNumber; | |
5 import luan.LuaException; | |
6 import luan.LuaState; | |
7 | |
8 | |
9 final class PowExpr extends BinaryOpExpr { | |
10 | |
11 PowExpr(Expr op1,Expr op2) { | |
12 super(op1,op2); | |
13 } | |
14 | |
15 @Override Object eval(LuaState lua) throws LuaException { | |
16 double n1 = Lua.checkNumber(op1.eval(lua)).value(); | |
17 double n2 = Lua.checkNumber(op2.eval(lua)).value(); | |
18 return new LuaNumber( Math.pow(n1,n2) ); | |
19 } | |
20 } |