\[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
Test:
The quadratic formula (r2)
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 34.3 s
Input Error: 18.2
Output Error: 2.3
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{b} \cdot \frac{-2}{2} & \text{when } b \le -1.4516784f-11 \\ \frac{\left(-b\right) + \left(-\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}{2 \cdot a} & \text{when } b \le 2.163724f+14 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases}\)

    if b < -1.4516784f-11

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      28.2
    2. Applied taylor to get
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \leadsto \frac{-2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}\]
      7.2
    3. Taylor expanded around -inf to get
      \[\frac{\color{red}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} \leadsto \frac{\color{blue}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a}\]
      7.2
    4. Applied simplify to get
      \[\color{red}{\frac{-2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}} \leadsto \color{blue}{\frac{c}{b} \cdot \frac{-2}{2}}\]
      0

    if -1.4516784f-11 < b < 2.163724f+14

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      5.5
    2. Using strategy rm
      5.5
    3. Applied add-cube-cbrt to get
      \[\frac{\left(-b\right) - \color{red}{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\left(-b\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^3}}{2 \cdot a}\]
      5.9
    4. Using strategy rm
      5.9
    5. Applied sub-neg to get
      \[\frac{\color{red}{\left(-b\right) - {\left(\sqrt[3]{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^3}}{2 \cdot a} \leadsto \frac{\color{blue}{\left(-b\right) + \left(-{\left(\sqrt[3]{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^3\right)}}{2 \cdot a}\]
      5.9
    6. Applied simplify to get
      \[\frac{\left(-b\right) + \color{red}{\left(-{\left(\sqrt[3]{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^3\right)}}{2 \cdot a} \leadsto \frac{\left(-b\right) + \color{blue}{\left(-\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\]
      5.5

    if 2.163724f+14 < b

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      23.3
    2. Applied taylor to get
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \leadsto \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}\]
      5.6
    3. Taylor expanded around inf to get
      \[\frac{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a} \leadsto \frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a}\]
      5.6
    4. Applied simplify to get
      \[\color{red}{\frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}} \leadsto \color{blue}{\frac{\frac{c}{b}}{1} - \frac{b}{a}}\]
      0.0
    5. Applied simplify to get
      \[\color{red}{\frac{\frac{c}{b}}{1}} - \frac{b}{a} \leadsto \color{blue}{\frac{c}{b}} - \frac{b}{a}\]
      0.0

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default))
  #:name "The quadratic formula (r2)"
  (/ (- (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a))
  #:target
  (if (< b 0) (/ c (* a (/ (+ (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a))))