Average Error: 52.3 → 51.6
Time: 29.4s
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}\]
\[\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\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) \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot e^{\log \left(\sqrt[3]{\frac{\frac{1}{3}}{a}}\right)}\right)\right)\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\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) \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot e^{\log \left(\sqrt[3]{\frac{\frac{1}{3}}{a}}\right)}\right)\right)
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r4038171 = b;
        double r4038172 = -r4038171;
        double r4038173 = r4038171 * r4038171;
        double r4038174 = 3.0;
        double r4038175 = a;
        double r4038176 = r4038174 * r4038175;
        double r4038177 = c;
        double r4038178 = r4038176 * r4038177;
        double r4038179 = r4038173 - r4038178;
        double r4038180 = sqrt(r4038179);
        double r4038181 = r4038172 + r4038180;
        double r4038182 = r4038181 / r4038176;
        return r4038182;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r4038183 = c;
        double r4038184 = a;
        double r4038185 = -3.0;
        double r4038186 = r4038184 * r4038185;
        double r4038187 = b;
        double r4038188 = r4038187 * r4038187;
        double r4038189 = fma(r4038183, r4038186, r4038188);
        double r4038190 = sqrt(r4038189);
        double r4038191 = sqrt(r4038190);
        double r4038192 = -r4038187;
        double r4038193 = fma(r4038191, r4038191, r4038192);
        double r4038194 = 0.3333333333333333;
        double r4038195 = r4038194 / r4038184;
        double r4038196 = cbrt(r4038195);
        double r4038197 = log(r4038196);
        double r4038198 = exp(r4038197);
        double r4038199 = r4038196 * r4038198;
        double r4038200 = r4038196 * r4038199;
        double r4038201 = r4038193 * r4038200;
        return r4038201;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 52.3

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

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

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

    \[\leadsto \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) \cdot \frac{1}{3 \cdot a}}\]
  8. Simplified51.6

    \[\leadsto \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) \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\]
  9. Using strategy rm
  10. Applied add-cube-cbrt51.6

    \[\leadsto \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) \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot \sqrt[3]{\frac{\frac{1}{3}}{a}}\right) \cdot \sqrt[3]{\frac{\frac{1}{3}}{a}}\right)}\]
  11. Using strategy rm
  12. Applied add-exp-log51.6

    \[\leadsto \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) \cdot \left(\left(\color{blue}{e^{\log \left(\sqrt[3]{\frac{\frac{1}{3}}{a}}\right)}} \cdot \sqrt[3]{\frac{\frac{1}{3}}{a}}\right) \cdot \sqrt[3]{\frac{\frac{1}{3}}{a}}\right)\]
  13. Final simplification51.6

    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(c, \left(a \cdot -3\right), \left(b \cdot b\right)\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) \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot \left(\sqrt[3]{\frac{\frac{1}{3}}{a}} \cdot e^{\log \left(\sqrt[3]{\frac{\frac{1}{3}}{a}}\right)}\right)\right)\]

Reproduce

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