\[\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: 24.7 s
Input Error: 21.0
Output Error: 5.3
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{\frac{4}{1} \cdot \frac{c}{2}}{\sqrt{{b}^2 - c \cdot \left(a \cdot 4\right)} + \left(-b\right)} & \text{when } b \ge 0 \\ \frac{c}{\frac{a}{\frac{b}{c}} - b} & \text{otherwise} \end{cases} & \text{when } b \le -6.636085511448982 \cdot 10^{+62} \\ \begin{cases} \frac{\left(-b\right) - \sqrt[3]{{\left(\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 \le 2.0187374307498356 \cdot 10^{-297} \\ \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)}}{a \cdot 2} & \text{when } b \ge 0 \\ \frac{\frac{-2}{a} \cdot \frac{c}{4}}{\frac{b}{a \cdot 2}} & \text{otherwise} \end{cases} & \text{when } b \le 2.7032921376893094 \cdot 10^{+83} \\ \frac{c}{b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{\frac{b}{c}}{a}\right) + \left(-\frac{2}{b}\right))_*} & \text{otherwise} \end{cases}\)

    if b < -6.636085511448982e+62

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

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{4 \cdot \left(a \cdot c\right)}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}\right)} & \text{when } b \ge 0 \\ \frac{\frac{c}{1}}{\frac{c}{b} \cdot a - b} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\frac{4}{1} \cdot \frac{c}{2}}{\sqrt{{b}^2 - c \cdot \left(a \cdot 4\right)} + \left(-b\right)} & \text{when } b \ge 0 \\ \frac{c}{\frac{a}{\frac{b}{c}} - b} & \text{otherwise} \end{cases}}\]
      1.4

    if -6.636085511448982e+62 < b < 2.0187374307498356e-297

    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}\]
      9.6
    2. Using strategy rm
      9.6
    3. Applied add-cbrt-cube 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}{\sqrt[3]{{\left(\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}\]
      9.9

    if 2.0187374307498356e-297 < b < 2.7032921376893094e+83

    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}\]
      8.4
    2. Using strategy rm
      8.4
    3. Applied flip-+ 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 \\ \color{red}{\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 \\ \color{blue}{\frac{2 \cdot c}{\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}}}} & \text{otherwise} \end{cases}\]
      8.4
    4. Applied simplify 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{\color{red}{2 \cdot c}}{\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}}} & \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{\color{blue}{2 \cdot c}}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{otherwise} \end{cases}\]
      8.4
    5. 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}{\frac{\left(4 \cdot a\right) \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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}} & \text{otherwise} \end{cases}\]
      8.4
    6. 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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}} & \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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}} & \text{otherwise} \end{cases}\]
      8.4
    7. Applied simplify 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}{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{2 \cdot a} & \text{when } b \ge 0 \\ \left(\frac{c}{4} \cdot \frac{-2}{a}\right) \cdot \frac{\frac{2}{1}}{\frac{b}{a}} & \text{otherwise} \end{cases}\]
      8.3

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{2 \cdot a} & \text{when } b \ge 0 \\ \left(\frac{c}{4} \cdot \frac{-2}{a}\right) \cdot \frac{\frac{2}{1}}{\frac{b}{a}} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)}}{a \cdot 2} & \text{when } b \ge 0 \\ \frac{\frac{-2}{a} \cdot \frac{c}{4}}{\frac{b}{a \cdot 2}} & \text{otherwise} \end{cases}}\]
      8.4

    if 2.7032921376893094e+83 < b

    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}\]
      43.5
    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}\]
      43.5
    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}\]
      43.5
    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}\]
      11.7
    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}\]
      11.7
    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}}\]
      0.1
    7. Applied taylor 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 \\ 2 \cdot \frac{c}{(2 * \left(\frac{b}{c \cdot a}\right) + \left(-2 \cdot \frac{1}{b}\right))_*} & \text{otherwise} \end{cases}\]
      0.1
    8. Taylor expanded around inf to get
      \[\begin{cases} \frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ 2 \cdot \frac{c}{(2 * \left(\frac{b}{c \cdot a}\right) + \left(-2 \cdot \frac{1}{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 \\ 2 \cdot \frac{c}{(2 * \left(\frac{b}{c \cdot a}\right) + \left(-2 \cdot \frac{1}{b}\right))_*} & \text{otherwise} \end{cases}\]
      0.1
    9. Applied simplify to get
      \[\begin{cases} \frac{c}{1 \cdot b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ 2 \cdot \frac{c}{(2 * \left(\frac{b}{c \cdot a}\right) + \left(-2 \cdot \frac{1}{b}\right))_*} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{b} - \frac{b - \left(-b\right)}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{(2 * \left(\frac{\frac{b}{c}}{a}\right) + \left(-\frac{2}{b}\right))_*} & \text{otherwise} \end{cases}\]
      0.1

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