Average Error: 33.9 → 7.0
Time: 2.3m
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.0467442862822415 \cdot 10^{+134}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.013514672133209 \cdot 10^{-240}:\\ \;\;\;\;\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.3753572696482233 \cdot 10^{+124}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \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.0467442862822415e+134

    1. Initial program 54.4

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

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

    if -2.0467442862822415e+134 < b < 5.013514672133209e-240

    1. Initial program 10.1

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

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

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

    if 5.013514672133209e-240 < b < 1.3753572696482233e+124

    1. Initial program 35.1

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

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

      \[\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 add-cube-cbrt16.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\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}} \cdot \sqrt[3]{\frac{\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}}\right) \cdot \sqrt[3]{\frac{\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 simplify16.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot c\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}}\right)} \cdot \sqrt[3]{\frac{\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}}\]
    8. Applied simplify8.3

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

    if 1.3753572696482233e+124 < b

    1. Initial program 60.2

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -2.0467442862822415 \cdot 10^{+134}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.013514672133209 \cdot 10^{-240}:\\ \;\;\;\;\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.3753572696482233 \cdot 10^{+124}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{(\left(c \cdot a\right) \cdot \left(-3\right) + \left(b \cdot b\right))_*}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \end{array}}\]

Runtime

Time bar (total: 2.3m)Debug logProfile

herbie shell --seed '#(1072330854 3074818769 591214268 3603999196 3863745332 3332387116)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))