MCPcopy Create free account
hub / github.com/NanoComp/meep / compare

Function compare

tests/dump_load.cpp:42–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40#endif
41
42int compare(double a, double b, const char *n) {
43 if (fabs(a - b) > fabs(b) * tol && fabs(b) > thresh) {
44 master_printf("%s differs by\t%g out of\t%g\n", n, a - b, b);
45 master_printf("This gives a fractional error of %g\n", fabs(a - b) / fabs(b));
46 return 0;
47 }
48 else { return 1; }
49}
50
51int compare_point(fields &f1, fields &f2, const vec &p) {
52 monitor_point m1, m_test;

Callers 2

test_metalFunction · 0.70
test_periodicFunction · 0.70

Calls 1

master_printfFunction · 0.85

Tested by 2

test_metalFunction · 0.56
test_periodicFunction · 0.56