Average Error: 33.6 → 10.3
Time: 1.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 -7.157205061319747 \cdot 10^{+120}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{-2}{3} + \frac{1}{2} \cdot \frac{c}{b}\\ \mathbf{if}\;b \le 1.8802171205348477 \cdot 10^{-59}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 3 regimes
  2. if b < -7.157205061319747e+120

    1. Initial program 50.6

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

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

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

    if -7.157205061319747e+120 < b < 1.8802171205348477e-59

    1. Initial program 13.7

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

    if 1.8802171205348477e-59 < b

    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 18.9

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

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

Runtime

Time bar (total: 1.9m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))