29 #define CATCH_CONFIG_MAIN
30 #include <catch2/catch_amalgamated.hpp>
38 TEST_CASE(
"Float Epsilon Test 01",
"[datatype][float][epsilon]" ) {
39 static float epsilon_f0 = std::numeric_limits<float>::epsilon();
40 static double epsilon_d0 = std::numeric_limits<double>::epsilon();
42 static float epsilon_f1 = jau::machineEpsilon<float>();
43 static double epsilon_d1 = jau::machineEpsilon<double>();
45 float epsilon_fd = epsilon_f1 - epsilon_f0;
46 float epsilon_dd = epsilon_d1 - epsilon_d0;
48 fprintf(stderr,
"std::numeric_limits<float>::epsilon() : %e\n", epsilon_f0);
49 fprintf(stderr,
"std::numeric_limits<double>::epsilon() : %le\n", epsilon_d0);
50 fprintf(stderr,
"jau::machineEpsilon<float>() : %e\n", epsilon_f1);
51 fprintf(stderr,
"jau::machineEpsilon<double>() : %le\n", epsilon_d1);
53 fprintf(stderr,
"float: approximation - numeric_limits : %e\n", epsilon_fd);
54 fprintf(stderr,
"double: approximation - numeric_limits : %le\n", epsilon_dd);