Average Error: 52.5 → 50.7
Time: 59.8s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}
double f(double a, double b, double c) {
        double r2026657 = b;
        double r2026658 = -r2026657;
        double r2026659 = r2026657 * r2026657;
        double r2026660 = 4.0;
        double r2026661 = a;
        double r2026662 = r2026660 * r2026661;
        double r2026663 = c;
        double r2026664 = r2026662 * r2026663;
        double r2026665 = r2026659 - r2026664;
        double r2026666 = sqrt(r2026665);
        double r2026667 = r2026658 + r2026666;
        double r2026668 = 2.0;
        double r2026669 = r2026668 * r2026661;
        double r2026670 = r2026667 / r2026669;
        return r2026670;
}

double f(double a, double b, double c) {
        double r2026671 = c;
        double r2026672 = a;
        double r2026673 = -4.0;
        double r2026674 = r2026672 * r2026673;
        double r2026675 = b;
        double r2026676 = r2026675 * r2026675;
        double r2026677 = fma(r2026671, r2026674, r2026676);
        double r2026678 = 0.3333333333333333;
        double r2026679 = pow(r2026677, r2026678);
        double r2026680 = cbrt(r2026679);
        double r2026681 = r2026680 * r2026680;
        double r2026682 = r2026680 * r2026681;
        double r2026683 = cbrt(r2026677);
        double r2026684 = r2026683 * r2026683;
        double r2026685 = r2026682 * r2026684;
        double r2026686 = sqrt(r2026685);
        double r2026687 = sqrt(r2026686);
        double r2026688 = sqrt(r2026677);
        double r2026689 = sqrt(r2026688);
        double r2026690 = -r2026675;
        double r2026691 = fma(r2026687, r2026689, r2026690);
        double r2026692 = 2.0;
        double r2026693 = r2026691 / r2026692;
        double r2026694 = r2026693 / r2026672;
        return r2026694;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.5

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} - b}{2}}{a}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt52.5

    \[\leadsto \frac{\frac{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{2}}{a}\]
  5. Applied sqrt-prod52.3

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{2}}{a}\]
  6. Applied fma-neg51.8

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{2}}{a}\]
  7. Using strategy rm
  8. Applied add-cube-cbrt52.0

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]
  9. Using strategy rm
  10. Applied pow1/350.7

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\left(\sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}\right) \cdot \color{blue}{{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]
  11. Using strategy rm
  12. Applied add-cube-cbrt50.7

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\left(\sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}\right) \cdot \color{blue}{\left(\left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right) \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]
  13. Final simplification50.7

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \left(\sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)\right) \cdot \left(\sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]

Reproduce

herbie shell --seed 2019121 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))