Average Error: 33.3 → 13.6
Time: 1.9m
Precision: 64
Internal Precision: 3392
\[\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 -1.5271211438746283 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 6.291612184465563 \cdot 10^{-290}:\\ \;\;\;\;\left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;b \le 7.424801401370643 \cdot 10^{-07}:\\ \;\;\;\;\left(\sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}}\right) \cdot \sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \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 < -1.5271211438746283e+154

    1. Initial program 60.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify60.9

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

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

    if -1.5271211438746283e+154 < b < 6.291612184465563e-290

    1. Initial program 8.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify8.6

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied div-inv8.7

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

    if 6.291612184465563e-290 < b < 7.424801401370643e-07

    1. Initial program 26.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify26.1

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip--26.2

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}}{3 \cdot a}\]
    5. Applied simplify17.6

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt18.2

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}} \cdot \sqrt[3]{\frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}}}\]
    8. Applied simplify18.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{-c}{1}}{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} + b}} \cdot \sqrt[3]{\frac{\frac{-c}{1}}{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} + b}}\right)} \cdot \sqrt[3]{\frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}}\]
    9. Applied simplify11.9

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

    if 7.424801401370643e-07 < b

    1. Initial program 54.3

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

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip--54.3

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}}{3 \cdot a}\]
    5. Applied simplify27.1

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Taylor expanded around 0 17.9

      \[\leadsto \frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\color{blue}{b} + b}}{3 \cdot a}\]
    7. Applied simplify6.6

      \[\leadsto \color{blue}{\frac{c}{b + b} \cdot \left(-1\right)}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify13.6

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -1.5271211438746283 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 6.291612184465563 \cdot 10^{-290}:\\ \;\;\;\;\left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;b \le 7.424801401370643 \cdot 10^{-07}:\\ \;\;\;\;\left(\sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}}\right) \cdot \sqrt[3]{\frac{-c}{b + \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}}\]

Runtime

Time bar (total: 1.9m)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))