Average Error: 44.2 → 43.4
Time: 28.5s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\left(\frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a}}\right) \cdot \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(-3 \cdot a\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\left(\frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a}}\right) \cdot \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(-3 \cdot a\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3864401 = b;
        double r3864402 = -r3864401;
        double r3864403 = r3864401 * r3864401;
        double r3864404 = 3.0;
        double r3864405 = a;
        double r3864406 = r3864404 * r3864405;
        double r3864407 = c;
        double r3864408 = r3864406 * r3864407;
        double r3864409 = r3864403 - r3864408;
        double r3864410 = sqrt(r3864409);
        double r3864411 = r3864402 + r3864410;
        double r3864412 = r3864411 / r3864406;
        return r3864412;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3864413 = 0.3333333333333333;
        double r3864414 = sqrt(r3864413);
        double r3864415 = a;
        double r3864416 = cbrt(r3864415);
        double r3864417 = r3864416 * r3864416;
        double r3864418 = r3864414 / r3864417;
        double r3864419 = r3864414 / r3864416;
        double r3864420 = r3864418 * r3864419;
        double r3864421 = b;
        double r3864422 = -3.0;
        double r3864423 = r3864422 * r3864415;
        double r3864424 = c;
        double r3864425 = r3864423 * r3864424;
        double r3864426 = fma(r3864421, r3864421, r3864425);
        double r3864427 = sqrt(r3864426);
        double r3864428 = sqrt(r3864427);
        double r3864429 = r3864421 * r3864421;
        double r3864430 = fma(r3864424, r3864423, r3864429);
        double r3864431 = sqrt(r3864430);
        double r3864432 = sqrt(r3864431);
        double r3864433 = -r3864421;
        double r3864434 = fma(r3864428, r3864432, r3864433);
        double r3864435 = r3864420 * r3864434;
        return r3864435;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 44.2

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

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

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

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{3 \cdot a}\]
  6. Taylor expanded around 0 43.5

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}\]
  7. Simplified43.4

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right) \cdot \frac{1}{3 \cdot a}}\]
  10. Simplified43.4

    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right) \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\]
  11. Using strategy rm
  12. Applied add-cube-cbrt43.4

    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right) \cdot \frac{\frac{1}{3}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
  13. Applied add-sqr-sqrt43.4

    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right) \cdot \frac{\color{blue}{\sqrt{\frac{1}{3}} \cdot \sqrt{\frac{1}{3}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
  14. Applied times-frac43.4

    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(\left(a \cdot -3\right) \cdot c\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right) \cdot \color{blue}{\left(\frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\sqrt{\frac{1}{3}}}{\sqrt[3]{a}}\right)}\]
  15. Final simplification43.4

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

Reproduce

herbie shell --seed 2019130 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))