Average Error: 4.9 → 4.9
Time: 11.4s
Precision: 64
\[b \lt 0.0 \land {b}^{2} - 4 \cdot ac \ge 0.0\]
\[\frac{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\]
\[\frac{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\]
\frac{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}
\frac{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}
double f(double b, double ac, double a) {
        double r3549844 = b;
        double r3549845 = -r3549844;
        double r3549846 = 2.0;
        double r3549847 = pow(r3549844, r3549846);
        double r3549848 = 4.0;
        double r3549849 = ac;
        double r3549850 = r3549848 * r3549849;
        double r3549851 = r3549847 - r3549850;
        double r3549852 = sqrt(r3549851);
        double r3549853 = r3549845 + r3549852;
        double r3549854 = a;
        double r3549855 = r3549846 * r3549854;
        double r3549856 = r3549853 / r3549855;
        return r3549856;
}

double f(double b, double ac, double a) {
        double r3549857 = b;
        double r3549858 = -r3549857;
        double r3549859 = 2.0;
        double r3549860 = pow(r3549857, r3549859);
        double r3549861 = 4.0;
        double r3549862 = ac;
        double r3549863 = r3549861 * r3549862;
        double r3549864 = r3549860 - r3549863;
        double r3549865 = sqrt(r3549864);
        double r3549866 = r3549858 + r3549865;
        double r3549867 = a;
        double r3549868 = r3549859 * r3549867;
        double r3549869 = r3549866 / r3549868;
        return r3549869;
}

Error

Bits error versus b

Bits error versus ac

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 4.9

    \[\frac{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\]
  2. Final simplification4.9

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

Reproduce

herbie shell --seed 1 
(FPCore (b ac a)
  :name "(-b+sqrt(b^2-4ac))/(2a)"
  :precision binary32
  :pre (and (< b 0.0) (>= (- (pow b 2) (* 4 ac)) 0.0))
  (/ (+ (- b) (sqrt (- (pow b 2) (* 4 ac)))) (* 2 a)))