1
2 /*
3 * Copyright (c) 2001, Zoltan Farkas All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 package net.sf.zel.instr.var;
21
22 import net.sf.zel.instr.*;
23 import net.sf.zel.nr.OperableDouble;
24 import net.sf.zel.nr.OperableNumber;
25 import net.sf.zel.vm.*;
26
27
28
29 public class LOG10 extends Instruction
30 {
31 private static final long serialVersionUID = 8011393036772700617L;
32
33 private LOG10(){};
34
35 public final void execute(ExecutionContext context) throws ZExecutionException
36 {
37 final double val = ((OperableNumber) context.popSyncStackVal()).doubleValue();
38 context.stack.pop(); // TODO unclean endparma marker expectation
39 context.stack.push(new OperableDouble(Math.log(val) / Math.log(10)));
40 context.ip++;
41 }
42 /**
43 * instance
44 */
45 public static final Instruction instance = new LOG10();
46 }