Average Error: 28.3 → 0.5
Time: 6.7m
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{c \cdot \left(4 \cdot a\right)}{\frac{2 \cdot a}{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{c \cdot \left(4 \cdot a\right)}{\frac{2 \cdot a}{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}}
double f(double a, double b, double c) {
        double r39991 = b;
        double r39992 = -r39991;
        double r39993 = r39991 * r39991;
        double r39994 = 4.0;
        double r39995 = a;
        double r39996 = r39994 * r39995;
        double r39997 = c;
        double r39998 = r39996 * r39997;
        double r39999 = r39993 - r39998;
        double r40000 = sqrt(r39999);
        double r40001 = r39992 + r40000;
        double r40002 = 2.0;
        double r40003 = r40002 * r39995;
        double r40004 = r40001 / r40003;
        return r40004;
}

double f(double a, double b, double c) {
        double r40005 = c;
        double r40006 = 4.0;
        double r40007 = a;
        double r40008 = r40006 * r40007;
        double r40009 = r40005 * r40008;
        double r40010 = 2.0;
        double r40011 = r40010 * r40007;
        double r40012 = 1.0;
        double r40013 = b;
        double r40014 = -r40013;
        double r40015 = r40013 * r40013;
        double r40016 = r40007 * r40005;
        double r40017 = r40006 * r40016;
        double r40018 = r40015 - r40017;
        double r40019 = sqrt(r40018);
        double r40020 = r40014 - r40019;
        double r40021 = r40012 / r40020;
        double r40022 = r40011 / r40021;
        double r40023 = r40009 / r40022;
        return r40023;
}

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.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-+28.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 + \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied sub-neg0.4

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

    \[\leadsto \frac{\frac{0 + \left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b + \color{blue}{\left(-4 \cdot \left(a \cdot c\right)\right)}}}}{2 \cdot a}\]
  8. Using strategy rm
  9. Applied div-inv0.5

    \[\leadsto \frac{\color{blue}{\left(0 + \left(4 \cdot a\right) \cdot c\right) \cdot \frac{1}{\left(-b\right) - \sqrt{b \cdot b + \left(-4 \cdot \left(a \cdot c\right)\right)}}}}{2 \cdot a}\]
  10. Applied associate-/l*0.5

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

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

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

Reproduce

herbie shell --seed 2019323 
(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)))