Average Error: 43.8 → 0.2
Time: 2.7m
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{2 \cdot c}{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{2 \cdot c}{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}
double f(double a, double b, double c) {
        double r11428748 = b;
        double r11428749 = -r11428748;
        double r11428750 = r11428748 * r11428748;
        double r11428751 = 4.0;
        double r11428752 = a;
        double r11428753 = r11428751 * r11428752;
        double r11428754 = c;
        double r11428755 = r11428753 * r11428754;
        double r11428756 = r11428750 - r11428755;
        double r11428757 = sqrt(r11428756);
        double r11428758 = r11428749 + r11428757;
        double r11428759 = 2.0;
        double r11428760 = r11428759 * r11428752;
        double r11428761 = r11428758 / r11428760;
        return r11428761;
}

double f(double a, double b, double c) {
        double r11428762 = 2.0;
        double r11428763 = c;
        double r11428764 = r11428762 * r11428763;
        double r11428765 = b;
        double r11428766 = -r11428765;
        double r11428767 = -4.0;
        double r11428768 = a;
        double r11428769 = r11428767 * r11428768;
        double r11428770 = r11428765 * r11428765;
        double r11428771 = fma(r11428763, r11428769, r11428770);
        double r11428772 = sqrt(r11428771);
        double r11428773 = r11428766 - r11428772;
        double r11428774 = r11428764 / r11428773;
        return r11428774;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 43.8

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

    \[\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. Applied associate-/l/43.8

    \[\leadsto \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(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  5. Simplified0.4

    \[\leadsto \frac{\color{blue}{4 \cdot \left(c \cdot a\right)}}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}\]
  6. Using strategy rm
  7. Applied associate-/r*0.2

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

    \[\leadsto \frac{\frac{4 \cdot \left(c \cdot a\right)}{2 \cdot a}}{\color{blue}{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}}\]
  9. Taylor expanded around inf 0.2

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

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

Reproduce

herbie shell --seed 2019119 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))