BoostGSoC21 / Real

Boost numerical data type for real numbers representation using range arithmetic.
4 stars 5 forks source link

More precision required for intermediate terms #17

Open div5252 opened 3 years ago

div5252 commented 3 years ago

Consider the following failing test -

a = real("3.11");
result = real::acos(real::cos(a));  // acos(cos(3.11)) = 3.110000000000000
lower_limit = real("3.109999999999999");
upper_limit = real("3.110000000000001");
CHECK(result > lower_limit);
CHECK(result < upper_limit);

There is loss of precision while computing Taylor expansion and using divide and conquer approach. So it is necessary to call the intermediate terms with more precision in math functions.

Parna2000 commented 3 years ago

I can fix this issue. Please assign me this issue and allow me to work on it @div5252

div5252 commented 3 years ago

There is no need for me to assign the issue. You can work on it and make a PR.

GYuvanShankar commented 2 years ago

This could be due to calling the sin functions with same precision as that of the number itself. For eg. auto [sin_lower, cos_lower] = sin_cos(ro.get_lhs_itr().get_interval().lower_bound.up_to(_precision, false), _precision, false); I think calling functions with higher precision should help with this issue.