\[\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: 30.7 s
Input Error: 34.1
Output Error: 7.3
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{b} \cdot \frac{-2}{2} & \text{when } b \le -2.6747491353258983 \cdot 10^{+90} \\ \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} & \text{when } b \le -1.6249307588497366 \cdot 10^{-76} \\ \frac{c}{b} \cdot \frac{-2}{2} & \text{when } b \le -1.0745984396746834 \cdot 10^{-89} \\ \frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} & \text{when } b \le 3.741572576046744 \cdot 10^{+123} \\ \left(\frac{c}{b} + \frac{-b}{2 \cdot a}\right) - \frac{\frac{b}{2}}{a} & \text{otherwise} \end{cases}\)

    if b < -2.6747491353258983e+90 or -1.6249307588497366e-76 < b < -1.0745984396746834e-89

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      58.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}\]
      16.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}\]
      16.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.6747491353258983e+90 < b < -1.6249307588497366e-76

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

    if -1.0745984396746834e-89 < b < 3.741572576046744e+123

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

    if 3.741572576046744e+123 < b

    1. Started with
      \[\frac{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      51.0
    2. Using strategy rm
      51.0
    3. Applied div-sub 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{-b}{2 \cdot a} - \frac{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}}\]
      51.0
    4. Applied taylor to get
      \[\frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \leadsto \frac{-b}{2 \cdot a} - \frac{b - 2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}\]
      12.7
    5. Taylor expanded around inf to get
      \[\frac{-b}{2 \cdot a} - \frac{\color{red}{b - 2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} \leadsto \frac{-b}{2 \cdot a} - \frac{\color{blue}{b - 2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a}\]
      12.7
    6. Applied simplify to get
      \[\color{red}{\frac{-b}{2 \cdot a} - \frac{b - 2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}} \leadsto \color{blue}{\left(\frac{\frac{c}{b}}{1} + \frac{-b}{2 \cdot a}\right) - \frac{\frac{b}{2}}{a}}\]
      0.0
    7. Applied simplify to get
      \[\color{red}{\left(\frac{\frac{c}{b}}{1} + \frac{-b}{2 \cdot a}\right)} - \frac{\frac{b}{2}}{a} \leadsto \color{blue}{\left(\frac{c}{b} + \frac{-b}{2 \cdot a}\right)} - \frac{\frac{b}{2}}{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))))