Average Error: 33.3 → 10.8
Time: 30.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 -1.0593974114674551 \cdot 10^{+154}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 3.3018599764394035 \cdot 10^{-162}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 9.101978235945472 \cdot 10^{-64} \lor \neg \left(b \le 6.947376908923824 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(c \cdot a\right) \cdot 3}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \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.0593974114674551e+154

    1. Initial program 60.9

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

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

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

    if -1.0593974114674551e+154 < b < 3.3018599764394035e-162

    1. Initial program 10.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 *-un-lft-identity10.4

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b\right)} + 1 \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    5. Applied distribute-lft-out10.4

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

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

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

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

    if 3.3018599764394035e-162 < b < 9.101978235945472e-64 or 6.947376908923824e-19 < b

    1. Initial program 50.1

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

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

    if 9.101978235945472e-64 < b < 6.947376908923824e-19

    1. Initial program 36.9

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

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

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

      \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification10.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.0593974114674551 \cdot 10^{+154}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 3.3018599764394035 \cdot 10^{-162}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 9.101978235945472 \cdot 10^{-64} \lor \neg \left(b \le 6.947376908923824 \cdot 10^{-19}\right):\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(c \cdot a\right) \cdot 3}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \end{array}\]

Runtime

Time bar (total: 30.4s)Debug logProfile

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