Average Error: 28.2 → 27.0
Time: 49.9s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(b \cdot b\right) \cdot \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, e^{\log \left(b \cdot b + \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)}\right)}}{3 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(b \cdot b\right) \cdot \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, e^{\log \left(b \cdot b + \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)}\right)}}{3 \cdot a}
double f(double a, double b, double c) {
        double r4246241 = b;
        double r4246242 = -r4246241;
        double r4246243 = r4246241 * r4246241;
        double r4246244 = 3.0;
        double r4246245 = a;
        double r4246246 = r4246244 * r4246245;
        double r4246247 = c;
        double r4246248 = r4246246 * r4246247;
        double r4246249 = r4246243 - r4246248;
        double r4246250 = sqrt(r4246249);
        double r4246251 = r4246242 + r4246250;
        double r4246252 = r4246251 / r4246246;
        return r4246252;
}

double f(double a, double b, double c) {
        double r4246253 = -3.0;
        double r4246254 = c;
        double r4246255 = a;
        double r4246256 = r4246254 * r4246255;
        double r4246257 = b;
        double r4246258 = r4246257 * r4246257;
        double r4246259 = fma(r4246253, r4246256, r4246258);
        double r4246260 = sqrt(r4246259);
        double r4246261 = -r4246257;
        double r4246262 = r4246258 * r4246261;
        double r4246263 = fma(r4246259, r4246260, r4246262);
        double r4246264 = r4246258 + r4246259;
        double r4246265 = log(r4246264);
        double r4246266 = exp(r4246265);
        double r4246267 = fma(r4246257, r4246260, r4246266);
        double r4246268 = r4246263 / r4246267;
        double r4246269 = 3.0;
        double r4246270 = r4246269 * r4246255;
        double r4246271 = r4246268 / r4246270;
        return r4246271;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.2

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} - b}{3 \cdot a}}\]
  3. Using strategy rm
  4. Applied flip3--28.3

    \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot b\right)}}}{3 \cdot a}\]
  5. Simplified27.6

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} - \left(b \cdot b\right) \cdot b}}{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot b\right)}}{3 \cdot a}\]
  6. Simplified27.6

    \[\leadsto \frac{\frac{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} - \left(b \cdot b\right) \cdot b}{\color{blue}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
  7. Using strategy rm
  8. Applied fma-neg27.0

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{3 \cdot a}\]
  9. Using strategy rm
  10. Applied add-exp-log27.0

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, \color{blue}{e^{\log \left(b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}\right)}}{3 \cdot a}\]
  11. Final simplification27.0

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(b \cdot b\right) \cdot \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, e^{\log \left(b \cdot b + \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)}\right)}}{3 \cdot a}\]

Reproduce

herbie shell --seed 2019144 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))