Average Error: 32.8 → 6.8
Time: 2.4m
Precision: 64
Internal Precision: 3200
\[\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.1834286397028464 \cdot 10^{+102}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.6050472559287528 \cdot 10^{-187}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\\ \mathbf{if}\;b \le 8.761887910400093 \cdot 10^{+69}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3} \cdot \frac{3}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot 3\right) \cdot a}}}\\ \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 < -1.1834286397028464e+102

    1. Initial program 45.1

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

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

    if -1.1834286397028464e+102 < b < 1.6050472559287528e-187

    1. Initial program 9.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-identity9.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}\]
    4. Applied times-frac9.5

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

    if 1.6050472559287528e-187 < b < 8.761887910400093e+69

    1. Initial program 35.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-+35.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 simplify15.9

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

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

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

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

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

    if 8.761887910400093e+69 < 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. Taylor expanded around inf 14.6

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

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

Runtime

Time bar (total: 2.4m)Debug logProfile

herbie shell --seed '#(1064397287 3527694221 3797617954 1138343853 2854031332 1153838279)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))