\[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
Test:
jeff quadratic root 2
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 20.2 s
Input Error: 21.1
Output Error: 8.7
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}} & \text{when } b \ge 0 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases} & \text{when } b \le -1.2339538201069979 \cdot 10^{+148} \\ \begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt[3]{{\left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^3}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} & \text{when } b \le 2.4608343160951844 \cdot 10^{+34} \\ \frac{c \cdot 2}{(\left({\left(\sqrt[3]{\frac{c}{\frac{b}{a}}}\right)}^3\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\)

    if b < -1.2339538201069979e+148

    1. Started with
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      58.4
    2. Applied taylor to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}\]
      11.5
    3. Taylor expanded around -inf to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}\]
      11.5
    4. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}}\]
      0.0
    5. Applied simplify to get
      \[\begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}} & \text{when } b \ge 0 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0

    if -1.2339538201069979e+148 < b < 2.4608343160951844e+34

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

    if 2.4608343160951844e+34 < b

    1. Started with
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      28.2
    2. Applied taylor to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      8.0
    3. Taylor expanded around inf to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \color{red}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      8.0
    4. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c \cdot 2}{(\left(\frac{c}{\frac{b}{a}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases}}\]
      2.1
    5. Using strategy rm
      2.1
    6. Applied add-cube-cbrt to get
      \[\begin{cases} \frac{c \cdot 2}{(\color{red}{\left(\frac{c}{\frac{b}{a}}\right)} * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c \cdot 2}{(\color{blue}{\left({\left(\sqrt[3]{\frac{c}{\frac{b}{a}}}\right)}^3\right)} * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      2.2

  1. Removed slow pow expressions

Original test:


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