Average Error: 52.0 → 6.5
Time: 18.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 r713831 = b;
        double r713832 = -r713831;
        double r713833 = r713831 * r713831;
        double r713834 = 4.0;
        double r713835 = a;
        double r713836 = r713834 * r713835;
        double r713837 = c;
        double r713838 = r713836 * r713837;
        double r713839 = r713833 - r713838;
        double r713840 = sqrt(r713839);
        double r713841 = r713832 + r713840;
        double r713842 = 2.0;
        double r713843 = r713842 * r713835;
        double r713844 = r713841 / r713843;
        return r713844;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r713845 = c;
        double r713846 = b;
        double r713847 = r713845 / r713846;
        double r713848 = -2.0;
        double r713849 = r713847 * r713848;
        double r713850 = 2.0;
        double r713851 = r713849 / r713850;
        return r713851;
}

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

    \[\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, \left(a \cdot -4\right) \cdot c\right)} - b}{a}}{2}}\]
  3. Taylor expanded around inf 6.5

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

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

Reproduce

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