Average Error: 52.4 → 6.3
Time: 13.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 r271284 = b;
        double r271285 = -r271284;
        double r271286 = r271284 * r271284;
        double r271287 = 4.0;
        double r271288 = a;
        double r271289 = r271287 * r271288;
        double r271290 = c;
        double r271291 = r271289 * r271290;
        double r271292 = r271286 - r271291;
        double r271293 = sqrt(r271292);
        double r271294 = r271285 + r271293;
        double r271295 = 2.0;
        double r271296 = r271295 * r271288;
        double r271297 = r271294 / r271296;
        return r271297;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r271298 = c;
        double r271299 = b;
        double r271300 = r271298 / r271299;
        double r271301 = -2.0;
        double r271302 = r271300 * r271301;
        double r271303 = 2.0;
        double r271304 = r271302 / r271303;
        return r271304;
}

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

    \[\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.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 2019156 +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)))