LUCENE-5207: Add missing test for atan2 including funny values (+/-0). The original patch had a bug with this method, because the arity was wrong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1522822 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-09-13 09:04:46 +00:00
parent a62a5ce2ad
commit 42e1cb7ee0
1 changed files with 11 additions and 0 deletions

View File

@ -86,6 +86,17 @@ public class TestJavascriptFunction extends LuceneTestCase {
assertEvaluatesTo("atan(1.732050808)", Math.PI/3);
}
public void testAtan2Method() throws Exception {
assertEvaluatesTo("atan2(+0,+0)", +0.0);
assertEvaluatesTo("atan2(+0,-0)", +Math.PI);
assertEvaluatesTo("atan2(-0,+0)", -0.0);
assertEvaluatesTo("atan2(-0,-0)", -Math.PI);
assertEvaluatesTo("atan2(2,2)", Math.PI/4);
assertEvaluatesTo("atan2(-2,2)", -Math.PI/4);
assertEvaluatesTo("atan2(2,-2)", Math.PI*3/4);
assertEvaluatesTo("atan2(-2,-2)", -Math.PI*3/4);
}
public void testAtanhMethod() throws Exception {
assertEvaluatesTo("atanh(-1)", Double.NEGATIVE_INFINITY);
assertEvaluatesTo("atanh(-0.5)", -0.5493061443340549);