Average Error: 33.2 → 10.1
Time: 29.7s
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 -4.27256945422052 \cdot 10^{+78}:\\ \;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\ \mathbf{elif}\;b \le 2.0666642659220244 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{{\left((b \cdot b + \left(\left(-3 \cdot c\right) \cdot a\right))_*\right)}^{\frac{1}{2}} + \left(-b\right)}{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 < -4.27256945422052e+78

    1. Initial program 41.7

      \[\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*41.7

      \[\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 pow141.7

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

      \[\leadsto \frac{\frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)}^{\left(\frac{1}{2}\right)}}}{3}}{a}\]
    7. Simplified41.7

      \[\leadsto \frac{\frac{\left(-b\right) + {\color{blue}{\left((b \cdot b + \left(a \cdot \left(c \cdot -3\right)\right))_*\right)}}^{\left(\frac{1}{2}\right)}}{3}}{a}\]
    8. Taylor expanded around -inf 5.0

      \[\leadsto \frac{\frac{\color{blue}{-2 \cdot b}}{3}}{a}\]
    9. Simplified5.0

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

    if -4.27256945422052e+78 < b < 2.0666642659220244e-112

    1. Initial program 11.4

      \[\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*11.4

      \[\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 pow111.4

      \[\leadsto \frac{\frac{\left(-b\right) + \sqrt{\color{blue}{{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)}^{1}}}}{3}}{a}\]
    6. Applied sqrt-pow111.4

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

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

    if 2.0666642659220244e-112 < b

    1. Initial program 51.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.27256945422052 \cdot 10^{+78}:\\ \;\;\;\;\frac{\frac{-2 \cdot b}{3}}{a}\\ \mathbf{elif}\;b \le 2.0666642659220244 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{{\left((b \cdot b + \left(\left(-3 \cdot c\right) \cdot a\right))_*\right)}^{\frac{1}{2}} + \left(-b\right)}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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