\[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
Test:
jeff quadratic root 1
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 17.7 s
Input Error: 31.9
Output Error: 12.4
Log:
Profile: 🕒
\(\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{\frac{c}{b} \cdot \left(2 \cdot a\right) - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\)
  1. Started with
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
    31.9
  2. Applied taylor to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases}\]
    13.3
  3. Taylor expanded around -inf to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\color{red}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases}\]
    13.3
  4. Using strategy rm
    13.3
  5. Applied add-cube-cbrt to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \color{red}{\frac{2 \cdot c}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \color{blue}{\frac{2 \cdot c}{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3}} & \text{otherwise} \end{cases}\]
    13.7
  6. Applied add-cube-cbrt to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{{\left(\sqrt[3]{2 \cdot c}\right)}^3}{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3} & \text{otherwise} \end{cases}\]
    13.8
  7. Applied cube-undiv to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{{\left(\sqrt[3]{2 \cdot c}\right)}^3}{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases}\]
    13.8
  8. Applied taylor to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases}\]
    13.8
  9. Taylor expanded around 0 to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases}\]
    13.8
  10. Applied simplify to get
    \[\color{red}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ {\left(\frac{\sqrt[3]{2 \cdot c}}{\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3 & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{\frac{c}{b} \cdot \left(2 \cdot a\right) - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}}\]
    12.4

Original test:


(lambda ((a default) (b default) (c default))
  #:name "jeff quadratic root 1"
  (if (>= b 0) (/ (- (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a)) (/ (* 2 c) (+ (- b) (sqrt (- (sqr b) (* (* 4 a) c)))))))