Average Error: 33.5 → 9.5
Time: 34.7s
Precision: 64
Internal Precision: 128
\[\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 -2.8180723036556657 \cdot 10^{-82}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \mathbf{elif}\;-b \le 2.776298279814608 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{1}{2} - \frac{b}{a} \cdot \frac{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 3 regimes
  2. if (- b) < -2.8180723036556657e-82

    1. Initial program 53.0

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]

    if -2.8180723036556657e-82 < (- b) < 2.776298279814608e+118

    1. Initial program 12.1

      \[\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*12.1

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

    if 2.776298279814608e+118 < (- b)

    1. Initial program 49.2

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b} - \frac{2}{3} \cdot \frac{b}{a}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;-b \le -2.8180723036556657 \cdot 10^{-82}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \mathbf{elif}\;-b \le 2.776298279814608 \cdot 10^{+118}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{1}{2} - \frac{b}{a} \cdot \frac{2}{3}\\ \end{array}\]

Runtime

Time bar (total: 34.7s)Debug logProfile

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