Average Error: 43.7 → 12.1
Time: 7.6s
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 r116499 = b;
        double r116500 = -r116499;
        double r116501 = r116499 * r116499;
        double r116502 = 3.0;
        double r116503 = a;
        double r116504 = r116502 * r116503;
        double r116505 = c;
        double r116506 = r116504 * r116505;
        double r116507 = r116501 - r116506;
        double r116508 = sqrt(r116507);
        double r116509 = r116500 + r116508;
        double r116510 = r116509 / r116504;
        return r116510;
}

double f(double __attribute__((unused)) a, double b, double c) {
        double r116511 = -0.5;
        double r116512 = c;
        double r116513 = b;
        double r116514 = r116512 / r116513;
        double r116515 = r116511 * r116514;
        return r116515;
}

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

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

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

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

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :precision binary64
  :pre (and (< 1.11022e-16 a 9.0072e+15) (< 1.11022e-16 b 9.0072e+15) (< 1.11022e-16 c 9.0072e+15))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))