\[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
Test:
jeff quadratic root 1
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 19.1 s
Input Error: 9.1
Output Error: 1.3
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} & \text{when } {b}^2 - \left(4 \cdot a\right) \cdot c \le 2.6680062f+38 \\ -\frac{b}{a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\frac{2 \cdot c}{\frac{b}{a}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\)

    if (- (sqr b) (* (* 4 a) c)) < 2.6680062f+38

    1. Started with
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
      1.0
    2. Using strategy rm
      1.0
    3. Applied pow1 to get
      \[\begin{cases} \frac{\color{red}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\color{blue}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
      1.1

    if 2.6680062f+38 < (- (sqr b) (* (* 4 a) c))

    1. Started with
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
      23.0
    2. Using strategy rm
      23.0
    3. Applied pow1 to get
      \[\begin{cases} \frac{\color{red}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\color{blue}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
      23.0
    4. Applied taylor to get
      \[\begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases}\]
      15.2
    5. Taylor expanded around -inf to get
      \[\begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\color{red}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases}\]
      15.2
    6. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{\frac{c \cdot 2}{\frac{b}{a}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}}\]
      13.1
    7. Using strategy rm
      13.1
    8. Applied add-exp-log to get
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot \color{red}{2}}{\frac{c \cdot 2}{\frac{b}{a}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot \color{blue}{2}}{\frac{c \cdot 2}{e^{\log \left(\frac{b}{a}\right)}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      20.7
    9. Applied add-exp-log to get
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{\color{red}{c} \cdot 2}{\frac{c \cdot 2}{e^{\log \left(\frac{b}{a}\right)}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{\color{blue}{c} \cdot 2}{\frac{e^{\log \left(c \cdot 2\right)}}{e^{\log \left(\frac{b}{a}\right)}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      24.9
    10. Applied div-exp to get
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{\color{red}{c \cdot 2}}{\frac{e^{\log \left(c \cdot 2\right)}}{e^{\log \left(\frac{b}{a}\right)}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{\color{blue}{c \cdot 2}}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      25.5
    11. Applied taylor to get
      \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} -1 \cdot \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      14.1
    12. Taylor expanded around inf to get
      \[\begin{cases} \color{red}{-1 \cdot \frac{b}{a}} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{-1 \cdot \frac{b}{a}} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      14.1
    13. Applied simplify to get
      \[\begin{cases} -1 \cdot \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{e^{\log \left(c \cdot 2\right) - \log \left(\frac{b}{a}\right)} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} -\frac{b}{a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\frac{2 \cdot c}{\frac{b}{a}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      1.7

    14. Applied final simplification

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default))
  #:name "jeff quadratic root 1"
  (if (>= b 0) (/ (- (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a)) (/ (* 2 c) (+ (- b) (sqrt (- (sqr b) (* (* 4 a) c)))))))