Average Error: 43.7 → 0.2
Time: 5.9s
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 r32741 = b;
        double r32742 = -r32741;
        double r32743 = r32741 * r32741;
        double r32744 = 4.0;
        double r32745 = a;
        double r32746 = r32744 * r32745;
        double r32747 = c;
        double r32748 = r32746 * r32747;
        double r32749 = r32743 - r32748;
        double r32750 = sqrt(r32749);
        double r32751 = r32742 + r32750;
        double r32752 = 2.0;
        double r32753 = r32752 * r32745;
        double r32754 = r32751 / r32753;
        return r32754;
}

double f(double a, double b, double c) {
        double r32755 = 1.0;
        double r32756 = 2.0;
        double r32757 = r32755 / r32756;
        double r32758 = c;
        double r32759 = 4.0;
        double r32760 = r32758 * r32759;
        double r32761 = r32760 / r32755;
        double r32762 = b;
        double r32763 = -r32762;
        double r32764 = a;
        double r32765 = r32759 * r32764;
        double r32766 = r32765 * r32765;
        double r32767 = -r32766;
        double r32768 = r32758 * r32758;
        double r32769 = 4.0;
        double r32770 = pow(r32762, r32769);
        double r32771 = fma(r32767, r32768, r32770);
        double r32772 = r32765 * r32758;
        double r32773 = fma(r32762, r32762, r32772);
        double r32774 = r32771 / r32773;
        double r32775 = sqrt(r32774);
        double r32776 = r32763 - r32775;
        double r32777 = r32761 / r32776;
        double r32778 = r32757 * r32777;
        return r32778;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.7

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

    \[\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 2020064 +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)))