Average Error: 43.7 → 0.4
Time: 9.5s
Precision: 64
\[1.11022 \cdot 10^{-16} \lt a \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt b \lt 9.0072 \cdot 10^{15} \land 1.11022 \cdot 10^{-16} \lt c \lt 9.0072 \cdot 10^{15}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{4 \cdot \left(a \cdot c\right) + b \cdot \left(b - b\right)}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}
double f(double a, double b, double c) {
        double r32026 = b;
        double r32027 = -r32026;
        double r32028 = r32026 * r32026;
        double r32029 = 4.0;
        double r32030 = a;
        double r32031 = r32029 * r32030;
        double r32032 = c;
        double r32033 = r32031 * r32032;
        double r32034 = r32028 - r32033;
        double r32035 = sqrt(r32034);
        double r32036 = r32027 + r32035;
        double r32037 = 2.0;
        double r32038 = r32037 * r32030;
        double r32039 = r32036 / r32038;
        return r32039;
}

double f(double a, double b, double c) {
        double r32040 = 4.0;
        double r32041 = a;
        double r32042 = c;
        double r32043 = r32041 * r32042;
        double r32044 = r32040 * r32043;
        double r32045 = b;
        double r32046 = r32045 - r32045;
        double r32047 = r32045 * r32046;
        double r32048 = r32044 + r32047;
        double r32049 = 2.0;
        double r32050 = -r32045;
        double r32051 = r32045 * r32045;
        double r32052 = r32040 * r32041;
        double r32053 = r32052 * r32042;
        double r32054 = r32051 - r32053;
        double r32055 = sqrt(r32054);
        double r32056 = r32050 - r32055;
        double r32057 = r32041 * r32056;
        double r32058 = r32049 * r32057;
        double r32059 = r32048 / r32058;
        return r32059;
}

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 43.7

    \[\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-+43.7

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

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

    \[\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}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}}\]
  9. Final simplification0.4

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

Reproduce

herbie shell --seed 2020046 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))