Average Error: 43.6 → 0.4
Time: 21.8s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}\]
\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)}{\left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot 2}
double f(double a, double b, double c) {
        double r48372 = b;
        double r48373 = -r48372;
        double r48374 = r48372 * r48372;
        double r48375 = 4.0;
        double r48376 = a;
        double r48377 = r48375 * r48376;
        double r48378 = c;
        double r48379 = r48377 * r48378;
        double r48380 = r48374 - r48379;
        double r48381 = sqrt(r48380);
        double r48382 = r48373 + r48381;
        double r48383 = 2.0;
        double r48384 = r48383 * r48376;
        double r48385 = r48382 / r48384;
        return r48385;
}

double f(double a, double b, double c) {
        double r48386 = 4.0;
        double r48387 = a;
        double r48388 = c;
        double r48389 = r48387 * r48388;
        double r48390 = r48386 * r48389;
        double r48391 = b;
        double r48392 = -r48391;
        double r48393 = r48391 * r48391;
        double r48394 = r48386 * r48387;
        double r48395 = r48394 * r48388;
        double r48396 = r48393 - r48395;
        double r48397 = sqrt(r48396);
        double r48398 = r48392 - r48397;
        double r48399 = r48387 * r48398;
        double r48400 = 2.0;
        double r48401 = r48399 * r48400;
        double r48402 = r48390 / r48401;
        return r48402;
}

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

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

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

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(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)))