Opened 10 months ago

Closed 4 months 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 Changed 7 months ago by John Maddock

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 Changed 7 months ago by Paul A. Bristow

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 Changed 7 months ago by Paul A. Bristow

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 Changed 4 months ago by John Maddock

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