Average Error: 33.6 → 10.3
Time: 23.1s
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 -9.162654462958633 \cdot 10^{+133}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 3.1006893198213626 \cdot 10^{-130}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}}{3 \cdot a} - \frac{b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 < -9.162654462958633e+133

    1. Initial program 53.8

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Taylor expanded around -inf 53.8

      \[\leadsto \frac{\sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}} - b}{3 \cdot a}\]
    4. Simplified53.8

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot \left(3 \cdot c\right)}} - b}{3 \cdot a}\]
    5. Taylor expanded around -inf 2.9

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

    if -9.162654462958633e+133 < b < 3.1006893198213626e-130

    1. Initial program 11.2

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Taylor expanded around -inf 11.3

      \[\leadsto \frac{\sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}} - b}{3 \cdot a}\]
    4. Simplified11.3

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot \left(3 \cdot c\right)}} - b}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied div-sub11.3

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

    if 3.1006893198213626e-130 < b

    1. Initial program 50.6

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

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

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

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

Reproduce

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