Average Error: 43.9 → 0.3
Time: 3.1m
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{3 \cdot \frac{c}{3}}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{3 \cdot \frac{c}{3}}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r18397876 = b;
        double r18397877 = -r18397876;
        double r18397878 = r18397876 * r18397876;
        double r18397879 = 3.0;
        double r18397880 = a;
        double r18397881 = r18397879 * r18397880;
        double r18397882 = c;
        double r18397883 = r18397881 * r18397882;
        double r18397884 = r18397878 - r18397883;
        double r18397885 = sqrt(r18397884);
        double r18397886 = r18397877 + r18397885;
        double r18397887 = r18397886 / r18397881;
        return r18397887;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r18397888 = 3.0;
        double r18397889 = c;
        double r18397890 = r18397889 / r18397888;
        double r18397891 = r18397888 * r18397890;
        double r18397892 = b;
        double r18397893 = -r18397892;
        double r18397894 = r18397892 * r18397892;
        double r18397895 = a;
        double r18397896 = r18397888 * r18397895;
        double r18397897 = r18397889 * r18397896;
        double r18397898 = r18397894 - r18397897;
        double r18397899 = sqrt(r18397898);
        double r18397900 = r18397893 - r18397899;
        double r18397901 = r18397891 / r18397900;
        return r18397901;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 43.9

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

    \[\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. Applied associate-/l/43.9

    \[\leadsto \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(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
  5. Simplified0.5

    \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  6. Using strategy rm
  7. Applied associate-/l*0.5

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

    \[\leadsto \frac{3}{\color{blue}{1 \cdot \frac{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{c \cdot a}}}\]
  10. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\color{blue}{1 \cdot 3}}{1 \cdot \frac{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{c \cdot a}}\]
  11. Applied times-frac0.5

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

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

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{c \cdot \left(3 \cdot a\right)}{3 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}\]
  14. Using strategy rm
  15. Applied times-frac0.4

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

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

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

Reproduce

herbie shell --seed 2019112 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))