Average Error: 43.9 → 12.0
Time: 19.2s
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(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[-0.5 \cdot \frac{c}{b}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
-0.5 \cdot \frac{c}{b}
double f(double a, double b, double c) {
        double r72765 = b;
        double r72766 = -r72765;
        double r72767 = r72765 * r72765;
        double r72768 = 3.0;
        double r72769 = a;
        double r72770 = r72768 * r72769;
        double r72771 = c;
        double r72772 = r72770 * r72771;
        double r72773 = r72767 - r72772;
        double r72774 = sqrt(r72773);
        double r72775 = r72766 + r72774;
        double r72776 = r72775 / r72770;
        return r72776;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r72777 = -0.5;
        double r72778 = c;
        double r72779 = b;
        double r72780 = r72778 / r72779;
        double r72781 = r72777 * r72780;
        return r72781;
}

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Taylor expanded around inf 12.0

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
  3. Final simplification12.0

    \[\leadsto -0.5 \cdot \frac{c}{b}\]

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (a b c)
  :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.0 a) c)))) (* 3.0 a)))