\[\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: 10.8 s
Input Error: 30.5
Output Error: 18.8
Log:
Profile: 🕒
\(\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)}}{a \cdot 2} & \text{when } b \ge 0 \\ \frac{\frac{-2}{a} \cdot \frac{c}{4}}{\frac{b}{a \cdot 2}} & \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}\]
    30.5
  2. Using strategy rm
    30.5
  3. Applied flip-+ 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) + \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 \\ \color{blue}{\frac{2 \cdot c}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}} & \text{otherwise} \end{cases}\]
    44.9
  4. Applied simplify 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{\color{red}{2 \cdot c}}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^2}{\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{\color{blue}{2 \cdot c}}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{otherwise} \end{cases}\]
    44.1
  5. 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}{\frac{\left(4 \cdot a\right) \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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}} & \text{otherwise} \end{cases}\]
    20.7
  6. 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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}} & \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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}} & \text{otherwise} \end{cases}\]
    20.7
  7. Applied simplify 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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{2 \cdot a} & \text{when } b \ge 0 \\ \left(\frac{c}{4} \cdot \frac{-2}{a}\right) \cdot \frac{\frac{2}{1}}{\frac{b}{a}} & \text{otherwise} \end{cases}\]
    18.9

  8. Applied final simplification
  9. Applied simplify to get
    \[\color{red}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{2 \cdot a} & \text{when } b \ge 0 \\ \left(\frac{c}{4} \cdot \frac{-2}{a}\right) \cdot \frac{\frac{2}{1}}{\frac{b}{a}} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)}}{a \cdot 2} & \text{when } b \ge 0 \\ \frac{\frac{-2}{a} \cdot \frac{c}{4}}{\frac{b}{a \cdot 2}} & \text{otherwise} \end{cases}}\]
    18.8

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