Average Error: 33.7 → 29.7
Time: 46.4s
Precision: 64
\[\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.3370483339861573 \cdot 10^{+141}:\\ \;\;\;\;\frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 2 regimes
  2. if b < 1.3370483339861573e+141

    1. Initial program 27.2

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

      \[\leadsto \color{blue}{\frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity27.3

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b\right)}}{3 \cdot a}\]
    5. Applied times-frac27.3

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

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

    if 1.3370483339861573e+141 < b

    1. Initial program 61.1

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

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

      \[\leadsto \color{blue}{0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1.3370483339861573 \cdot 10^{+141}:\\ \;\;\;\;\frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

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