Average Error: 43.5 → 42.6
Time: 30.0s
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}\]
\[\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \left(\sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \left(\sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3234549 = b;
        double r3234550 = -r3234549;
        double r3234551 = r3234549 * r3234549;
        double r3234552 = 3.0;
        double r3234553 = a;
        double r3234554 = r3234552 * r3234553;
        double r3234555 = c;
        double r3234556 = r3234554 * r3234555;
        double r3234557 = r3234551 - r3234556;
        double r3234558 = sqrt(r3234557);
        double r3234559 = r3234550 + r3234558;
        double r3234560 = r3234559 / r3234554;
        return r3234560;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3234561 = c;
        double r3234562 = a;
        double r3234563 = -3.0;
        double r3234564 = r3234562 * r3234563;
        double r3234565 = b;
        double r3234566 = r3234565 * r3234565;
        double r3234567 = fma(r3234561, r3234564, r3234566);
        double r3234568 = r3234567 * r3234567;
        double r3234569 = r3234568 * r3234567;
        double r3234570 = 0.3333333333333333;
        double r3234571 = pow(r3234569, r3234570);
        double r3234572 = cbrt(r3234571);
        double r3234573 = r3234572 * r3234572;
        double r3234574 = r3234572 * r3234573;
        double r3234575 = sqrt(r3234574);
        double r3234576 = sqrt(r3234575);
        double r3234577 = sqrt(r3234567);
        double r3234578 = sqrt(r3234577);
        double r3234579 = -r3234565;
        double r3234580 = fma(r3234576, r3234578, r3234579);
        double r3234581 = 3.0;
        double r3234582 = r3234562 * r3234581;
        double r3234583 = r3234580 / r3234582;
        return r3234583;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 43.5

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

    \[\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-sqrt43.6

    \[\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-neg42.9

    \[\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. Using strategy rm
  7. Applied add-cbrt-cube42.9

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \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}\]
  8. Using strategy rm
  9. Applied pow1/342.7

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{{\left(\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}\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}\]
  10. Using strategy rm
  11. Applied add-cube-cbrt42.6

    \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\color{blue}{\left(\sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}\right) \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(c, \left(-3 \cdot a\right), \left(b \cdot b\right)\right)\right)}^{\frac{1}{3}}}}}}\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}\]
  12. Final simplification42.6

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

Reproduce

herbie shell --seed 2019129 +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)))