\[\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: 20.4 s
Input Error: 17.8
Output Error: 3.4
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 -1.3462214f+10 \\ \frac{(1 * \left(-b\right) + \left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right))_*}{2 \cdot a} & \text{when } b \le 1.75507f-11 \\ \frac{c \cdot \frac{4}{2}}{(\left(\frac{c}{\frac{b}{a}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}\)

    if b < -1.3462214f+10

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

    7. Applied final simplification

    if -1.3462214f+10 < b < 1.75507f-11

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      5.7
    2. Using strategy rm
      5.7
    3. Applied *-un-lft-identity 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}{1 \cdot \left(-b\right)} + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      5.7
    4. Applied fma-def to get
      \[\frac{\color{red}{1 \cdot \left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{(1 * \left(-b\right) + \left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right))_*}}{2 \cdot a}\]
      5.7

    if 1.75507f-11 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      28.0
    2. Using strategy rm
      28.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}\]
      29.5
    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 add-exp-log 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}{e^{\log \left(\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}\right)}}\]
      21.4
    7. Applied simplify to get
      \[e^{\color{red}{\log \left(\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}\right)}} \leadsto e^{\color{blue}{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}\right)}}\]
      20.7
    8. Applied taylor to get
      \[e^{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}\right)} \leadsto e^{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}\right)}\]
      16.4
    9. Taylor expanded around inf to get
      \[e^{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \color{red}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}\right)} \leadsto e^{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \color{blue}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}\right)}\]
      16.4
    10. Applied simplify to get
      \[e^{\log \left(\frac{\frac{4}{2} \cdot \left(1 \cdot c\right)}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}\right)} \leadsto \frac{c \cdot \frac{4}{2}}{(\left(\frac{c}{\frac{b}{a}}\right) * 2 + \left(\left(-b\right) - b\right))_*}\]
      2.0

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