Average Error: 43.7 → 12.1
Time: 12.5s
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}\]
\[-1 \cdot \frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-1 \cdot \frac{c}{b}
double f(double a, double b, double c) {
        double r25529 = b;
        double r25530 = -r25529;
        double r25531 = r25529 * r25529;
        double r25532 = 4.0;
        double r25533 = a;
        double r25534 = r25532 * r25533;
        double r25535 = c;
        double r25536 = r25534 * r25535;
        double r25537 = r25531 - r25536;
        double r25538 = sqrt(r25537);
        double r25539 = r25530 + r25538;
        double r25540 = 2.0;
        double r25541 = r25540 * r25533;
        double r25542 = r25539 / r25541;
        return r25542;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r25543 = -1.0;
        double r25544 = c;
        double r25545 = b;
        double r25546 = r25544 / r25545;
        double r25547 = r25543 * r25546;
        return r25547;
}

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Simplified43.7

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a}}\]
  3. Taylor expanded around inf 12.1

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  4. Final simplification12.1

    \[\leadsto -1 \cdot \frac{c}{b}\]

Reproduce

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