Average Error: 52.5 → 0.1
Time: 9.6s
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}\]
\[\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r42753 = b;
        double r42754 = -r42753;
        double r42755 = r42753 * r42753;
        double r42756 = 4.0;
        double r42757 = a;
        double r42758 = r42756 * r42757;
        double r42759 = c;
        double r42760 = r42758 * r42759;
        double r42761 = r42755 - r42760;
        double r42762 = sqrt(r42761);
        double r42763 = r42754 + r42762;
        double r42764 = 2.0;
        double r42765 = r42764 * r42757;
        double r42766 = r42763 / r42765;
        return r42766;
}

double f(double a, double b, double c) {
        double r42767 = 2.0;
        double r42768 = c;
        double r42769 = r42767 * r42768;
        double r42770 = b;
        double r42771 = -r42770;
        double r42772 = r42770 * r42770;
        double r42773 = 4.0;
        double r42774 = a;
        double r42775 = r42773 * r42774;
        double r42776 = r42775 * r42768;
        double r42777 = r42772 - r42776;
        double r42778 = sqrt(r42777);
        double r42779 = r42771 - r42778;
        double r42780 = r42769 / r42779;
        return r42780;
}

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+52.5

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  4. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied div-inv0.4

    \[\leadsto \frac{\color{blue}{\left(4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  7. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{\frac{2 \cdot a}{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}}\]
  8. Simplified0.4

    \[\leadsto \frac{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{\color{blue}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  9. Using strategy rm
  10. Applied associate-/r*0.2

    \[\leadsto \color{blue}{\frac{\frac{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{2 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\]
  11. Simplified0.2

    \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(4, a \cdot c, 0\right)}{2 \cdot a}}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
  12. Taylor expanded around 0 0.1

    \[\leadsto \frac{\color{blue}{2 \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]
  13. Final simplification0.1

    \[\leadsto \frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\]

Reproduce

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