Average Error: 33.6 → 10.1
Time: 6.2s
Precision: binary64
\[\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 -2.01880830474564844 \cdot 10^{144}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \left(-2 \cdot \frac{b}{\sqrt[3]{3}}\right)}{a}\\ \mathbf{elif}\;b \le 7.14280890774386318 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b < -2.01880830474564844e144

    1. Initial program 59.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*59.8

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt59.8

      \[\leadsto \frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}}}{a}\]
    6. Applied *-un-lft-identity59.8

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

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

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

    if -2.01880830474564844e144 < b < 7.14280890774386318e-45

    1. Initial program 13.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*13.2

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

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

    if 7.14280890774386318e-45 < b

    1. Initial program 53.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.01880830474564844 \cdot 10^{144}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \left(-2 \cdot \frac{b}{\sqrt[3]{3}}\right)}{a}\\ \mathbf{elif}\;b \le 7.14280890774386318 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020173 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (neg b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))