Average Error: 28.6 → 0.4
Time: 6.6s
Precision: 64
\[1.05367121277235087 \cdot 10^{-8} \lt a \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt b \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt c \lt 94906265.6242515594\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{0 - 4 \cdot \left(a \cdot c\right)}{-\left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{-2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{0 - 4 \cdot \left(a \cdot c\right)}{-\left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{-2 \cdot a}
double f(double a, double b, double c) {
        double r40823 = b;
        double r40824 = -r40823;
        double r40825 = r40823 * r40823;
        double r40826 = 4.0;
        double r40827 = a;
        double r40828 = r40826 * r40827;
        double r40829 = c;
        double r40830 = r40828 * r40829;
        double r40831 = r40825 - r40830;
        double r40832 = sqrt(r40831);
        double r40833 = r40824 + r40832;
        double r40834 = 2.0;
        double r40835 = r40834 * r40827;
        double r40836 = r40833 / r40835;
        return r40836;
}

double f(double a, double b, double c) {
        double r40837 = 0.0;
        double r40838 = 4.0;
        double r40839 = a;
        double r40840 = c;
        double r40841 = r40839 * r40840;
        double r40842 = r40838 * r40841;
        double r40843 = r40837 - r40842;
        double r40844 = b;
        double r40845 = r40844 * r40844;
        double r40846 = r40838 * r40839;
        double r40847 = r40846 * r40840;
        double r40848 = r40845 - r40847;
        double r40849 = sqrt(r40848);
        double r40850 = r40844 + r40849;
        double r40851 = -r40850;
        double r40852 = r40843 / r40851;
        double r40853 = 2.0;
        double r40854 = r40853 * r40839;
        double r40855 = -r40854;
        double r40856 = r40852 / r40855;
        return r40856;
}

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 28.6

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

    \[\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 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{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  7. Applied distribute-rgt-neg-in0.5

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

    \[\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}\right)}}}{2 \cdot a}\]
  9. Using strategy rm
  10. Applied frac-2neg0.5

    \[\leadsto \color{blue}{\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}\right)}}{-2 \cdot a}}\]
  11. Simplified0.4

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

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

Reproduce

herbie shell --seed 2020003 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))