Average Error: 33.1 → 7.1
Time: 46.4s
Precision: 64
Internal Precision: 3392
\[\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.9457088428946486 \cdot 10^{+104}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.033145501409319 \cdot 10^{-289}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b} \cdot \sqrt[3]{-b}\right) \cdot \left(\sqrt[3]{-b}\right) + \left(\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right))_*}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.0606233538318977 \cdot 10^{+84}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b\right) - 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 4 regimes
  2. if b < -2.9457088428946486e+104

    1. Initial program 46.2

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

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

    if -2.9457088428946486e+104 < b < -5.033145501409319e-289

    1. Initial program 8.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 add-cube-cbrt9.0

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{-b} \cdot \sqrt[3]{-b}\right) \cdot \sqrt[3]{-b}} + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    4. Applied fma-def9.0

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

    if -5.033145501409319e-289 < b < 2.0606233538318977e+84

    1. Initial program 30.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 flip-+30.4

      \[\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/35.0

      \[\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. Simplified21.6

      \[\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)}\]
    6. Using strategy rm
    7. Applied times-frac17.0

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\frac{c \cdot a}{\left(-b\right) - \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}}\]
    10. Using strategy rm
    11. Applied pow116.9

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

      \[\leadsto \color{blue}{{\left(\frac{1}{a}\right)}^{1}} \cdot {\left(\frac{c \cdot a}{\left(-b\right) - \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}\right)}^{1}\]
    13. Applied pow-prod-down16.9

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

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

    if 2.0606233538318977e+84 < b

    1. Initial program 57.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 flip-+57.4

      \[\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/57.6

      \[\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. Simplified30.1

      \[\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)}\]
    6. Using strategy rm
    7. Applied times-frac30.1

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\frac{c \cdot a}{\left(-b\right) - \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}}\]
    10. Using strategy rm
    11. Applied pow130.1

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

      \[\leadsto \color{blue}{{\left(\frac{1}{a}\right)}^{1}} \cdot {\left(\frac{c \cdot a}{\left(-b\right) - \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}\right)}^{1}\]
    13. Applied pow-prod-down30.1

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

      \[\leadsto {\color{blue}{\left(\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}\right)}}^{1}\]
    15. Taylor expanded around 0 3.5

      \[\leadsto {\left(\frac{c}{\left(-b\right) - \color{blue}{b}}\right)}^{1}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.9457088428946486 \cdot 10^{+104}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.033145501409319 \cdot 10^{-289}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b} \cdot \sqrt[3]{-b}\right) \cdot \left(\sqrt[3]{-b}\right) + \left(\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right))_*}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.0606233538318977 \cdot 10^{+84}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b\right) - b}\\ \end{array}\]

Runtime

Time bar (total: 46.4s)Debug logProfile

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