Average Error: 43.7 → 0.2
Time: 7.7s
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{1}{2} \cdot \frac{\frac{4 \cdot c}{-1}}{b + \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{1}{2} \cdot \frac{\frac{4 \cdot c}{-1}}{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}
double f(double a, double b, double c) {
        double r45452 = b;
        double r45453 = -r45452;
        double r45454 = r45452 * r45452;
        double r45455 = 4.0;
        double r45456 = a;
        double r45457 = r45455 * r45456;
        double r45458 = c;
        double r45459 = r45457 * r45458;
        double r45460 = r45454 - r45459;
        double r45461 = sqrt(r45460);
        double r45462 = r45453 + r45461;
        double r45463 = 2.0;
        double r45464 = r45463 * r45456;
        double r45465 = r45462 / r45464;
        return r45465;
}

double f(double a, double b, double c) {
        double r45466 = 1.0;
        double r45467 = 2.0;
        double r45468 = r45466 / r45467;
        double r45469 = 4.0;
        double r45470 = c;
        double r45471 = r45469 * r45470;
        double r45472 = -1.0;
        double r45473 = r45471 / r45472;
        double r45474 = b;
        double r45475 = r45474 * r45474;
        double r45476 = a;
        double r45477 = r45469 * r45476;
        double r45478 = r45477 * r45470;
        double r45479 = r45475 - r45478;
        double r45480 = sqrt(r45479);
        double r45481 = r45474 + r45480;
        double r45482 = r45473 / r45481;
        double r45483 = r45468 * r45482;
        return r45483;
}

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}{0 + 4 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.5

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  7. Applied distribute-lft-neg-in0.5

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

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  11. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + 4 \cdot \left(a \cdot c\right)\right)}}{1 \cdot \mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\]
  12. Applied times-frac0.4

    \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + 4 \cdot \left(a \cdot c\right)}{\mathsf{fma}\left(-\sqrt{b}, \sqrt{b}, -\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}{2 \cdot a}\]
  13. Applied times-frac0.4

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{\frac{4 \cdot \left(a \cdot c\right)}{a}}{-\left(b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
  16. Using strategy rm
  17. Applied neg-mul-10.2

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

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

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

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

Reproduce

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