Difference between revisions of "TestNumericalNumber"

From ApCoCoAWiki
(New page: <command> <title>TestNumericalNumber</title> <short_description>Compares two numerical numbers </short_description> <syntax> ApCoCoATest.TestNumericalNumber(Found: Rat, Expected: Rat, Eps:...)
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
<short_description>Compares two numerical numbers </short_description>
 
<short_description>Compares two numerical numbers </short_description>
 
<syntax>
 
<syntax>
ApCoCoATest.TestNumericalNumber(Found: Rat, Expected: Rat, Eps: Rat)
+
ApCoCoATest.TestNumericalNumber(Found: RAT, Expected: RAT, Eps: RAT):LIST
 
</syntax>
 
</syntax>
  
 
<description>
 
<description>
 +
This function compares two numerical numbers. The difference between the two numbers must be smaller than eps.
  
 
<itemize>
 
<item>@param <em>Found</em>: </item>
 
<item>@param <em>Expected</em>: </item>
 
<item>@param <em>Eps</em>: </item>
 
<item>@return </item>
 
</itemize>
 
The following parameter is optional:
 
 
<itemize>
 
<itemize>
<item>@param <em>Dil</em>: Integer > 0, factor for dilation of the polyhedral P, to count the lattice points of the polyhedral n*P</item>
+
<item>@param <em>Found</em>: The numerical value that was computed</item>
 +
<item>@param <em>Expected</em>: The numerical value that should be computed</item>
 +
<item>@param <em>Eps</em>: The allowed difference between the two values</item>
 +
<item>@return A list. First entry is a boolean, its value is TRUE, if the test has been passed. If FALSE, the list contains also the expected and the found number.</item>
 
</itemize>
 
</itemize>
  
 
<example>
 
<example>
 +
F := 3.14159265; E := 3.141;
 +
ApCoCoATest.TestNumericalNumber(F,E,0.01);
 +
 +
[TRUE]
 +
-------------------------------
 +
F := 3.14159265; E := 3.141;
 +
ApCoCoATest.TestNumericalNumber(F,E,0.0001);
  
 +
[FALSE, 62831853/20000000, 3141/1000]
 +
-------------------------------
 
</example>
 
</example>
  

Latest revision as of 17:13, 12 October 2009

TestNumericalNumber

Compares two numerical numbers

Syntax

ApCoCoATest.TestNumericalNumber(Found: RAT, Expected: RAT, Eps: RAT):LIST

Description

This function compares two numerical numbers. The difference between the two numbers must be smaller than eps.

  • @param Found: The numerical value that was computed

  • @param Expected: The numerical value that should be computed

  • @param Eps: The allowed difference between the two values

  • @return A list. First entry is a boolean, its value is TRUE, if the test has been passed. If FALSE, the list contains also the expected and the found number.

Example

F := 3.14159265; E := 3.141;
ApCoCoATest.TestNumericalNumber(F,E,0.01);

[TRUE]
-------------------------------
F := 3.14159265; E := 3.141;
ApCoCoATest.TestNumericalNumber(F,E,0.0001);

[FALSE, 62831853/20000000, 3141/1000]
-------------------------------