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 / CosFunction.java @ 43989
History | View | Annotate | Download (932 Bytes)
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 CosFunction extends AbstractFunction { |
||
8 | |||
9 | public CosFunction() {
|
||
10 | 43983 | jjdelcerro | super("Numeric", "COS", Range.is(1), |
11 | "Returns the trigonometric cosine of an angle. Special cases:\n" +
|
||
12 | "- If the argument is NaN or an infinity, then the result is NaN.\n" +
|
||
13 | "The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.",
|
||
14 | "COS({{a}})",
|
||
15 | new String[]{ |
||
16 | "a - an angle, in radians."
|
||
17 | }, |
||
18 | 43989 | jjdelcerro | "Double",
|
19 | true
|
||
20 | 43983 | jjdelcerro | ); |
21 | 43512 | jjdelcerro | } |
22 | |||
23 | @Override
|
||
24 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) { |
25 | 43512 | jjdelcerro | double r = Math.cos(getDouble(args, 0)); |
26 | return r;
|
||
27 | } |
||
28 | |||
29 | } |