Opened 5 years ago

Closed 4 years ago

#13451 closed Bugs (fixed)

is_close_to function does not exist

Reported by: John Friesen <jhpfriesen@…> Owned by: Paul A. Bristow
Milestone: To Be Determined Component: math
Version: Boost 1.66.0 Severity: Problem
Keywords: Cc:

Description

The example code for boost::math::tools::brent_find_minima (Brent_minimise_example.cpp) calls the function is_close_to. This code results in an error (Visual Studio 15.5.5) because the compiler cannot find the function. Neither can I:

#include <boost/test/floating_point_comparison.hpp>
using boost::math::fpc::is_close_to;

The following code seems to work:
template<typename FPT>
inline bool
is_close_to(FPT left, FPT right, FPT tolerance)
{

return boost::math::fpc::close_at_tolerance<FPT>(tolerance) (left, right);


}

Change History (4)

comment:1 by John Maddock, 4 years ago

Component: Nonemath
Owner: set to Paul A. Bristow

Paul this seems to be your code. I also note that the offending example hasn't been added to the Jamfile for the examples, otherwise this would have been detected during the CI builds.

comment:2 by Paul A. Bristow, 4 years ago

Thanks for reporting this. Clearly a mistake. Your fix sounds plausible, but I will check this out fully in due course. And add the the jamfile so that any mistakes would be found before the users do :-(

comment:3 by Paul A. Bristow, 4 years ago

Corrected and hopefully improved this example, now checking if expected small near zero before checking if close.

o github.com:boostorg/math.git

bf57b10fe..0fe646388 develop -> develop

comment:4 by John Maddock, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.