\[\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.8 s
Input Error: 17.8
Output Error: 3.4
Log:
Profile: 🕒
\(\begin{cases} \frac{(1 * \left(-b\right) + \left(\frac{c \cdot 2}{\frac{b}{a}} - b\right))_*}{2 \cdot a} & \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 *-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}\]
      20.8
    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}\]
      20.8
    5. Applied taylor to get
      \[\frac{(1 * \left(-b\right) + \left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right))_*}{2 \cdot a} \leadsto \frac{(1 * \left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right))_*}{2 \cdot a}\]
      5.9
    6. Taylor expanded around -inf to get
      \[\frac{(1 * \left(-b\right) + \color{red}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)})_*}{2 \cdot a} \leadsto \frac{(1 * \left(-b\right) + \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} - b\right)})_*}{2 \cdot a}\]
      5.9
    7. Applied simplify to get
      \[\frac{(1 * \left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right))_*}{2 \cdot a} \leadsto \frac{(1 * \left(-b\right) + \left(\frac{c \cdot 2}{\frac{b}{a}} - b\right))_*}{2 \cdot a}\]
      1.7

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