\[\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: 21.1 s
Input Error: 9.9
Output Error: 2.8
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{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} & \text{when } b \le -1.2459677f+19 \\ \begin{cases} \frac{\left(-b\right) - {\left(\sqrt{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^2}{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 9.210374f+08 \\ -\frac{b}{a} & \text{when } b \ge 0 \\ \frac{b}{-2} \cdot \frac{2}{a} & \text{otherwise} \end{cases}\)

    if b < -1.2459677f+19

    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}\]
      18.3
    2. Using strategy rm
      18.3
    3. Applied add-cube-cbrt 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) + \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}{\color{blue}{\left(-b\right) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}} & \text{otherwise} \end{cases}\]
      18.3
    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(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3} & \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(\sqrt[3]{2 \cdot \frac{c \cdot a}{b} - b}\right)}^3} & \text{otherwise} \end{cases}\]
      3.8
    5. 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}{\left(-\color{red}{b}\right) + {\left(\sqrt[3]{2 \cdot \frac{c \cdot a}{b} - b}\right)}^3} & \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(-\color{blue}{b}\right) + {\left(\sqrt[3]{2 \cdot \frac{c \cdot a}{b} - b}\right)}^3} & \text{otherwise} \end{cases}\]
      3.8
    6. 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}{\left(-b\right) + {\left(\sqrt[3]{2 \cdot \frac{c \cdot a}{b} - b}\right)}^3} & \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 \\ \frac{c \cdot 2}{\frac{c \cdot 2}{\frac{b}{a}} - \left(b - \left(-b\right)\right)} & \text{otherwise} \end{cases}\]
      0.5

    7. Applied final simplification

    if -1.2459677f+19 < b < 9.210374f+08

    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}\]
      4.2
    2. Using strategy rm
      4.2
    3. Applied add-sqr-sqrt 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{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^2}}{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}\]
      4.3

    if 9.210374f+08 < 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}\]
      21.3
    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}{-2 \cdot \frac{c \cdot a}{b}} & \text{otherwise} \end{cases}\]
      21.3
    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 \\ \color{red}{\frac{2 \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 \\ \color{blue}{\frac{2 \cdot c}{-2 \cdot \frac{c \cdot a}{b}}} & \text{otherwise} \end{cases}\]
      21.3
    4. Applied simplify to get
      \[\color{red}{\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}{-2 \cdot \frac{c \cdot a}{b}} & \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{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases}}\]
      21.3
    5. 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{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases} \leadsto \begin{cases} -1 \cdot \frac{b}{a} & \text{when } b \ge 0 \\ \frac{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases}\]
      0
    6. Taylor expanded around inf to get
      \[\begin{cases} \color{red}{-1 \cdot \frac{b}{a}} & \text{when } b \ge 0 \\ \frac{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{-1 \cdot \frac{b}{a}} & \text{when } b \ge 0 \\ \frac{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases}\]
      0
    7. Applied simplify to get
      \[\begin{cases} -1 \cdot \frac{b}{a} & \text{when } b \ge 0 \\ \frac{2}{a} \cdot \frac{b}{-2} & \text{otherwise} \end{cases} \leadsto \begin{cases} -\frac{b}{a} & \text{when } b \ge 0 \\ \frac{b}{-2} \cdot \frac{2}{a} & \text{otherwise} \end{cases}\]
      0

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