Average Error: 52.6 → 0.1
Time: 20.6s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{4 \cdot c}{-\left(\sqrt{\mathsf{fma}\left(\left(-c\right) \cdot a, 4, b \cdot b\right)} + b\right)} \cdot \frac{1}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{4 \cdot c}{-\left(\sqrt{\mathsf{fma}\left(\left(-c\right) \cdot a, 4, b \cdot b\right)} + b\right)} \cdot \frac{1}{2}
double f(double a, double b, double c) {
        double r30359 = b;
        double r30360 = -r30359;
        double r30361 = r30359 * r30359;
        double r30362 = 4.0;
        double r30363 = a;
        double r30364 = r30362 * r30363;
        double r30365 = c;
        double r30366 = r30364 * r30365;
        double r30367 = r30361 - r30366;
        double r30368 = sqrt(r30367);
        double r30369 = r30360 + r30368;
        double r30370 = 2.0;
        double r30371 = r30370 * r30363;
        double r30372 = r30369 / r30371;
        return r30372;
}

double f(double a, double b, double c) {
        double r30373 = 4.0;
        double r30374 = c;
        double r30375 = r30373 * r30374;
        double r30376 = -r30374;
        double r30377 = a;
        double r30378 = r30376 * r30377;
        double r30379 = b;
        double r30380 = r30379 * r30379;
        double r30381 = fma(r30378, r30373, r30380);
        double r30382 = sqrt(r30381);
        double r30383 = r30382 + r30379;
        double r30384 = -r30383;
        double r30385 = r30375 / r30384;
        double r30386 = 1.0;
        double r30387 = 2.0;
        double r30388 = r30386 / r30387;
        double r30389 = r30385 * r30388;
        return r30389;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

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

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

    \[\leadsto \frac{\frac{0 + \left(c \cdot a\right) \cdot 4}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, 4 \cdot \left(-a\right), {b}^{2}\right)}\right)}}}{2 \cdot a}\]
  8. Applied *-un-lft-identity0.4

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

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

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\frac{\left(a \cdot c\right) \cdot 4}{a}}{-\left(b + \sqrt{\mathsf{fma}\left(-a \cdot c, 4, b \cdot b\right)}\right)}}\]
  13. Taylor expanded around 0 0.1

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

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))