+/**
+ * Test mathematical operations on the Real type and consistency with double
+ */
+
#include "main.h"
#include "real.h"
using namespace std;
using namespace IPDF;
-#define TEST_CASES 100
+#define TEST_CASES 1000
static double g_totalerror = 0;
bool NotEqual(double a, double b, double threshold=1e-1)
{
- double error = (fabs(a-b) > threshold);
+ double error = fabs(a-b);
g_totalerror += error;
return (error > threshold);
}
unsigned failures = 0;
for (unsigned i = 0; i < TEST_CASES; ++i)
{
- double da = (double)(rand()%100 + 1) / (double)(rand()%100 + 1);
- double db = (double)(rand()%100 + 1) / (double)(rand()%100 + 1);
+ //Debug("Test %u of %u", i, TEST_CASES);
+ double da = (double)(rand() + 1) / (double)(rand() + 1);
+ double db = (double)(rand() + 1) / (double)(rand() + 1);
if (rand() % 2 == 0)
da = -da;