Average Error: 32.8 → 6.9
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 -4.0192067564031934 \cdot 10^{+81}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.353643662375777 \cdot 10^{-194}:\\ \;\;\;\;\left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;b \le 8.270234179848068 \cdot 10^{+66}:\\ \;\;\;\;\frac{3}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}} \cdot \frac{\frac{c}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}}{3}\\ \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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b < -4.0192067564031934e+81

    1. Initial program 41.4

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

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

    if -4.0192067564031934e+81 < b < 5.353643662375777e-194

    1. Initial program 10.2

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

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

    if 5.353643662375777e-194 < b < 8.270234179848068e+66

    1. Initial program 33.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 flip-+34.0

      \[\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.0

      \[\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-cbrt15.8

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

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

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

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

    if 8.270234179848068e+66 < b

    1. Initial program 57.3

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

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

      \[\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 simplify6.9

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -4.0192067564031934 \cdot 10^{+81}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.353643662375777 \cdot 10^{-194}:\\ \;\;\;\;\left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;b \le 8.270234179848068 \cdot 10^{+66}:\\ \;\;\;\;\frac{3}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}} \cdot \frac{\frac{c}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \end{array}}\]

Runtime

Time bar (total: 2.9m)Debug logProfile

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