Average Error: 43.6 → 0.5
Time: 6.8s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{4}{\frac{2}{a \cdot c}} \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{4}{\frac{2}{a \cdot c}} \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 r32465 = b;
        double r32466 = -r32465;
        double r32467 = r32465 * r32465;
        double r32468 = 4.0;
        double r32469 = a;
        double r32470 = r32468 * r32469;
        double r32471 = c;
        double r32472 = r32470 * r32471;
        double r32473 = r32467 - r32472;
        double r32474 = sqrt(r32473);
        double r32475 = r32466 + r32474;
        double r32476 = 2.0;
        double r32477 = r32476 * r32469;
        double r32478 = r32475 / r32477;
        return r32478;
}

double f(double a, double b, double c) {
        double r32479 = 4.0;
        double r32480 = 2.0;
        double r32481 = a;
        double r32482 = c;
        double r32483 = r32481 * r32482;
        double r32484 = r32480 / r32483;
        double r32485 = r32479 / r32484;
        double r32486 = 1.0;
        double r32487 = b;
        double r32488 = -r32487;
        double r32489 = r32487 * r32487;
        double r32490 = r32479 * r32481;
        double r32491 = r32490 * r32482;
        double r32492 = r32489 - r32491;
        double r32493 = sqrt(r32492);
        double r32494 = r32488 - r32493;
        double r32495 = r32486 / r32494;
        double r32496 = r32495 / r32481;
        double r32497 = r32485 * r32496;
        return r32497;
}

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 43.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-+43.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 div-inv0.5

    \[\leadsto \frac{\color{blue}{\left(0 + 4 \cdot \left(a \cdot c\right)\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 + 4 \cdot \left(a \cdot c\right)}{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{4}{\frac{2}{a \cdot c}}} \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{4}{\frac{2}{a \cdot c}} \cdot \frac{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{a}\]

Reproduce

herbie shell --seed 2020021 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))