\[\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: 19.9 s
Input Error: 16.1
Output Error: 3.0
Log:
Profile: 🕒
\(\begin{cases} \frac{-b}{a} & \text{when } b \le -6.5355834f+18 \\ \frac{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \le -1.5102728f-36 \\ \frac{1}{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{\frac{2}{4}}{c}} & \text{when } b \le 1.11538095f+18 \\ \frac{1}{\frac{a}{b} - \frac{b}{c}} & \text{otherwise} \end{cases}\)

    if b < -6.5355834f+18

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

    if -6.5355834f+18 < b < -1.5102728f-36

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

    if -1.5102728f-36 < b < 1.11538095f+18

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      15.4
    2. Using strategy rm
      15.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}\]
      17.0
    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}\]
      6.6
    5. Using strategy rm
      6.6
    6. Applied clear-num to get
      \[\color{red}{\frac{\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}{\frac{2 \cdot a}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}}\]
      6.6
    7. Applied simplify to get
      \[\frac{1}{\color{red}{\frac{2 \cdot a}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}} \leadsto \frac{1}{\color{blue}{\left(\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)}\right) \cdot \frac{\frac{2}{4}}{c}}}\]
      4.2
    8. Applied simplify to get
      \[\frac{1}{\color{red}{\left(\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)}\right)} \cdot \frac{\frac{2}{4}}{c}} \leadsto \frac{1}{\color{blue}{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)} \cdot \frac{\frac{2}{4}}{c}}\]
      4.2

    if 1.11538095f+18 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      30.4
    2. Using strategy rm
      30.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}\]
      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.2
    5. Using strategy rm
      18.2
    6. Applied clear-num to get
      \[\color{red}{\frac{\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}{\frac{2 \cdot a}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}}\]
      18.2
    7. Applied simplify to get
      \[\frac{1}{\color{red}{\frac{2 \cdot a}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}} \leadsto \frac{1}{\color{blue}{\left(\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)}\right) \cdot \frac{\frac{2}{4}}{c}}}\]
      18.0
    8. Applied taylor to get
      \[\frac{1}{\left(\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(4 \cdot c\right)}\right) \cdot \frac{\frac{2}{4}}{c}} \leadsto \frac{1}{\frac{a}{b} - \frac{b}{c}}\]
      1.1
    9. Taylor expanded around inf to get
      \[\frac{1}{\color{red}{\frac{a}{b} - \frac{b}{c}}} \leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}}\]
      1.1
    10. Applied simplify to get
      \[\frac{1}{\frac{a}{b} - \frac{b}{c}} \leadsto \frac{1}{\frac{a}{b} - \frac{b}{c}}\]
      1.1

    11. Applied final simplification

  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))))))