Average Error: 28.2 → 0.4
Time: 3.8m
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{2}{\frac{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}{\frac{c \cdot a}{a}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{2}{\frac{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}{\frac{c \cdot a}{a}}}
double f(double a, double b, double c) {
        double r15819363 = b;
        double r15819364 = -r15819363;
        double r15819365 = r15819363 * r15819363;
        double r15819366 = 4.0;
        double r15819367 = a;
        double r15819368 = r15819366 * r15819367;
        double r15819369 = c;
        double r15819370 = r15819368 * r15819369;
        double r15819371 = r15819365 - r15819370;
        double r15819372 = sqrt(r15819371);
        double r15819373 = r15819364 + r15819372;
        double r15819374 = 2.0;
        double r15819375 = r15819374 * r15819367;
        double r15819376 = r15819373 / r15819375;
        return r15819376;
}

double f(double a, double b, double c) {
        double r15819377 = 2.0;
        double r15819378 = b;
        double r15819379 = -r15819378;
        double r15819380 = c;
        double r15819381 = -4.0;
        double r15819382 = a;
        double r15819383 = r15819381 * r15819382;
        double r15819384 = r15819378 * r15819378;
        double r15819385 = fma(r15819380, r15819383, r15819384);
        double r15819386 = sqrt(r15819385);
        double r15819387 = r15819379 - r15819386;
        double r15819388 = r15819380 * r15819382;
        double r15819389 = r15819388 / r15819382;
        double r15819390 = r15819387 / r15819389;
        double r15819391 = r15819377 / r15819390;
        return r15819391;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.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-+28.3

    \[\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/28.3

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

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

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

    \[\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. Using strategy rm
  10. Applied times-frac0.3

    \[\leadsto \frac{\color{blue}{\frac{4}{2} \cdot \frac{c \cdot a}{a}}}{\left(-b\right) - \sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*}}\]
  11. Applied associate-/l*0.4

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

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

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

Reproduce

herbie shell --seed 2019107 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))