3 ms·
The quadratic solver implementation in kurbo is designed to be fast and reasonably precise for a wide range of inputs. But for a definitive treatment of how to
by raphlinus 2y ago
The quadratic solver implementation in kurbo is designed to be fast and reasonably precise for a wide range of inputs. But for a definitive treatment of how to solve quadratic equations, see "The Ins and Outs of Solving Quadratic Equations with Floating-Point Arithmetic" by Goualard[2]. I thought I understood the problem space pretty well, then I came across that.
[1]: https://github.com/linebender/kurbo/blob/b5bd2aa856781c6cf46c597dcb4b3a560478a578/src/common.rs#L216-L260 https://github.com/linebender/kurbo/blob/b5bd2aa856781c6cf46...
[2]: https://cnrs.hal.science/hal-04116310/document https://cnrs.hal.science/hal-04116310/document
- jacobolus 2y agoSeconded: great paper, clear and comprehensive. I cited it from the first paragraph of https://en.wikipedia.org/wiki/Quadratic_formula#Numerical_calculation https://en.wikipedia.org/wiki/Quadratic_formula#Numerical_ca... when I was working on it back in March but I'm sure the discussion could still be more complete there.
- SideQuark 2y agoAlso nice - should compare to [2] https://github.com/ChrisLomont/BetterQuadraticRoots https://github.com/ChrisLomont/BetterQuadraticRoots
- deleted 2y ago[deleted]