Average Error: 52.8 → 6.0
Time: 14.4s
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 r66657 = b;
        double r66658 = -r66657;
        double r66659 = r66657 * r66657;
        double r66660 = 3.0;
        double r66661 = a;
        double r66662 = r66660 * r66661;
        double r66663 = c;
        double r66664 = r66662 * r66663;
        double r66665 = r66659 - r66664;
        double r66666 = sqrt(r66665);
        double r66667 = r66658 + r66666;
        double r66668 = r66667 / r66662;
        return r66668;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r66669 = -0.5;
        double r66670 = c;
        double r66671 = b;
        double r66672 = r66670 / r66671;
        double r66673 = r66669 * r66672;
        return r66673;
}

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

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

    \[\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.0

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

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

Reproduce

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