\[\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: 17.3 s
Input Error: 29.2
Output Error: 3.4
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{1}{\frac{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*}{2 \cdot c}} & \text{otherwise} \end{cases} & \text{when } {b}^2 - \left(4 \cdot a\right) \cdot c \le 1.8236611171008294 \cdot 10^{-299} \\ \begin{cases} \frac{\left(-b\right) - {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{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.99396857392479 \cdot 10^{+279} \\ {\left(\sqrt[3]{\frac{c}{b} - \frac{b - \left(-b\right)}{2 \cdot a}}\right)}^3 & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}\)

    if (- (sqr b) (* (* 4 a) c)) < 1.8236611171008294e-299

    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}\]
      61.7
    2. Applied taylor to get
      \[\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} \leadsto \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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases}\]
      34.1
    3. Taylor expanded around -inf to get
      \[\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}{\color{red}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases} \leadsto \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}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases}\]
      34.1
    4. Applied taylor to get
      \[\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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}{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}\]
      16.3
    5. Taylor expanded around inf to get
      \[\begin{cases} \frac{\left(-b\right) - \color{red}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}{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 \begin{cases} \frac{\left(-b\right) - \color{blue}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}{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}\]
      16.3
    6. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}{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{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}}\]
      7.8
    7. Using strategy rm
      7.8
    8. Applied clear-num to get
      \[\begin{cases} \frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{1}{\frac{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*}{2 \cdot c}} & \text{otherwise} \end{cases}\]
      7.9

    if 1.8236611171008294e-299 < (- (sqr b) (* (* 4 a) c)) < 2.99396857392479e+279

    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}\]
      0.1
    2. Using strategy rm
      0.1
    3. Applied add-cube-cbrt to get
      \[\begin{cases} \frac{\left(-b\right) - \color{red}{\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{\left(-b\right) - \color{blue}{{\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}}{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}\]
      0.6

    if 2.99396857392479e+279 < (- (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}\]
      44.2
    2. Applied taylor to get
      \[\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} \leadsto \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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases}\]
      28.9
    3. Taylor expanded around -inf to get
      \[\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}{\color{red}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases} \leadsto \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}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}} & \text{otherwise} \end{cases}\]
      28.9
    4. Applied taylor to get
      \[\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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}{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}\]
      14.3
    5. Taylor expanded around inf to get
      \[\begin{cases} \frac{\left(-b\right) - \color{red}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}{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 \begin{cases} \frac{\left(-b\right) - \color{blue}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}}{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}\]
      14.3
    6. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}{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{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}}\]
      3.1
    7. Using strategy rm
      3.1
    8. Applied add-cube-cbrt to get
      \[\begin{cases} \color{red}{\frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a}} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{{\left(\sqrt[3]{\frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a}}\right)}^3} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}\]
      3.6
    9. Applied simplify to get
      \[\begin{cases} {\color{red}{\left(\sqrt[3]{\frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a}}\right)}}^3 & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases} \leadsto \begin{cases} {\color{blue}{\left(\sqrt[3]{\frac{c}{b} - \frac{b - \left(-b\right)}{2 \cdot a}}\right)}}^3 & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{c}{b} \cdot a\right) + \left(\left(-b\right) - b\right))_*} & \text{otherwise} \end{cases}\]
      3.6

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