Average Error: 33.0 → 9.4
Time: 7.4m
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 -1.9834326805253997 \cdot 10^{+93}:\\ \;\;\;\;\frac{\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{a}}{3}\\ \mathbf{elif}\;b \le 3.674306053800843 \cdot 10^{-85}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + \left(-b\right)}{a}}{3}\\ \mathbf{elif}\;b \le 4.058689078958963 \cdot 10^{+84}:\\ \;\;\;\;\frac{\left(a \cdot 3\right) \cdot c}{\left(\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot \left(a \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 4 regimes
  2. if b < -1.9834326805253997e+93

    1. Initial program 42.3

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

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

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

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

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

    if -1.9834326805253997e+93 < b < 3.674306053800843e-85

    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 *-commutative12.5

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

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

      \[\leadsto \frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(a \cdot 3\right)} \cdot c}}{a}}{3}\]
    7. Applied associate-*l*12.6

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

    if 3.674306053800843e-85 < b < 4.058689078958963e+84

    1. Initial program 42.3

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}}}}{3 \cdot a}\]
    6. Applied associate-/l/44.7

      \[\leadsto \color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}\right)}}\]
    7. Simplified17.0

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

    if 4.058689078958963e+84 < b

    1. Initial program 58.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.9834326805253997 \cdot 10^{+93}:\\ \;\;\;\;\frac{\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{a}}{3}\\ \mathbf{elif}\;b \le 3.674306053800843 \cdot 10^{-85}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + \left(-b\right)}{a}}{3}\\ \mathbf{elif}\;b \le 4.058689078958963 \cdot 10^{+84}:\\ \;\;\;\;\frac{\left(a \cdot 3\right) \cdot c}{\left(\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot \left(a \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

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