Atan: Unterschied zwischen den Versionen

Aus JACK Wiki
Zur Navigation springen Zur Suche springen
KKeine Bearbeitungszusammenfassung
Zeile 13: Zeile 13:
===Beispiele===
===Beispiele===
  atan(0)    --> returns 0
  atan(0)    --> returns 0
====JUnit Tests====
<span class="mw-customtoggle-myDivision">[Anzeigen]</span>
<syntaxhighlight lang="java" class="mw-collapsible mw-collapsed" id="mw-customcollapsible-myDivision">
private double PI = Math.PI;
@Test
public void testAtan1() {
assertEquals(0, Evaluator.getNumberResult("atan('0')", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test
public void testAtan2() {
assertEquals(0.463647609000806,
Evaluator.getNumberResult("atan('0.5')", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test
public void testAtan4() {
assertEquals(PI / 4, Evaluator.getNumberResult("atan('1')", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtan5() {
assertEquals(-PI / 4, Evaluator.getNumberResult("atan('-1')", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtan6() {
assertEquals(PI / 4, Evaluator.getNumberResult("atan(1)", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtan7() {
assertEquals(-PI / 4, Evaluator.getNumberResult("atan(-1)", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtanWithInput1() {
assertEquals(0, Evaluator.getNumberResult("atan([pos=1])", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test
public void testAtanWithInput2() {
assertEquals(PI / 4, Evaluator.getNumberResult("atan([pos=2])", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtanWithVariables1() {
assertEquals(0, Evaluator.getNumberResult("atan([var=a])", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test
public void testAtanWithVariables2() {
assertEquals(PI / 4, Evaluator.getNumberResult("atan([var=b])", exerciseVariableMap, fillInVariableMap), 0.0001);
}
@Test
public void testAtanWithExpression1() {
assertEquals(0, Evaluator.getNumberResult("atan(atan(0))", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test
public void testAtanWithExpression2() {
assertEquals(0, Evaluator.getNumberResult("atan(atan(atan(0)))", exerciseVariableMap, fillInVariableMap), 0.0);
}
@Test(expected = FunctionInvalidArgumentTypeException.class)
public void testAtanWithONECharacter() {
Evaluator.getNumberResult("atan(a)", exerciseVariableMap, fillInVariableMap);
fail();
}
@Test(expected = FunctionInvalidArgumentTypeException.class)
public void testAtanWithEmptyStringArgument() {
Evaluator.getNumberResult("atan('')", exerciseVariableMap, fillInVariableMap);
fail();
}
@Test(expected = FunctionInvalidNumberOfArgumentsException.class)
public void testAtanWithEmptyArgument() {
Evaluator.getNumberResult("atan()", exerciseVariableMap, fillInVariableMap);
fail();
}
@Test(expected = UndefinedExerciseVariableException.class)
public void testAtanWithoutExerciseVariable() {
Evaluator.getNumberResult("atan([var=j])", exerciseVariableMap, fillInVariableMap);
fail();
}
@Test(expected = UndefinedFillInVariableException.class)
public void testAtanWithoutInput() {
Evaluator.getNumberResult("atan([pos=42])", exerciseVariableMap, fillInVariableMap);
fail();
}
</syntaxhighlight>


===Hinweise===
===Hinweise===


[[Kategorie:Evaluatorfunktion]]
[[Kategorie:Evaluatorfunktion]]

Version vom 24. September 2018, 11:36 Uhr

Beschreibung

Der Arkustangens wird durch die Funktion atan' beschrieben. Er erwartet einen Parameter und gibt einen Wert zurück.

Syntax

atan(Gleitkommazahl zahl)

Parameter

  • zahl - einen Zahlenwert

Return Value

  • Gibt den Wert des Arkustangens an der Stelle zurück.

Beispiele

atan(0)    --> returns 0

Hinweise