Average Error: 52.4 → 6.2
Time: 1.2m
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{c}{b} \cdot \frac{-1}{2}\]
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r13245665 = b;
        double r13245666 = -r13245665;
        double r13245667 = r13245665 * r13245665;
        double r13245668 = 3.0;
        double r13245669 = a;
        double r13245670 = r13245668 * r13245669;
        double r13245671 = c;
        double r13245672 = r13245670 * r13245671;
        double r13245673 = r13245667 - r13245672;
        double r13245674 = sqrt(r13245673);
        double r13245675 = r13245666 + r13245674;
        double r13245676 = r13245675 / r13245670;
        return r13245676;
}

double f(double __attribute__((unused)) a, double b, double c, double __attribute__((unused)) d) {
        double r13245677 = c;
        double r13245678 = b;
        double r13245679 = r13245677 / r13245678;
        double r13245680 = -0.5;
        double r13245681 = r13245679 * r13245680;
        return r13245681;
}

\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{c}{b} \cdot \frac{-1}{2}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

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

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

    \[\leadsto \frac{c}{b} \cdot \frac{-1}{2}\]

Reproduce

herbie shell --seed 2019101 
(FPCore (a b c d)
  :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 a) c)))) (* 3 a)))