Difference between revisions of "TestNumericalNumber"

From ApCoCoAWiki
m
m
Line 22: Line 22:
 
[TRUE]
 
[TRUE]
 
-------------------------------
 
-------------------------------
</example>
 
<example>
 
 
F := 3.14159265; E := 3.141;
 
F := 3.14159265; E := 3.141;
 
ApCoCoATest.TestNumericalNumber(F,E,0.0001);
 
ApCoCoATest.TestNumericalNumber(F,E,0.0001);

Revision as of 17:09, 12 October 2009

TestNumericalNumber

Compares two numerical numbers

Syntax

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

Description

This function compares two numerical numbers and returns "TRUE", if the difference isn't greater 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]
-------------------------------