Average Error: 33.3 → 13.6
Time: 1.1m
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{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le -2.301732462954068 \cdot 10^{+293}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \cdot -2}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le -4.0190563147564545 \cdot 10^{-278}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}{3 \cdot a} - \frac{b}{3 \cdot a}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le 5.3495813227163156 \cdot 10^{-304}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \cdot -2}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le 4.955832818806549 \cdot 10^{+297}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}{3 \cdot a} - \frac{b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \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 2 regimes
  2. if (* (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) a)) < -2.301732462954068e+293 or -4.0190563147564545e-278 < (* (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) a)) < 5.3495813227163156e-304 or 4.955832818806549e+297 < (* (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) a))

    1. Initial program 58.4

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

      \[\leadsto \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.4

      \[\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 22.8

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

    if -2.301732462954068e+293 < (* (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) a)) < -4.0190563147564545e-278 or 5.3495813227163156e-304 < (* (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) (/ (sqrt (- (sqrt (fma (* 3 a) (- c) (* b b))) b)) a)) < 4.955832818806549e+297

    1. Initial program 2.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le -2.301732462954068 \cdot 10^{+293}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \cdot -2}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le -4.0190563147564545 \cdot 10^{-278}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}{3 \cdot a} - \frac{b}{3 \cdot a}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le 5.3495813227163156 \cdot 10^{-304}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \cdot -2}\\ \mathbf{elif}\;\frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}{a} \le 4.955832818806549 \cdot 10^{+297}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}{3 \cdot a} - \frac{b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{b}{c} \cdot -2}\\ \end{array}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed 2018217 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))