Average Error: 33.2 → 6.4
Time: 3.3m
Precision: 64
Internal Precision: 3456
\[\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 -5.517326730443747 \cdot 10^{+153}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 4.119783476421463 \cdot 10^{-273}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.8955185749305052 \cdot 10^{+86}:\\ \;\;\;\;\frac{3 \cdot c}{\left(-b\right) - \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}} \cdot \frac{1}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\frac{3}{2} \cdot a\right) \cdot \frac{c}{b} - b \cdot 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 < -5.517326730443747e+153

    1. Initial program 60.7

      \[\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{-2}{3} \cdot \frac{b}{a}}\]

    if -5.517326730443747e+153 < b < 4.119783476421463e-273

    1. Initial program 8.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*8.4

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

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

    if 4.119783476421463e-273 < b < 1.8955185749305052e+86

    1. Initial program 32.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 flip-+32.1

      \[\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 simplify16.5

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

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

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

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

    if 1.8955185749305052e+86 < b

    1. Initial program 58.2

      \[\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-+58.3

      \[\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 simplify30.2

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

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    7. Applied times-frac30.2

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

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

      \[\leadsto \frac{1}{3} \cdot \frac{1 \cdot \left(c \cdot 3\right)}{\color{blue}{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\]
    10. Applied simplify2.6

      \[\leadsto \color{blue}{\frac{c}{\frac{c}{b} \cdot \left(a \cdot \frac{3}{2}\right) - b \cdot 2}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify6.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -5.517326730443747 \cdot 10^{+153}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 4.119783476421463 \cdot 10^{-273}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.8955185749305052 \cdot 10^{+86}:\\ \;\;\;\;\frac{3 \cdot c}{\left(-b\right) - \sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*}} \cdot \frac{1}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\frac{3}{2} \cdot a\right) \cdot \frac{c}{b} - b \cdot 2}\\ \end{array}}\]

Runtime

Time bar (total: 3.3m)Debug logProfile

herbie shell --seed '#(1070578969 3140398606 632207097 462683394 1189254563 964980650)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))