## #6001 closed Bugs (fixed)

# math::tools::roots eps_tolerance wrong behaviour at 0. 0.

Reported by: | Owned by: | John Maddock | |
---|---|---|---|

Milestone: | To Be Determined | Component: | math |

Version: | Boost 1.47.0 | Severity: | Problem |

Keywords: | Cc: |

### Description

at line 34 of toms748_solve.hpp:

`return (fabs(a - b) / (std::min)(fabs(a), fabs(b))) <= eps;`

this leads to wrong behavior when a=b=0.

fix is trivial:

`return fabs(a - b) <= eps * (std::min)(fabs(a), fabs(b));`

does almost the same, but it is correct when a=b=0

### Change History (2)

**Note:**See TracTickets for help on using tickets.

(In [74890]) Remove unused constants. Fix expression for tolerance in eps_tolerance. Add include guards to prime.hpp. Fixes #5982. Fixes #5927. Fixes #6001.