\[\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: 28.3 s
Input Error: 34.1
Output Error: 8.1
Log:
Profile: 🕒
\(\begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \le -2.2169129342957125 \cdot 10^{+142} \\ \frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \le 3.800668809367847 \cdot 10^{-252} \\ \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} & \text{when } b \le 2.7032921376893094 \cdot 10^{+83} \\ \frac{\frac{4}{\frac{2}{c}}}{\left(\left(-b\right) - b\right) + \left(a \cdot 2\right) \cdot \frac{c}{b}} & \text{otherwise} \end{cases}\)

    if b < -2.2169129342957125e+142

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

    7. Applied final simplification
    8. Applied simplify to get
      \[\color{red}{\frac{1}{\frac{\frac{a}{1}}{a \cdot \frac{c}{b} - b}}} \leadsto \color{blue}{\frac{\frac{c}{b}}{1} - \frac{b}{a}}\]
      0.0

    if -2.2169129342957125e+142 < b < 3.800668809367847e-252

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

    if 3.800668809367847e-252 < b < 2.7032921376893094e+83

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

    if 2.7032921376893094e+83 < b

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

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