Average Error: 53.0 → 5.9
Time: 42.7s
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{-c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{-c}{b}
double f(double a, double b, double c) {
        double r1373399 = b;
        double r1373400 = -r1373399;
        double r1373401 = r1373399 * r1373399;
        double r1373402 = 4.0;
        double r1373403 = a;
        double r1373404 = r1373402 * r1373403;
        double r1373405 = c;
        double r1373406 = r1373404 * r1373405;
        double r1373407 = r1373401 - r1373406;
        double r1373408 = sqrt(r1373407);
        double r1373409 = r1373400 + r1373408;
        double r1373410 = 2.0;
        double r1373411 = r1373410 * r1373403;
        double r1373412 = r1373409 / r1373411;
        return r1373412;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r1373413 = c;
        double r1373414 = -r1373413;
        double r1373415 = b;
        double r1373416 = r1373414 / r1373415;
        return r1373416;
}

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 53.0

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Taylor expanded around inf 5.9

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  3. Simplified5.9

    \[\leadsto \color{blue}{\frac{-c}{b}}\]
  4. Final simplification5.9

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

Reproduce

herbie shell --seed 2019146 +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)))