\[\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: 26.9 s
Input Error: 36.2
Output Error: 4.2
Log:
Profile: 🕒
\(\begin{cases} \frac{-b}{a} & \text{when } b \le -1.4548518266586696 \cdot 10^{-17} \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \le 1.0428439038139104 \cdot 10^{-180} \\ \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 3.234382095771044 \cdot 10^{+66} \\ \frac{c}{b} \cdot \frac{-2}{2} & \text{otherwise} \end{cases}\)

    if b < -1.4548518266586696e-17

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      37.7
    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 -1.4548518266586696e-17 < b < 1.0428439038139104e-180

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      11.9

    if 1.0428439038139104e-180 < b < 3.234382095771044e+66

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

    if 3.234382095771044e+66 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      57.8
    2. Applied taylor to get
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leadsto \frac{-2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}\]
      15.3
    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}\]
      15.3
    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

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