Average Error: 33.3 → 10.4
Time: 37.5s
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.4394879493089332 \cdot 10^{+124}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 1.2388570333802211 \cdot 10^{-103}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c}}\\ \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 < -1.4394879493089332e+124

    1. Initial program 52.0

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

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

    if -1.4394879493089332e+124 < b < 1.2388570333802211e-103

    1. Initial program 11.4

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

    if 1.2388570333802211e-103 < b

    1. Initial program 51.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 clear-num51.2

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

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

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

Runtime

Time bar (total: 37.5s)Debug logProfile

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