Average Error: 53.0 → 52.2
Time: 33.2s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{\frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, -b\right)}{\left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)}\right)\right) \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{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(\sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, -b\right)}{\left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)}\right)\right) \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{3 \cdot a}}
double f(double a, double b, double c) {
        double r4025318 = b;
        double r4025319 = -r4025318;
        double r4025320 = r4025318 * r4025318;
        double r4025321 = 3.0;
        double r4025322 = a;
        double r4025323 = r4025321 * r4025322;
        double r4025324 = c;
        double r4025325 = r4025323 * r4025324;
        double r4025326 = r4025320 - r4025325;
        double r4025327 = sqrt(r4025326);
        double r4025328 = r4025319 + r4025327;
        double r4025329 = r4025328 / r4025323;
        return r4025329;
}

double f(double a, double b, double c) {
        double r4025330 = -3.0;
        double r4025331 = a;
        double r4025332 = c;
        double r4025333 = r4025331 * r4025332;
        double r4025334 = b;
        double r4025335 = r4025334 * r4025334;
        double r4025336 = fma(r4025330, r4025333, r4025335);
        double r4025337 = sqrt(r4025336);
        double r4025338 = sqrt(r4025337);
        double r4025339 = -r4025334;
        double r4025340 = fma(r4025338, r4025338, r4025339);
        double r4025341 = 3.0;
        double r4025342 = r4025341 * r4025331;
        double r4025343 = cbrt(r4025342);
        double r4025344 = log1p(r4025343);
        double r4025345 = expm1(r4025344);
        double r4025346 = cbrt(r4025345);
        double r4025347 = r4025346 * r4025346;
        double r4025348 = r4025346 * r4025347;
        double r4025349 = r4025348 * r4025343;
        double r4025350 = r4025340 / r4025349;
        double r4025351 = r4025350 / r4025343;
        return r4025351;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 53.0

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

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

    \[\leadsto \frac{\sqrt{\color{blue}{\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)}}} - b}{3 \cdot a}\]
  5. Applied sqrt-prod52.8

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

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

    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, -b\right)}{\color{blue}{\left(\sqrt[3]{3 \cdot a} \cdot \sqrt[3]{3 \cdot a}\right) \cdot \sqrt[3]{3 \cdot a}}}\]
  9. Applied associate-/r*52.2

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, -b\right)}{\sqrt[3]{3 \cdot a} \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{3 \cdot a}}}\]
  10. Using strategy rm
  11. Applied expm1-log1p-u52.2

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, -b\right)}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{3 \cdot a}}\]
  12. Using strategy rm
  13. Applied add-cube-cbrt52.2

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, -b\right)}{\color{blue}{\left(\left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)}\right) \cdot \sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)}\right)} \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{3 \cdot a}}\]
  14. Final simplification52.2

    \[\leadsto \frac{\frac{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, -b\right)}{\left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \left(\sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)} \cdot \sqrt[3]{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{3 \cdot a}\right)\right)}\right)\right) \cdot \sqrt[3]{3 \cdot a}}}{\sqrt[3]{3 \cdot a}}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (a b c)
  :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)))