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

com.obdobion.algebrain.function.FuncAcotan Maven / Gradle / Ivy

package com.obdobion.algebrain.function;

import java.text.ParseException;

import com.obdobion.algebrain.Function;
import com.obdobion.algebrain.ValueStack;
import com.obdobion.algebrain.token.TokVariable;

/**
 * 

* FuncAcotan class. *

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

* Constructor for FuncAcotan. *

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

* Constructor for FuncAcotan. *

* * @param var a {@link com.obdobion.algebrain.token.TokVariable} object. */ public FuncAcotan(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 { final double degrees = values.popDouble(); final double rads = degrees * (Math.PI / 180); values.push(new Double(Math.PI / 2 - Math.atan(rads))); } catch (final ParseException e) { e.fillInStackTrace(); throw new Exception(toString() + "; " + e.getMessage(), e); } } /** {@inheritDoc} */ @Override public String toString() { return "function(acotan)"; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy