\[\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: 16.7 s
Input Error: 16.3
Output Error: 2.7
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{b} \cdot \frac{-2}{2} & \text{when } b \le -2.724577f+18 \\ \frac{1}{\left(\left(-b\right) + \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}\right) \cdot \frac{\frac{2}{c}}{4}} & \text{when } b \le -7.617411f-30 \\ \frac{\left(-b\right) - {\left(\sqrt{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^2}{2 \cdot a} & \text{when } b \le 9.210374f+08 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases}\)

    if b < -2.724577f+18

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      30.5
    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 -2.724577f+18 < b < -7.617411f-30

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      16.7
    2. Using strategy rm
      16.7
    3. Applied flip-- to get
      \[\frac{\color{red}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}\right)}^2}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}}{2 \cdot a}\]
      18.3
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}\right)}^2}}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\frac{\color{blue}{c \cdot \left(4 \cdot a\right)}}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}\]
      6.3
    5. Using strategy rm
      6.3
    6. Applied clear-num to get
      \[\color{red}{\frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}} \leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}}}\]
      6.3
    7. Applied simplify to get
      \[\frac{1}{\color{red}{\frac{2 \cdot a}{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}}} \leadsto \frac{1}{\color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\right) \cdot \left(\frac{1}{c} \cdot \frac{2}{4}\right)}}\]
      3.5
    8. Applied simplify to get
      \[\frac{1}{\color{red}{\left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\right)} \cdot \left(\frac{1}{c} \cdot \frac{2}{4}\right)} \leadsto \frac{1}{\color{blue}{\left(\left(-b\right) + \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}\right)} \cdot \left(\frac{1}{c} \cdot \frac{2}{4}\right)}\]
      3.5
    9. Applied simplify to get
      \[\frac{1}{\left(\left(-b\right) + \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}\right) \cdot \color{red}{\left(\frac{1}{c} \cdot \frac{2}{4}\right)}} \leadsto \frac{1}{\left(\left(-b\right) + \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}\right) \cdot \color{blue}{\frac{\frac{2}{c}}{4}}}\]
      3.5

    if -7.617411f-30 < b < 9.210374f+08

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      4.9
    2. Using strategy rm
      4.9
    3. Applied add-sqr-sqrt 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{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}\right)}^2}}{2 \cdot a}\]
      5.1

    if 9.210374f+08 < b

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      21.0
    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}\]
      6.1
    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}\]
      6.1
    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))))