All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codetaco.math.function.FuncAsin Maven / Gradle / Ivy

There is a newer version: 6.2.0
Show newest version
package com.codetaco.math.function;

import com.codetaco.math.Function;
import com.codetaco.math.ValueStack;
import com.codetaco.math.token.TokVariable;

import java.text.ParseException;

/**
 * 

* FuncAsin class. *

* * @author Chris DeGreef [email protected] * @since 1.3.9 */ public class FuncAsin extends Function { /** *

* Constructor for FuncAsin. *

*/ public FuncAsin() { super(); } /** *

* Constructor for FuncAsin. *

* * @param var a {@link com.codetaco.math.token.TokVariable} object. */ public FuncAsin(final TokVariable var) { super(var); } /** * {@inheritDoc} */ @Override public void resolve(final ValueStack values) throws Exception { if (values.size() < 1) { throw new Exception("missing operands for " + toString()); } try { values.push(new Double(Math.asin(values.popDouble()) * 180 / Math.PI)); } catch (final ParseException e) { e.fillInStackTrace(); throw new Exception(toString() + "; " + e.getMessage(), e); } } /** * {@inheritDoc} */ @Override public String toString() { return "function(asin)"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy