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 / CosFunction.java @ 43983

History | View | Annotate | Download (914 Bytes)

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 CosFunction extends AbstractFunction {
8

    
9
    public CosFunction() {
10
        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
    }
21
  
22
    @Override
23
    public Object call(Interpreter interpreter, Object[] args) {
24
        double r = Math.cos(getDouble(args, 0));
25
        return r;
26
    }
27

    
28
}