Average Error: 33.2 → 6.8
Time: 1.4m
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 \cdot \frac{-2}{3} \le -1.275170712274417 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot \left(\frac{3}{2} \cdot c\right) - \left(b + b\right)}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.1464991806727138 \cdot 10^{-297}:\\ \;\;\;\;\frac{\frac{c}{1}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 2.234611788502158 \cdot 10^{+137}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{a}\\ \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 (* -2/3 b) < -1.275170712274417e+99

    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 clear-num58.2

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip-+58.2

      \[\leadsto \frac{1}{\frac{3 \cdot a}{\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}}}}}\]
    6. Applied associate-/r/58.2

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\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}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    7. Applied associate-/r*58.2

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{3 \cdot a}{\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}}}\]
    8. Applied simplify30.7

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

      \[\leadsto \frac{1 \cdot \frac{c}{1}}{\color{blue}{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\]
    10. Applied simplify2.4

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

    if -1.275170712274417e+99 < (* -2/3 b) < -1.1464991806727138e-297

    1. Initial program 32.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 clear-num32.4

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip-+32.5

      \[\leadsto \frac{1}{\frac{3 \cdot a}{\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}}}}}\]
    6. Applied associate-/r/32.5

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\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}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    7. Applied associate-/r*32.5

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{3 \cdot a}{\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}}}\]
    8. Applied simplify8.1

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

    if -1.1464991806727138e-297 < (* -2/3 b) < 2.234611788502158e+137

    1. Initial program 9.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 *-un-lft-identity9.7

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

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

    if 2.234611788502158e+137 < (* -2/3 b)

    1. Initial program 55.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 associate-/r*55.2

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}}\]
    4. Taylor expanded around -inf 3.0

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.275170712274417 \cdot 10^{+99}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot \left(\frac{3}{2} \cdot c\right) - \left(b + b\right)}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.1464991806727138 \cdot 10^{-297}:\\ \;\;\;\;\frac{\frac{c}{1}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 2.234611788502158 \cdot 10^{+137}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1070258749 1877548225 2229079127 1588002776 3179087814 1886870650)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))