Recommended addition to solve_quadratic.c
Balk, L. David
Dave.Balk@jhuapl.edu
Fri Nov 5 10:00:00 GMT 2004
Hi,
I'm not sure this qualifies as a bug, so I'm submitting it for your review instead. I've been taking advantage of gsl to upgrade some simulation math libraries we've been using. For simulation purposes, the 'a' term in a quadratic equation describing motion can occasionally go to zero. I noticed that solve_quadratic.c does not handle or report an attempted divide-by-zero in that case. I've added a quick check at the start of the function that requires no changes to documentation or normal behavior. I've attached a revised version of the source file. Feel free to incorporate it into your next GPL release.
I would also like to see equal roots returned as a 1 instead of a 2, but I'm sure there is a lot of code that depends upon the current behavior and the documentation would have to be changed.
// Dave
===================================================
L. David Balk, Senior Professional Staff
Johns Hopkins University Applied Physics Laboratory
11100 Johns Hopkins Road, Laurel, MD 20723-6099
Tel. 1-443-778-0791, David.Balk@jhuapl.edu
===================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: solve_quadratic_rev.c
Type: application/octet-stream
Size: 2171 bytes
Desc: solve_quadratic_rev.c
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20041105/1461838d/attachment.obj>
More information about the Gsl-discuss
mailing list