Average Error: 44.2 → 42.6
Time: 1.7m
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right)} \cdot {\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}\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{\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right)} \cdot {\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}\right), \left(-b\right)\right)}{2}}{a}
double f(double a, double b, double c) {
        double r9083775 = b;
        double r9083776 = -r9083775;
        double r9083777 = r9083775 * r9083775;
        double r9083778 = 4.0;
        double r9083779 = a;
        double r9083780 = r9083778 * r9083779;
        double r9083781 = c;
        double r9083782 = r9083780 * r9083781;
        double r9083783 = r9083777 - r9083782;
        double r9083784 = sqrt(r9083783);
        double r9083785 = r9083776 + r9083784;
        double r9083786 = 2.0;
        double r9083787 = r9083786 * r9083779;
        double r9083788 = r9083785 / r9083787;
        return r9083788;
}

double f(double a, double b, double c) {
        double r9083789 = c;
        double r9083790 = a;
        double r9083791 = -4.0;
        double r9083792 = r9083790 * r9083791;
        double r9083793 = b;
        double r9083794 = r9083793 * r9083793;
        double r9083795 = fma(r9083789, r9083792, r9083794);
        double r9083796 = sqrt(r9083795);
        double r9083797 = sqrt(r9083796);
        double r9083798 = r9083789 * r9083791;
        double r9083799 = fma(r9083798, r9083790, r9083794);
        double r9083800 = r9083799 * r9083799;
        double r9083801 = cbrt(r9083800);
        double r9083802 = 0.3333333333333333;
        double r9083803 = pow(r9083795, r9083802);
        double r9083804 = r9083801 * r9083803;
        double r9083805 = sqrt(r9083804);
        double r9083806 = sqrt(r9083805);
        double r9083807 = -r9083793;
        double r9083808 = fma(r9083797, r9083806, r9083807);
        double r9083809 = 2.0;
        double r9083810 = r9083808 / r9083809;
        double r9083811 = r9083810 / r9083790;
        return r9083811;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 44.2

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

    \[\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-sqrt44.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}\]
  5. Applied fma-neg43.6

    \[\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}\]
  6. Using strategy rm
  7. Applied add-cbrt-cube43.7

    \[\leadsto \frac{\frac{\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{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  8. Using strategy rm
  9. Applied pow1/343.3

    \[\leadsto \frac{\frac{\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{\color{blue}{{\left(\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  10. Using strategy rm
  11. Applied unpow-prod-down43.3

    \[\leadsto \frac{\frac{\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{\color{blue}{{\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot {\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  12. Simplified42.6

    \[\leadsto \frac{\frac{\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{\color{blue}{\sqrt[3]{\mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\left(c \cdot -4\right), a, \left(b \cdot b\right)\right)}} \cdot {\left(\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}\right), \left(-b\right)\right)}{2}}{a}\]
  13. Final simplification42.6

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

Reproduce

herbie shell --seed 2019125 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))