Average Error: 33.4 → 13.7
Time: 1.7m
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}\;\frac{e^{\log \left(\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}\right)}}{a} = -\infty:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \mathbf{if}\;\frac{e^{\log \left(\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}\right)}}{a} \le -2.8269366980670845 \cdot 10^{-237}:\\ \;\;\;\;\left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;\frac{e^{\log \left(\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}\right)}}{a} \le 9.99969371226089 \cdot 10^{-276}:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \mathbf{if}\;\frac{e^{\log \left(\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}\right)}}{a} \le 8.593915327562348 \cdot 10^{+292}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{-2}}{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 3 regimes
  2. if (/ (exp (log (/ (- (sqrt (fma (* 3 a) (- c) (* b b))) b) 3))) a) < -inf.0 or -2.8269366980670845e-237 < (/ (exp (log (/ (- (sqrt (fma (* 3 a) (- c) (* b b))) b) 3))) a) < 9.99969371226089e-276 or 8.593915327562348e+292 < (/ (exp (log (/ (- (sqrt (fma (* 3 a) (- c) (* b b))) b) 3))) a)

    1. Initial program 58.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify58.3

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c}}}\]
    6. Applied simplify22.9

      \[\leadsto \color{blue}{\frac{\frac{c}{-2}}{b}}\]

    if -inf.0 < (/ (exp (log (/ (- (sqrt (fma (* 3 a) (- c) (* b b))) b) 3))) a) < -2.8269366980670845e-237

    1. Initial program 2.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify2.6

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied div-inv2.7

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

    if 9.99969371226089e-276 < (/ (exp (log (/ (- (sqrt (fma (* 3 a) (- c) (* b b))) b) 3))) a) < 8.593915327562348e+292

    1. Initial program 2.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify2.0

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied associate-/r*2.1

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1072840222 1305617769 1692503039 1353360431 4178980589 1488672652)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))