Average Error: 43.8 → 0.2
Time: 6.1s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\frac{\mathsf{fma}\left(-\left(4 \cdot a\right) \cdot \left(4 \cdot a\right), c \cdot c, {b}^{4}\right)}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\frac{\mathsf{fma}\left(-\left(4 \cdot a\right) \cdot \left(4 \cdot a\right), c \cdot c, {b}^{4}\right)}{\mathsf{fma}\left(b, b, \left(4 \cdot a\right) \cdot c\right)}}}
double f(double a, double b, double c) {
        double r36805 = b;
        double r36806 = -r36805;
        double r36807 = r36805 * r36805;
        double r36808 = 4.0;
        double r36809 = a;
        double r36810 = r36808 * r36809;
        double r36811 = c;
        double r36812 = r36810 * r36811;
        double r36813 = r36807 - r36812;
        double r36814 = sqrt(r36813);
        double r36815 = r36806 + r36814;
        double r36816 = 2.0;
        double r36817 = r36816 * r36809;
        double r36818 = r36815 / r36817;
        return r36818;
}

double f(double a, double b, double c) {
        double r36819 = 1.0;
        double r36820 = 2.0;
        double r36821 = r36819 / r36820;
        double r36822 = c;
        double r36823 = 4.0;
        double r36824 = r36822 * r36823;
        double r36825 = r36824 / r36819;
        double r36826 = b;
        double r36827 = -r36826;
        double r36828 = a;
        double r36829 = r36823 * r36828;
        double r36830 = r36829 * r36829;
        double r36831 = -r36830;
        double r36832 = r36822 * r36822;
        double r36833 = 4.0;
        double r36834 = pow(r36826, r36833);
        double r36835 = fma(r36831, r36832, r36834);
        double r36836 = r36829 * r36822;
        double r36837 = fma(r36826, r36826, r36836);
        double r36838 = r36835 / r36837;
        double r36839 = sqrt(r36838);
        double r36840 = r36827 - r36839;
        double r36841 = r36825 / r36840;
        double r36842 = r36821 * r36841;
        return r36842;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.8

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+43.8

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  4. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{0 + 4 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  7. Applied *-un-lft-identity0.4

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

    \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  9. Applied times-frac0.4

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

    \[\leadsto \color{blue}{\frac{1}{2}} \cdot \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{a}\]
  11. Simplified0.4

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{4 \cdot \left(a \cdot c\right)}{a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  12. Using strategy rm
  13. Applied associate-/r*0.2

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\frac{4 \cdot \left(a \cdot c\right)}{a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\]
  14. Simplified0.2

    \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{\frac{c \cdot 4}{1}}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
  15. Using strategy rm
  16. Applied flip--0.2

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(\left(4 \cdot a\right) \cdot c\right) \cdot \left(\left(4 \cdot a\right) \cdot c\right)}{b \cdot b + \left(4 \cdot a\right) \cdot c}}}}\]
  17. Simplified0.2

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c \cdot 4}{1}}{\left(-b\right) - \sqrt{\frac{\color{blue}{\mathsf{fma}\left(-\left(4 \cdot a\right) \cdot \left(4 \cdot a\right), c \cdot c, {b}^{4}\right)}}{b \cdot b + \left(4 \cdot a\right) \cdot c}}}\]
  18. Simplified0.2

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

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

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))