Average Error: 32.9 → 13.2
Time: 2.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{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.296572940367273 \cdot 10^{+304}:\\ \;\;\;\;\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 -1.4538140493456847 \cdot 10^{-294}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{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 9.443131150140715 \cdot 10^{-293}:\\ \;\;\;\;\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.245234970109524 \cdot 10^{+298}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{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.296572940367273e+304 or -1.4538140493456847e-294 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < 9.443131150140715e-293 or 6.245234970109524e+298 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a))

    1. Initial program 58.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify58.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 clear-num58.6

      \[\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}}}\]
    6. Applied simplify22.2

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

    if -2.296572940367273e+304 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < -1.4538140493456847e-294 or 9.443131150140715e-293 < (* (/ 1 3) (/ (exp (log (- (sqrt (fma (* 3 a) (- c) (* b b))) b))) a)) < 6.245234970109524e+298

    1. Initial program 2.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify2.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 *-un-lft-identity2.2

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

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

Runtime

Time bar (total: 2.7m)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)))