Average Error: 52.3 → 6.4
Time: 22.9s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{c}{b} \cdot -2}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{c}{b} \cdot -2}{2}
double f(double a, double b, double c) {
        double r570190 = b;
        double r570191 = -r570190;
        double r570192 = r570190 * r570190;
        double r570193 = 4.0;
        double r570194 = a;
        double r570195 = r570193 * r570194;
        double r570196 = c;
        double r570197 = r570195 * r570196;
        double r570198 = r570192 - r570197;
        double r570199 = sqrt(r570198);
        double r570200 = r570191 + r570199;
        double r570201 = 2.0;
        double r570202 = r570201 * r570194;
        double r570203 = r570200 / r570202;
        return r570203;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r570204 = c;
        double r570205 = b;
        double r570206 = r570204 / r570205;
        double r570207 = -2.0;
        double r570208 = r570206 * r570207;
        double r570209 = 2.0;
        double r570210 = r570208 / r570209;
        return r570210;
}

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. Simplified52.3

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)} - b}{a}}{2}}\]
  3. Taylor expanded around inf 6.4

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{c}{b}}}{2}\]
  4. Final simplification6.4

    \[\leadsto \frac{\frac{c}{b} \cdot -2}{2}\]

Reproduce

herbie shell --seed 2019144 +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 a) c)))) (* 2 a)))