\[\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: 25.8 s
Input Error: 40.5
Output Error: 6.8
Log:
Profile: 🕒
\(\begin{cases} \frac{\frac{c \cdot 4}{(\left(a \cdot 2\right) * \left(\frac{c}{b}\right) + \left(-b\right))_* - b}}{2} & \text{when } b \le -2.874810909131491 \cdot 10^{-160} \\ \frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}} & \text{when } b \le 8.164018341878614 \cdot 10^{+86} \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases}\)

    if b < -2.874810909131491e-160

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      59.2
    2. Using strategy rm
      59.2
    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}\]
      59.2
    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}\]
      39.8
    5. Applied taylor to get
      \[\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 \frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}{2 \cdot a}\]
      17.7
    6. Taylor expanded around -inf to get
      \[\frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \color{red}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)}}}{2 \cdot a} \leadsto \frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)}}}{2 \cdot a}\]
      17.7
    7. Applied simplify to get
      \[\color{red}{\frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}}{2 \cdot a}} \leadsto \color{blue}{\frac{\frac{4 \cdot c}{\left(2 \cdot a\right) \cdot \frac{c}{b} - \left(b - \left(-b\right)\right)}}{2}}\]
      5.8
    8. Applied simplify to get
      \[\frac{\color{red}{\frac{4 \cdot c}{\left(2 \cdot a\right) \cdot \frac{c}{b} - \left(b - \left(-b\right)\right)}}}{2} \leadsto \frac{\color{blue}{\frac{c \cdot 4}{(\left(a \cdot 2\right) * \left(\frac{c}{b}\right) + \left(-b\right))_* - b}}}{2}\]
      5.8

    if -2.874810909131491e-160 < b < 8.164018341878614e+86

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      11.3
    2. Using strategy rm
      11.3
    3. Applied clear-num to get
      \[\color{red}{\frac{\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}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}}\]
      11.5

    if 8.164018341878614e+86 < b

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