Average Error: 52.4 → 6.3
Time: 7.1s
Precision: 64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[-1 \cdot \frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-1 \cdot \frac{c}{b}
double f(double a, double b, double c) {
        double r24853 = b;
        double r24854 = -r24853;
        double r24855 = r24853 * r24853;
        double r24856 = 4.0;
        double r24857 = a;
        double r24858 = r24856 * r24857;
        double r24859 = c;
        double r24860 = r24858 * r24859;
        double r24861 = r24855 - r24860;
        double r24862 = sqrt(r24861);
        double r24863 = r24854 + r24862;
        double r24864 = 2.0;
        double r24865 = r24864 * r24857;
        double r24866 = r24863 / r24865;
        return r24866;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r24867 = -1.0;
        double r24868 = c;
        double r24869 = b;
        double r24870 = r24868 / r24869;
        double r24871 = r24867 * r24870;
        return r24871;
}

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

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

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

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

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))