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 @ 43983
History | View | Annotate | Download (914 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 | "Double"
|
||
19 | ); |
||
20 | 43512 | jjdelcerro | } |
21 | |||
22 | @Override
|
||
23 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) { |
24 | 43512 | jjdelcerro | double r = Math.cos(getDouble(args, 0)); |
25 | return r;
|
||
26 | } |
||
27 | |||
28 | } |