Average Error: 33.1 → 11.2
Time: 20.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 -5.6099127179805805 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 1.315376901720017 \cdot 10^{-150}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{3}}{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 < -5.6099127179805805e+135

    1. Initial program 54.6

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

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

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

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

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

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

    if -5.6099127179805805e+135 < b < 1.315376901720017e-150

    1. Initial program 10.4

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied associate-/r*10.4

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

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

    if 1.315376901720017e-150 < b

    1. Initial program 49.0

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

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

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

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

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

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

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

Reproduce

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