Average Error: 52.3 → 0.1
Time: 23.2s
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{c \cdot \frac{4 \cdot a}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{c \cdot \frac{4 \cdot a}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r31566 = b;
        double r31567 = -r31566;
        double r31568 = r31566 * r31566;
        double r31569 = 4.0;
        double r31570 = a;
        double r31571 = r31569 * r31570;
        double r31572 = c;
        double r31573 = r31571 * r31572;
        double r31574 = r31568 - r31573;
        double r31575 = sqrt(r31574);
        double r31576 = r31567 + r31575;
        double r31577 = 2.0;
        double r31578 = r31577 * r31570;
        double r31579 = r31576 / r31578;
        return r31579;
}

double f(double a, double b, double c) {
        double r31580 = c;
        double r31581 = 4.0;
        double r31582 = a;
        double r31583 = r31581 * r31582;
        double r31584 = 2.0;
        double r31585 = r31584 * r31582;
        double r31586 = r31583 / r31585;
        double r31587 = r31580 * r31586;
        double r31588 = b;
        double r31589 = -r31588;
        double r31590 = r31588 * r31588;
        double r31591 = r31583 * r31580;
        double r31592 = r31590 - r31591;
        double r31593 = sqrt(r31592);
        double r31594 = r31589 - r31593;
        double r31595 = r31587 / r31594;
        return r31595;
}

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 52.3

    \[\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.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. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(4 \cdot a, c, 0\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied associate-/l/0.4

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

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

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

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.93038e-32 a 2.02824e+31) (< 4.93038e-32 b 2.02824e+31) (< 4.93038e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))