Average Error: 52.7 → 50.9
Time: 1.1m
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(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \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)}}}\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(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \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)}}}\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 r2437793 = b;
        double r2437794 = -r2437793;
        double r2437795 = r2437793 * r2437793;
        double r2437796 = 4.0;
        double r2437797 = a;
        double r2437798 = r2437796 * r2437797;
        double r2437799 = c;
        double r2437800 = r2437798 * r2437799;
        double r2437801 = r2437795 - r2437800;
        double r2437802 = sqrt(r2437801);
        double r2437803 = r2437794 + r2437802;
        double r2437804 = 2.0;
        double r2437805 = r2437804 * r2437797;
        double r2437806 = r2437803 / r2437805;
        return r2437806;
}

double f(double a, double b, double c) {
        double r2437807 = c;
        double r2437808 = a;
        double r2437809 = -4.0;
        double r2437810 = r2437808 * r2437809;
        double r2437811 = b;
        double r2437812 = r2437811 * r2437811;
        double r2437813 = fma(r2437807, r2437810, r2437812);
        double r2437814 = 0.3333333333333333;
        double r2437815 = pow(r2437813, r2437814);
        double r2437816 = r2437807 * r2437809;
        double r2437817 = fma(r2437816, r2437808, r2437812);
        double r2437818 = r2437817 * r2437817;
        double r2437819 = cbrt(r2437818);
        double r2437820 = r2437815 * r2437819;
        double r2437821 = sqrt(r2437820);
        double r2437822 = sqrt(r2437821);
        double r2437823 = sqrt(r2437813);
        double r2437824 = sqrt(r2437823);
        double r2437825 = -r2437811;
        double r2437826 = fma(r2437822, r2437824, r2437825);
        double r2437827 = 2.0;
        double r2437828 = r2437826 / r2437827;
        double r2437829 = r2437828 / r2437808;
        return r2437829;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.7

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

    \[\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{\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-neg51.9

    \[\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-cube51.9

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\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(\sqrt{\sqrt{\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/351.3

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

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\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(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{2}}{a}\]
  12. Simplified50.9

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\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(\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.9

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{{\left(\mathsf{fma}\left(c, \left(a \cdot -4\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}} \cdot \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)}}}\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 2019120 +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)))