Average Error: 52.3 → 0.2
Time: 7.3s
Precision: 64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{1}{2} \cdot \frac{\frac{4 \cdot \left(a \cdot c\right)}{a}}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right) + \left(-b\right)\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\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{4 \cdot \left(a \cdot c\right)}{a}}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right) + \left(-b\right)\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right)}
double f(double a, double b, double c) {
        double r39827 = b;
        double r39828 = -r39827;
        double r39829 = r39827 * r39827;
        double r39830 = 4.0;
        double r39831 = a;
        double r39832 = r39830 * r39831;
        double r39833 = c;
        double r39834 = r39832 * r39833;
        double r39835 = r39829 - r39834;
        double r39836 = sqrt(r39835);
        double r39837 = r39828 + r39836;
        double r39838 = 2.0;
        double r39839 = r39838 * r39831;
        double r39840 = r39837 / r39839;
        return r39840;
}

double f(double a, double b, double c) {
        double r39841 = 1.0;
        double r39842 = 2.0;
        double r39843 = r39841 / r39842;
        double r39844 = 4.0;
        double r39845 = a;
        double r39846 = c;
        double r39847 = r39845 * r39846;
        double r39848 = r39844 * r39847;
        double r39849 = r39848 / r39845;
        double r39850 = b;
        double r39851 = r39850 * r39850;
        double r39852 = r39844 * r39845;
        double r39853 = r39852 * r39846;
        double r39854 = r39851 - r39853;
        double r39855 = sqrt(r39854);
        double r39856 = sqrt(r39841);
        double r39857 = -r39856;
        double r39858 = r39857 + r39856;
        double r39859 = r39855 * r39858;
        double r39860 = -r39850;
        double r39861 = r39859 + r39860;
        double r39862 = r39855 * r39856;
        double r39863 = -r39862;
        double r39864 = r39861 + r39863;
        double r39865 = r39849 / r39864;
        double r39866 = r39843 * r39865;
        return r39866;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 52.3

    \[\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-+52.3

    \[\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)}{\left(-b\right) - \sqrt{\color{blue}{1 \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}}}}{2 \cdot a}\]
  7. Applied sqrt-prod0.4

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  9. Applied distribute-lft-neg-in0.5

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

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

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

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right)\right)}}}{2 \cdot a}\]
  15. 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(\mathsf{fma}\left(\sqrt{b}, -\sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{1}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(\left(-\sqrt{1}\right) + \sqrt{1}\right)\right)}}{2 \cdot a}\]
  16. Applied times-frac0.4

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

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

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

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

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

Reproduce

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