Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / numeric / CoshFunction.java @ 44009

History | View | Annotate | Download (1.24 KB)

1 43512 jjdelcerro
package org.gvsig.expressionevaluator.impl.function.numeric;
2
3
import org.apache.commons.lang3.Range;
4 43521 jjdelcerro
import org.gvsig.expressionevaluator.Interpreter;
5 43512 jjdelcerro
import org.gvsig.expressionevaluator.spi.AbstractFunction;
6
7
public class CoshFunction extends AbstractFunction {
8
9
    public CoshFunction() {
10 43983 jjdelcerro
        super("Numeric", "COSH", Range.is(1),
11
            "Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is defined to be (ex + e-x)/2 where e is Euler's number.\n" +
12
            "Special cases:\n" +
13
            "- If the argument is NaN, then the result is NaN.\n" +
14
            "- If the argument is infinite, then the result is positive infinity.\n" +
15
            "- If the argument is zero, then the result is 1.0. \n" +
16
            "The computed result must be within 2.5 ulps of the exact result.",
17
            "COSH({{x}})",
18
            new String[]{
19
                "x - The number whose hyperbolic cosine is to be returned."
20
            },
21 43989 jjdelcerro
            "Double",
22
            true
23 43983 jjdelcerro
        );
24 43512 jjdelcerro
    }
25
26
    @Override
27 44009 jjdelcerro
    public boolean allowConstantFolding() {
28
        return true;
29
    }
30
31
    @Override
32 43521 jjdelcerro
    public Object call(Interpreter interpreter, Object[] args) {
33 43512 jjdelcerro
        double r = Math.cosh(getDouble(args, 0));
34
        return r;
35
    }
36
}