Average Error: 33.0 → 7.0
Time: 1.9m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -3.328231680185204 \cdot 10^{+142}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 2.2437730199938516 \cdot 10^{-188}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{if}\;b \le 4.4544913419980745 \cdot 10^{+156}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\right) \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-3}{2}}{3}}{\frac{b}{c}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 4 regimes
  2. if b < -3.328231680185204e+142

    1. Initial program 55.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 3.1

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}}\]

    if -3.328231680185204e+142 < b < 2.2437730199938516e-188

    1. Initial program 9.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]

    if 2.2437730199938516e-188 < b < 4.4544913419980745e+156

    1. Initial program 38.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+38.7

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied simplify15.4

      \[\leadsto \frac{\frac{\color{blue}{3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt15.9

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}} \cdot \sqrt[3]{\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}}\]
    7. Applied simplify15.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\right)} \cdot \sqrt[3]{\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}\]
    8. Applied simplify7.0

      \[\leadsto \left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\right) \cdot \color{blue}{\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}}\]

    if 4.4544913419980745e+156 < b

    1. Initial program 62.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*62.9

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}}\]
    4. Taylor expanded around inf 14.1

      \[\leadsto \frac{\frac{\color{blue}{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}}{3}}{a}\]
    5. Applied simplify2.5

      \[\leadsto \color{blue}{\frac{\frac{\frac{-3}{2}}{3}}{\frac{b}{c}}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.9m)Debug logProfile

herbie shell --seed '#(1070227846 1561819246 480764335 4016816270 2602869839 2117310382)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))