Average Error: 28.6 → 0.3
Time: 6.8s
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{\frac{4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{4 \cdot \left(a \cdot c\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r44349 = b;
        double r44350 = -r44349;
        double r44351 = r44349 * r44349;
        double r44352 = 4.0;
        double r44353 = a;
        double r44354 = r44352 * r44353;
        double r44355 = c;
        double r44356 = r44354 * r44355;
        double r44357 = r44351 - r44356;
        double r44358 = sqrt(r44357);
        double r44359 = r44350 + r44358;
        double r44360 = 2.0;
        double r44361 = r44360 * r44353;
        double r44362 = r44359 / r44361;
        return r44362;
}

double f(double a, double b, double c) {
        double r44363 = 4.0;
        double r44364 = a;
        double r44365 = c;
        double r44366 = r44364 * r44365;
        double r44367 = r44363 * r44366;
        double r44368 = 2.0;
        double r44369 = r44368 * r44364;
        double r44370 = r44367 / r44369;
        double r44371 = b;
        double r44372 = -r44371;
        double r44373 = r44371 * r44371;
        double r44374 = r44363 * r44364;
        double r44375 = r44374 * r44365;
        double r44376 = r44373 - r44375;
        double r44377 = sqrt(r44376);
        double r44378 = r44372 - r44377;
        double r44379 = r44370 / r44378;
        return r44379;
}

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.5

    \[\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 div-inv0.5

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019344 +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)))