Average Error: 43.6 → 0.4
Time: 22.6s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{4 \cdot \left(a \cdot c\right)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{4 \cdot \left(a \cdot c\right)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}
double f(double a, double b, double c) {
        double r46494 = b;
        double r46495 = -r46494;
        double r46496 = r46494 * r46494;
        double r46497 = 4.0;
        double r46498 = a;
        double r46499 = r46497 * r46498;
        double r46500 = c;
        double r46501 = r46499 * r46500;
        double r46502 = r46496 - r46501;
        double r46503 = sqrt(r46502);
        double r46504 = r46495 + r46503;
        double r46505 = 2.0;
        double r46506 = r46505 * r46498;
        double r46507 = r46504 / r46506;
        return r46507;
}

double f(double a, double b, double c) {
        double r46508 = 4.0;
        double r46509 = a;
        double r46510 = c;
        double r46511 = r46509 * r46510;
        double r46512 = r46508 * r46511;
        double r46513 = b;
        double r46514 = -r46513;
        double r46515 = r46513 * r46513;
        double r46516 = r46508 * r46509;
        double r46517 = r46516 * r46510;
        double r46518 = r46515 - r46517;
        double r46519 = sqrt(r46518);
        double r46520 = r46514 - r46519;
        double r46521 = r46509 * r46520;
        double r46522 = 2.0;
        double r46523 = r46521 * r46522;
        double r46524 = r46512 / r46523;
        return r46524;
}

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 + \left(a \cdot c\right) \cdot 4}}{\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(a \cdot c\right) \cdot 4\right) \cdot \frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  7. Applied associate-/l*0.5

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

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

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

Reproduce

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