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 @ 43983
History | View | Annotate | Download (1.14 KB)
1 |
package org.gvsig.expressionevaluator.impl.function.numeric; |
---|---|
2 |
|
3 |
import org.apache.commons.lang3.Range; |
4 |
import org.gvsig.expressionevaluator.Interpreter; |
5 |
import org.gvsig.expressionevaluator.spi.AbstractFunction; |
6 |
|
7 |
public class CoshFunction extends AbstractFunction { |
8 |
|
9 |
public CoshFunction() {
|
10 |
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 |
"Double"
|
22 |
); |
23 |
} |
24 |
|
25 |
@Override
|
26 |
public Object call(Interpreter interpreter, Object[] args) { |
27 |
double r = Math.cosh(getDouble(args, 0)); |
28 |
return r;
|
29 |
} |
30 |
} |