This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Recommended addition to solve_quadratic.c


Balk, L. David writes:
 > 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.

Thanks, I've made a note of that -- I agree it can be handled more
gracefully.

 > 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.

I'd recommend comparing the two returned roots with a suitable
tolerance, or some other procedure appropriate to the problem... the
sign of the discriminant b^2-4ac is sensitive to numerical error.

-- 
Brian Gough

Network Theory Ltd,
Commercial support for GSL --- http://www.network-theory.co.uk/gsl/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]