Average Error: 33.4 → 15.4
Time: 41.0s
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 -1.3436856271288855 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) + \left(-b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.1985411015444033 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(-b\right)}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{3 \cdot a}\\ \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.3436856271288855e+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. Taylor expanded around -inf 11.0

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

    if -1.3436856271288855e+154 < b < 2.1985411015444033e-72

    1. Initial program 12.3

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

    if 2.1985411015444033e-72 < b

    1. Initial program 51.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3436856271288855 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) + \left(-b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.1985411015444033 \cdot 10^{-72}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(-b\right)}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{3 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 41.0s)Debug logProfile

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