Average Error: 52.7 → 6.0
Time: 1.1m
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 r6870845 = b;
        double r6870846 = -r6870845;
        double r6870847 = r6870845 * r6870845;
        double r6870848 = 4.0;
        double r6870849 = a;
        double r6870850 = r6870848 * r6870849;
        double r6870851 = c;
        double r6870852 = r6870850 * r6870851;
        double r6870853 = r6870847 - r6870852;
        double r6870854 = sqrt(r6870853);
        double r6870855 = r6870846 + r6870854;
        double r6870856 = 2.0;
        double r6870857 = r6870856 * r6870849;
        double r6870858 = r6870855 / r6870857;
        return r6870858;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r6870859 = c;
        double r6870860 = b;
        double r6870861 = r6870859 / r6870860;
        double r6870862 = -r6870861;
        return r6870862;
}

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019124 
(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)))