Average Error: 52.4 → 0.2
Time: 55.3s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{3 \cdot \left(-a\right)}{\frac{3 \cdot \left(-a\right)}{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(3 \cdot \left(-a\right)\right) \cdot c\right)}}}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{3 \cdot \left(-a\right)}{\frac{3 \cdot \left(-a\right)}{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(3 \cdot \left(-a\right)\right) \cdot c\right)}}}}
double f(double a, double b, double c) {
        double r6523749 = b;
        double r6523750 = -r6523749;
        double r6523751 = r6523749 * r6523749;
        double r6523752 = 3.0;
        double r6523753 = a;
        double r6523754 = r6523752 * r6523753;
        double r6523755 = c;
        double r6523756 = r6523754 * r6523755;
        double r6523757 = r6523751 - r6523756;
        double r6523758 = sqrt(r6523757);
        double r6523759 = r6523750 + r6523758;
        double r6523760 = r6523759 / r6523754;
        return r6523760;
}

double f(double a, double b, double c) {
        double r6523761 = 3.0;
        double r6523762 = a;
        double r6523763 = -r6523762;
        double r6523764 = r6523761 * r6523763;
        double r6523765 = c;
        double r6523766 = b;
        double r6523767 = -r6523766;
        double r6523768 = r6523764 * r6523765;
        double r6523769 = fma(r6523766, r6523766, r6523768);
        double r6523770 = sqrt(r6523769);
        double r6523771 = r6523767 - r6523770;
        double r6523772 = r6523765 / r6523771;
        double r6523773 = r6523764 / r6523772;
        double r6523774 = r6523764 / r6523773;
        return r6523774;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.4

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{-3 \cdot a}{1} \cdot \frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)}}}}{-3 \cdot a}\]
  11. Applied associate-/l*0.2

    \[\leadsto \color{blue}{\frac{\frac{-3 \cdot a}{1}}{\frac{-3 \cdot a}{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)}}}}}\]
  12. Final simplification0.2

    \[\leadsto \frac{3 \cdot \left(-a\right)}{\frac{3 \cdot \left(-a\right)}{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(3 \cdot \left(-a\right)\right) \cdot c\right)}}}}\]

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))