Average Error: 52.4 → 6.3
Time: 6.8s
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}\]
\[-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 r103415 = b;
        double r103416 = -r103415;
        double r103417 = r103415 * r103415;
        double r103418 = 3.0;
        double r103419 = a;
        double r103420 = r103418 * r103419;
        double r103421 = c;
        double r103422 = r103420 * r103421;
        double r103423 = r103417 - r103422;
        double r103424 = sqrt(r103423);
        double r103425 = r103416 + r103424;
        double r103426 = r103425 / r103420;
        return r103426;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r103427 = -0.5;
        double r103428 = c;
        double r103429 = b;
        double r103430 = r103428 / r103429;
        double r103431 = r103427 * r103430;
        return r103431;
}

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 52.4

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified52.4

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
  3. Taylor expanded around inf 6.3

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

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

Reproduce

herbie shell --seed 2019351 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, wide range"
  :precision binary64
  :pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))