Average Error: 28.3 → 0.5
Time: 16.6s
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{\left(a \cdot c\right) \cdot 4}{2} \cdot \frac{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\left(a \cdot c\right) \cdot 4}{2} \cdot \frac{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{a}
double f(double a, double b, double c) {
        double r42984 = b;
        double r42985 = -r42984;
        double r42986 = r42984 * r42984;
        double r42987 = 4.0;
        double r42988 = a;
        double r42989 = r42987 * r42988;
        double r42990 = c;
        double r42991 = r42989 * r42990;
        double r42992 = r42986 - r42991;
        double r42993 = sqrt(r42992);
        double r42994 = r42985 + r42993;
        double r42995 = 2.0;
        double r42996 = r42995 * r42988;
        double r42997 = r42994 / r42996;
        return r42997;
}

double f(double a, double b, double c) {
        double r42998 = a;
        double r42999 = c;
        double r43000 = r42998 * r42999;
        double r43001 = 4.0;
        double r43002 = r43000 * r43001;
        double r43003 = 2.0;
        double r43004 = r43002 / r43003;
        double r43005 = 1.0;
        double r43006 = b;
        double r43007 = -r43006;
        double r43008 = r43006 * r43006;
        double r43009 = r43001 * r42998;
        double r43010 = r43009 * r42999;
        double r43011 = r43008 - r43010;
        double r43012 = sqrt(r43011);
        double r43013 = r43007 - r43012;
        double r43014 = r43005 / r43013;
        double r43015 = r43014 / r42998;
        double r43016 = r43004 * r43015;
        return r43016;
}

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 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 a\right) \cdot c}}}}{2 \cdot a}\]
  7. Applied times-frac0.5

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

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

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

Reproduce

herbie shell --seed 2019306 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.05367121277235087e-8 a 94906265.6242515594) (< 1.05367121277235087e-8 b 94906265.6242515594) (< 1.05367121277235087e-8 c 94906265.6242515594))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))