Average Error: 33.0 → 10.0
Time: 24.4s
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 -2.6503637436944845 \cdot 10^{+56}:\\ \;\;\;\;\frac{\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3}}{a}\\ \mathbf{elif}\;b \le 2.6158185610229234 \cdot 10^{-89}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + \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 < -2.6503637436944845e+56

    1. Initial program 36.0

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3}}{a}\]
    5. Simplified5.6

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

    if -2.6503637436944845e+56 < b < 2.6158185610229234e-89

    1. Initial program 12.5

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

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

    if 2.6158185610229234e-89 < b

    1. Initial program 51.9

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    5. Simplified51.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.6503637436944845 \cdot 10^{+56}:\\ \;\;\;\;\frac{\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3}}{a}\\ \mathbf{elif}\;b \le 2.6158185610229234 \cdot 10^{-89}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + \left(-b\right)}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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