Average Error: 33.8 → 7.4
Time: 2.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 -5.4469088373616604 \cdot 10^{+72}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.589477461284389 \cdot 10^{-229}:\\ \;\;\;\;\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;b \le 1.317751034211994 \cdot 10^{+120}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \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 < -5.4469088373616604e+72

    1. Initial program 40.7

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

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

    if -5.4469088373616604e+72 < b < 1.589477461284389e-229

    1. Initial program 10.4

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.4

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

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

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

    if 1.589477461284389e-229 < b < 1.317751034211994e+120

    1. Initial program 35.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-+35.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 simplify16.8

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(a \cdot 3\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-cbrt17.5

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

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

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

    if 1.317751034211994e+120 < b

    1. Initial program 59.9

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -5.4469088373616604 \cdot 10^{+72}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.589477461284389 \cdot 10^{-229}:\\ \;\;\;\;\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;b \le 1.317751034211994 \cdot 10^{+120}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \end{array}}\]

Runtime

Time bar (total: 2.9m)Debug logProfile

herbie shell --seed 2018201 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))