GNU Scientific Library - Bugs: bug #42219, Division by zero in...
You are not allowed to post comments on this tracker with your current authentication level.
bug #42219: Division by zero in "gnewton" when "f" and "fdf" differ
Submitter: | Patrick Alken <psa> | ||
Submitted: | Mon 28 Apr 2014 03:42:25 PM UTC | ||
Category: | Runtime error | Severity: | 3 - Normal |
Operating System: | Status: | None | |
Assigned to: | None | Open/Closed: | Open |
Release: |
Mon 28 Apr 2014 04:10:42 PM UTC, comment #1: |
Patrick Alken <psa>![]() |
Mon 28 Apr 2014 03:42:25 PM UTC, original submission:
Hello GSL team,
The "gnewton" multiroot solver has a possibility of dividing by zero if the
The division takes place on line 177 of "multiroots/gnewton.c". This line
Why would "f" and "fdf" produce different results? The manual states that
const double f0 = w*w - c1_/(h*h) - 1.0;
vs.
const double w2 = w*w;
I have attached a small program (bug_gnewton.c) that triggers this bug,
Type: gnewton
or, if GSL_IEEE_MODE="trap-common", with:
GSL_IEEE_MODE="trap-common"
The expected output is:
Type: gnewton
I can work around this bug for now (by having "fdf" defer to "f" and "df"),
- Curran |
Patrick Alken <psa>![]() |
Depends on the following items: None found
Items that depend on this one: None found
Follows 1 latest change.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2014-04-28 | psa | Attached File | - | ![]() |
Added bug_gnewton.c, #31265 |
The problem seems to be in this line of gnewton_set() in multiroots/gnewton.c:
122 state->phi = enorm(f);
In the example program, the initial guess x is the solution vector, so the F_DF call provides a vector f = 0.
Then in the first gnewton_iterate() call, on line
177 double theta = phi1 / phi0;
we divide by 0.