Average Error: 53.0 → 5.8
Time: 28.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{\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 r1094096 = b;
        double r1094097 = -r1094096;
        double r1094098 = r1094096 * r1094096;
        double r1094099 = 4.0;
        double r1094100 = a;
        double r1094101 = r1094099 * r1094100;
        double r1094102 = c;
        double r1094103 = r1094101 * r1094102;
        double r1094104 = r1094098 - r1094103;
        double r1094105 = sqrt(r1094104);
        double r1094106 = r1094097 + r1094105;
        double r1094107 = 2.0;
        double r1094108 = r1094107 * r1094100;
        double r1094109 = r1094106 / r1094108;
        return r1094109;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r1094110 = c;
        double r1094111 = b;
        double r1094112 = r1094110 / r1094111;
        double r1094113 = -2.0;
        double r1094114 = r1094112 * r1094113;
        double r1094115 = 2.0;
        double r1094116 = r1094114 / r1094115;
        return r1094116;
}

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

    \[\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 5.8

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

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

Reproduce

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