Average Error: 52.1 → 6.5
Time: 23.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 r554417 = b;
        double r554418 = -r554417;
        double r554419 = r554417 * r554417;
        double r554420 = 4.0;
        double r554421 = a;
        double r554422 = r554420 * r554421;
        double r554423 = c;
        double r554424 = r554422 * r554423;
        double r554425 = r554419 - r554424;
        double r554426 = sqrt(r554425);
        double r554427 = r554418 + r554426;
        double r554428 = 2.0;
        double r554429 = r554428 * r554421;
        double r554430 = r554427 / r554429;
        return r554430;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r554431 = c;
        double r554432 = b;
        double r554433 = r554431 / r554432;
        double r554434 = -r554433;
        return r554434;
}

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  4. Simplified6.5

    \[\leadsto \color{blue}{-\frac{c}{b}}\]
  5. Final simplification6.5

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

Reproduce

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