\[\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: 56.5 s
Input Error: 20.0
Output Error: 6.0
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 -1.3252601031533568 \cdot 10^{+154} \\ \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 \le 2.993431952201985 \cdot 10^{+83} \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \left(\frac{2}{a} \cdot \frac{c}{4 \cdot c}\right) \cdot \left(\left(-b\right) - \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}\right) & \text{otherwise} \end{cases}\)

    if b < -1.3252601031533568e+154

    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}\]
      37.2
    2. Using strategy rm
      37.2
    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}\]
      37.2
    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}\]
      37.2
    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}\]
      0.8

    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}}\]
      0.8

    if -1.3252601031533568e+154 < b < 2.993431952201985e+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.7
    2. Using strategy rm
      8.7
    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}\]
      9.0

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

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