Average Error: 32.9 → 13.3
Time: 2.5m
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{1}{3} \cdot \frac{e^{\log \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}{a} \le -2.212765075172074 \cdot 10^{+292}:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \mathbf{if}\;\frac{1}{3} \cdot \frac{e^{\log \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}{a} \le -2.226407994696937 \cdot 10^{-279}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}\\ \mathbf{if}\;\frac{1}{3} \cdot \frac{e^{\log \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}{a} \le 4.8143301513763585 \cdot 10^{-290}:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \mathbf{if}\;\frac{1}{3} \cdot \frac{e^{\log \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}{a} \le 6.034710991470305 \cdot 10^{+294}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot 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 2 regimes
  2. if (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < -2.212765075172074e+292 or -2.226407994696937e-279 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < 4.8143301513763585e-290 or 6.034710991470305e+294 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a))

    1. Initial program 58.2

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

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

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

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

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

    if -2.212765075172074e+292 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < -2.226407994696937e-279 or 4.8143301513763585e-290 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < 6.034710991470305e+294

    1. Initial program 2.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify2.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. Recombined 2 regimes into one program.

Runtime

Time bar (total: 2.5m)Debug logProfile

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