Average Error: 52.5 → 6.3
Time: 16.5s
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 r278568 = b;
        double r278569 = -r278568;
        double r278570 = r278568 * r278568;
        double r278571 = 4.0;
        double r278572 = a;
        double r278573 = r278571 * r278572;
        double r278574 = c;
        double r278575 = r278573 * r278574;
        double r278576 = r278570 - r278575;
        double r278577 = sqrt(r278576);
        double r278578 = r278569 + r278577;
        double r278579 = 2.0;
        double r278580 = r278579 * r278572;
        double r278581 = r278578 / r278580;
        return r278581;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r278582 = c;
        double r278583 = b;
        double r278584 = r278582 / r278583;
        double r278585 = -2.0;
        double r278586 = r278584 * r278585;
        double r278587 = 2.0;
        double r278588 = r278586 / r278587;
        return r278588;
}

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

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

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

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

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

Reproduce

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