Skip to content

Commit

Permalink
correcting limit of f5 and f7 for x = y -> 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Feb 2, 2017
1 parent 6bb28e2 commit 60ea367
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/threshold_loop_functions.cpp
Expand Up @@ -543,7 +543,7 @@ static double f5_r1_r2(double r1, double r2)
double f5(double r1, double r2)
{
if (is_equal(r1, 0., 0.0001) && is_equal(r2, 0., 0.0001))
return 1.;
return 0.75;

if (is_equal(r1, 1., 0.01) && is_equal(r2, 1., 0.01))
return f5_1_1(r1, r2);
Expand Down Expand Up @@ -808,7 +808,7 @@ static double f7_r1_r2(double r1, double r2)
double f7(double r1, double r2)
{
if (is_equal(r1, 0., 0.0001) && is_equal(r2, 0., 0.0001))
return 1;
return 6.;

if (is_equal(r1, 1., 0.01) && is_equal(r2, 1., 0.01))
return f7_1_1(r1, r2);
Expand Down
8 changes: 8 additions & 0 deletions test/test_threshold_loop_functions.cpp
Expand Up @@ -615,6 +615,8 @@ BOOST_AUTO_TEST_CASE(test_f5)
x = 0.001; BOOST_CHECK_CLOSE(f5(0,x), f5_bare(0.00001,x), 1e-2);
x = 0.0001; BOOST_CHECK_CLOSE(f5(0,x), f5_bare(0.00001,x), 1e-2);

x = 0.0001; BOOST_CHECK_CLOSE(f5(0,0), f5_bare(x,x+0.00001), 1e-2);

x = 0.1; BOOST_CHECK_CLOSE(f5(x,1), f5_bare(x,1.00001), 1e-2);
x = 0.02; BOOST_CHECK_CLOSE(f5(x,1), f5_bare(x,1.00001), 1e-2);
x = 0.01; BOOST_CHECK_CLOSE(f5(x,1), f5_bare(x,1.00001), 1e-2);
Expand Down Expand Up @@ -676,6 +678,8 @@ BOOST_AUTO_TEST_CASE(test_f6)
x = 0.001; BOOST_CHECK_SMALL(f6(0,x) - f6_bare(0.00001,x), 1e-2);
x = 0.0001; BOOST_CHECK_SMALL(f6(0,x) - f6_bare(0.00001,x), 1e-2);

x = 0.0001; BOOST_CHECK_SMALL(f6(0,0) - f6_bare(x,x+0.00001), 1e-5);

x = 0.1; BOOST_CHECK_CLOSE(f6(x,1), f6_bare(x,1.00001), 1e-2);
x = 0.02; BOOST_CHECK_CLOSE(f6(x,1), f6_bare(x,1.00001), 1e-2);
x = 0.01; BOOST_CHECK_CLOSE(f6(x,1), f6_bare(x,1.00001), 1e-2);
Expand Down Expand Up @@ -737,6 +741,8 @@ BOOST_AUTO_TEST_CASE(test_f7)
x = 0.001; BOOST_CHECK_SMALL(f7(0,x) - f7_bare(0.00001,x), 1e-2);
x = 0.0001; BOOST_CHECK_SMALL(f7(0,x) - f7_bare(0.00001,x), 1e-2);

x = 0.0001; BOOST_CHECK_CLOSE(f7(0,0), f7_bare(x,x+0.00001), 1e-2);

x = 0.1; BOOST_CHECK_CLOSE(f7(x,1), f7_bare(x,1.00001), 1e-2);
x = 0.02; BOOST_CHECK_CLOSE(f7(x,1), f7_bare(x,1.00001), 1e-2);
x = 0.01; BOOST_CHECK_CLOSE(f7(x,1), f7_bare(x,1.00001), 1e-2);
Expand Down Expand Up @@ -798,6 +804,8 @@ BOOST_AUTO_TEST_CASE(test_f8)
x = 0.001; BOOST_CHECK_SMALL(f8(0,x) - f8_bare(0.00001,x), 1e-2);
x = 0.0001; BOOST_CHECK_SMALL(f8(0,x) - f8_bare(0.00001,x), 1e-2);

x = 0.0001; BOOST_CHECK_SMALL(f8(0,0) - f8_bare(x,x+0.00001), 1e-2);

x = 0.1; BOOST_CHECK_CLOSE(f8(x,1), f8_bare(x,1.00001), 1e-2);
x = 0.02; BOOST_CHECK_CLOSE(f8(x,1), f8_bare(x,1.00001), 1e-2);
x = 0.01; BOOST_CHECK_CLOSE(f8(x,1), f8_bare(x,1.00001), 1e-2);
Expand Down

0 comments on commit 60ea367

Please sign in to comment.