Average Error: 52.9 → 0.4
Time: 7.8s
Precision: 64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{1} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}
double f(double a, double b, double c) {
        double r45590 = b;
        double r45591 = -r45590;
        double r45592 = r45590 * r45590;
        double r45593 = 4.0;
        double r45594 = a;
        double r45595 = r45593 * r45594;
        double r45596 = c;
        double r45597 = r45595 * r45596;
        double r45598 = r45592 - r45597;
        double r45599 = sqrt(r45598);
        double r45600 = r45591 + r45599;
        double r45601 = 2.0;
        double r45602 = r45601 * r45594;
        double r45603 = r45600 / r45602;
        return r45603;
}

double f(double a, double b, double c) {
        double r45604 = 0.0;
        double r45605 = 4.0;
        double r45606 = a;
        double r45607 = c;
        double r45608 = r45606 * r45607;
        double r45609 = r45605 * r45608;
        double r45610 = r45604 + r45609;
        double r45611 = b;
        double r45612 = -r45611;
        double r45613 = 1.0;
        double r45614 = sqrt(r45613);
        double r45615 = r45611 * r45611;
        double r45616 = r45605 * r45606;
        double r45617 = r45616 * r45607;
        double r45618 = r45615 - r45617;
        double r45619 = sqrt(r45618);
        double r45620 = r45614 * r45619;
        double r45621 = r45612 - r45620;
        double r45622 = r45610 / r45621;
        double r45623 = 2.0;
        double r45624 = r45623 * r45606;
        double r45625 = r45622 / r45624;
        return r45625;
}

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.9

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

    \[\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 + 4 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{1 \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}}}}{2 \cdot a}\]
  7. Applied sqrt-prod0.4

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

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

Reproduce

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