Average Error: 43.9 → 12.0
Time: 14.0s
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 r37640 = b;
        double r37641 = -r37640;
        double r37642 = r37640 * r37640;
        double r37643 = 4.0;
        double r37644 = a;
        double r37645 = r37643 * r37644;
        double r37646 = c;
        double r37647 = r37645 * r37646;
        double r37648 = r37642 - r37647;
        double r37649 = sqrt(r37648);
        double r37650 = r37641 + r37649;
        double r37651 = 2.0;
        double r37652 = r37651 * r37644;
        double r37653 = r37650 / r37652;
        return r37653;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r37654 = -1.0;
        double r37655 = c;
        double r37656 = b;
        double r37657 = r37655 / r37656;
        double r37658 = r37654 * r37657;
        return r37658;
}

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

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

    \[\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.0

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

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

Reproduce

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