Average Error: 33.9 → 13.5
Time: 2.2m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{{\left(e^{\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)} \cdot \sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}\right)}^{\left(\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}\right)}}{2 \cdot a} \le -5.0932387033100606 \cdot 10^{+302}:\\ \;\;\;\;\frac{c}{b + b} \cdot \frac{-4}{2}\\ \mathbf{elif}\;\frac{{\left(e^{\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)} \cdot \sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}\right)}^{\left(\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}\right)}}{2 \cdot a} \le -2.4227732924595846 \cdot 10^{-268}:\\ \;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{2 \cdot a}\\ \mathbf{elif}\;\frac{{\left(e^{\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)} \cdot \sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}\right)}^{\left(\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}\right)}}{2 \cdot a} \le 4.245273862080994 \cdot 10^{-233}:\\ \;\;\;\;\frac{c}{b + b} \cdot \frac{-4}{2}\\ \mathbf{elif}\;\frac{{\left(e^{\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)} \cdot \sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}}\right)}^{\left(\sqrt[3]{\log \left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)}\right)}}{2 \cdot a} \le 2.3461818191212974 \cdot 10^{+307}:\\ \;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b + b} \cdot \frac{-4}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if (/ (pow (exp (* (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b)))) (* 2 a)) < -5.0932387033100606e+302 or -2.4227732924595846e-268 < (/ (pow (exp (* (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b)))) (* 2 a)) < 4.245273862080994e-233 or 2.3461818191212974e+307 < (/ (pow (exp (* (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b)))) (* 2 a))

    1. Initial program 58.6

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}} \cdot \frac{1}{2 \cdot a}\]
    7. Applied associate-*l/59.2

      \[\leadsto \color{blue}{\frac{\left(\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b \cdot b\right) \cdot \frac{1}{2 \cdot a}}{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}\]
    8. Applied simplify38.2

      \[\leadsto \frac{\color{blue}{\frac{\left(a \cdot 4\right) \cdot \left(-c\right)}{2 \cdot a}}}{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\]
    9. Taylor expanded around 0 28.5

      \[\leadsto \frac{\frac{\left(a \cdot 4\right) \cdot \left(-c\right)}{2 \cdot a}}{\color{blue}{b} + b}\]
    10. Applied simplify22.1

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

    if -5.0932387033100606e+302 < (/ (pow (exp (* (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b)))) (* 2 a)) < -2.4227732924595846e-268 or 4.245273862080994e-233 < (/ (pow (exp (* (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b))))) (cbrt (log (- (sqrt (fma (* 4 a) (- c) (* b b))) b)))) (* 2 a)) < 2.3461818191212974e+307

    1. Initial program 2.5

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

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

Runtime

Time bar (total: 2.2m)Debug logProfile

herbie shell --seed 2018208 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))