Average Error: 44.2 → 0.2
Time: 2.3m
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{\frac{c}{\frac{1}{4}}}{\mathsf{fma}\left(\left(\sqrt{b}\right), \left(-\sqrt{b}\right), \left(-\sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot \left(c \cdot a\right)\right)\right)}\right)\right)} \cdot \frac{1}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{c}{\frac{1}{4}}}{\mathsf{fma}\left(\left(\sqrt{b}\right), \left(-\sqrt{b}\right), \left(-\sqrt{\mathsf{fma}\left(b, b, \left(-4 \cdot \left(c \cdot a\right)\right)\right)}\right)\right)} \cdot \frac{1}{2}
double f(double a, double b, double c) {
        double r12761254 = b;
        double r12761255 = -r12761254;
        double r12761256 = r12761254 * r12761254;
        double r12761257 = 4.0;
        double r12761258 = a;
        double r12761259 = r12761257 * r12761258;
        double r12761260 = c;
        double r12761261 = r12761259 * r12761260;
        double r12761262 = r12761256 - r12761261;
        double r12761263 = sqrt(r12761262);
        double r12761264 = r12761255 + r12761263;
        double r12761265 = 2.0;
        double r12761266 = r12761265 * r12761258;
        double r12761267 = r12761264 / r12761266;
        return r12761267;
}

double f(double a, double b, double c) {
        double r12761268 = c;
        double r12761269 = 0.25;
        double r12761270 = r12761268 / r12761269;
        double r12761271 = b;
        double r12761272 = sqrt(r12761271);
        double r12761273 = -r12761272;
        double r12761274 = -4.0;
        double r12761275 = a;
        double r12761276 = r12761268 * r12761275;
        double r12761277 = r12761274 * r12761276;
        double r12761278 = fma(r12761271, r12761271, r12761277);
        double r12761279 = sqrt(r12761278);
        double r12761280 = -r12761279;
        double r12761281 = fma(r12761272, r12761273, r12761280);
        double r12761282 = r12761270 / r12761281;
        double r12761283 = 0.5;
        double r12761284 = r12761282 * r12761283;
        return r12761284;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 44.2

    \[\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-+44.2

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

    \[\leadsto \frac{\frac{4 \cdot \left(c \cdot a\right)}{\color{blue}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}}{2 \cdot a}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\color{blue}{1 \cdot \frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}}{2 \cdot a}\]
  8. Applied times-frac0.4

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}{a}}\]
  9. Simplified0.4

    \[\leadsto \color{blue}{\frac{1}{2}} \cdot \frac{\frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \left(-4 \cdot a\right), \left(b \cdot b\right)\right)}}}{a}\]
  10. Simplified0.2

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\frac{c}{\frac{1}{4}}}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot c\right) \cdot -4\right)\right)}}}\]
  11. Using strategy rm
  12. Applied add-sqr-sqrt0.3

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c}{\frac{1}{4}}}{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot c\right) \cdot -4\right)\right)}}\]
  13. Applied distribute-rgt-neg-in0.3

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c}{\frac{1}{4}}}{\color{blue}{\sqrt{b} \cdot \left(-\sqrt{b}\right)} - \sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot c\right) \cdot -4\right)\right)}}\]
  14. Applied fma-neg0.2

    \[\leadsto \frac{1}{2} \cdot \frac{\frac{c}{\frac{1}{4}}}{\color{blue}{\mathsf{fma}\left(\left(\sqrt{b}\right), \left(-\sqrt{b}\right), \left(-\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot c\right) \cdot -4\right)\right)}\right)\right)}}\]
  15. Final simplification0.2

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

Reproduce

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