Opened 7 years ago

Closed 7 years ago

#11532 closed Bugs (fixed)

toms748_solve produces -nan when evaluating a smooth function in a fixed interval

Reported by: Ola Skavhaug <ola@…> Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

In my algorithm that is finding the point where two gamma gamma distributions crosses, the toms748 solver produces a -nan value for the evaluation point. The behaviour occurs quite rarely, and only for extremely specific values of the governing parameters. I have not checked if the problem is cross platform.

I see that the solver evaluates the same point twice, and suspect that the subsequent calculation of the change of the evaluation point somehow divides by 0.

A minimal example is enclosed.

Attachments (1)

test.cpp (1.1 KB ) - added by Ola Skavhaug <ola@…> 7 years ago.
Minimal example, compile with: g++ -std=c++11 -fPIC -O2 -o test test.cpp

Download all attachments as: .zip

Change History (4)

by Ola Skavhaug <ola@…>, 7 years ago

Attachment: test.cpp added

Minimal example, compile with: g++ -std=c++11 -fPIC -O2 -o test test.cpp

comment:1 by anonymous, 7 years ago

can confirm, same bug, ubuntu 14.04 and gcc

comment:2 by John Maddock, 7 years ago

Thanks, I tried to reproduce with msvc but no luck, I'll look into GCC later.

comment:3 by John Maddock, 7 years ago

Resolution: fixed
Status: newclosed

There's a typo/bug in the root bracketing code, fixed in https://github.com/boostorg/math/commit/8a29241cc3a59fe04b10ab6937d8eefe07dd85fb

Note this will not be in the next release which already in beta.

Note: See TracTickets for help on using tickets.