\[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
Test:
The quadratic formula (r1)
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 21.1 s
Input Error: 17.7
Output Error: 3.7
Log:
Profile: 🕒
\(\begin{cases} \frac{\frac{2 \cdot c}{\frac{b}{a}} - \left(b - \left(-b\right)\right)}{a \cdot 2} & \text{when } b \le -3.840384f-10 \\ \frac{1}{2} \cdot \frac{4 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot a\right) \cdot 4}} & \text{when } b \le 1.7973414f+17 \\ \frac{\frac{4}{2}}{2 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)} & \text{otherwise} \end{cases}\)

    if b < -3.840384f-10

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      17.3
    2. Using strategy rm
      17.3
    3. Applied add-cube-cbrt to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{{\left(\sqrt[3]{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}}{2 \cdot a}\]
      17.6
    4. Applied taylor to get
      \[\frac{{\left(\sqrt[3]{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} \leadsto \frac{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3}{2 \cdot a}\]
      5.1
    5. Taylor expanded around -inf to get
      \[\frac{{\left(\sqrt[3]{\left(-b\right) + \color{red}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3}{2 \cdot a} \leadsto \frac{{\left(\sqrt[3]{\left(-b\right) + \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)}}\right)}^3}{2 \cdot a}\]
      5.1
    6. Applied simplify to get
      \[\frac{{\left(\sqrt[3]{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}\right)}^3}{2 \cdot a} \leadsto \frac{\frac{2 \cdot c}{\frac{b}{a}} - \left(b - \left(-b\right)\right)}{a \cdot 2}\]
      2.5

    7. Applied final simplification

    if -3.840384f-10 < b < 1.7973414f+17

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      12.4
    2. Using strategy rm
      12.4
    3. Applied flip-+ to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{\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}}}}{2 \cdot a}\]
      14.6
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{\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}}}{2 \cdot a} \leadsto \frac{\frac{\color{blue}{\left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
      7.6
    5. Using strategy rm
      7.6
    6. Applied *-un-lft-identity to get
      \[\frac{\color{red}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a} \leadsto \frac{\color{blue}{1 \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
      7.6
    7. Applied times-frac to get
      \[\color{red}{\frac{1 \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}} \leadsto \color{blue}{\frac{1}{2} \cdot \frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{a}}\]
      7.6
    8. Applied simplify to get
      \[\frac{1}{2} \cdot \color{red}{\frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{a}} \leadsto \frac{1}{2} \cdot \color{blue}{\frac{4 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}\]
      5.7
    9. Applied simplify to get
      \[\frac{1}{2} \cdot \frac{4 \cdot c}{\color{red}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}} \leadsto \frac{1}{2} \cdot \frac{4 \cdot c}{\color{blue}{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot a\right) \cdot 4}}}\]
      5.7

    if 1.7973414f+17 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      30.0
    2. Using strategy rm
      30.0
    3. Applied flip-+ to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{\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}}}}{2 \cdot a}\]
      30.8
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{\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}}}{2 \cdot a} \leadsto \frac{\frac{\color{blue}{\left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
      18.0
    5. Using strategy rm
      18.0
    6. Applied *-un-lft-identity to get
      \[\frac{\color{red}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a} \leadsto \frac{\color{blue}{1 \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
      18.0
    7. Applied times-frac to get
      \[\color{red}{\frac{1 \cdot \frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}} \leadsto \color{blue}{\frac{1}{2} \cdot \frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{a}}\]
      18.0
    8. Applied simplify to get
      \[\frac{1}{2} \cdot \color{red}{\frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{a}} \leadsto \frac{1}{2} \cdot \color{blue}{\frac{4 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}\]
      17.7
    9. Applied taylor to get
      \[\frac{1}{2} \cdot \frac{4 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}} \leadsto \frac{1}{2} \cdot \frac{4 \cdot c}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}\]
      4.4
    10. Taylor expanded around inf to get
      \[\frac{1}{2} \cdot \frac{4 \cdot c}{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}} \leadsto \frac{1}{2} \cdot \frac{4 \cdot c}{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\]
      4.4
    11. Applied simplify to get
      \[\color{red}{\frac{1}{2} \cdot \frac{4 \cdot c}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}} \leadsto \color{blue}{\frac{\frac{4}{2}}{\frac{a}{\frac{b}{2}} - \frac{2}{\frac{c}{b}}}}\]
      0.9
    12. Applied simplify to get
      \[\frac{\frac{4}{2}}{\color{red}{\frac{a}{\frac{b}{2}} - \frac{2}{\frac{c}{b}}}} \leadsto \frac{\frac{4}{2}}{\color{blue}{2 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)}}\]
      1.0

  1. Removed slow pow expressions

Original test:


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