Average Error: 9.6 → 0.6
Time: 10.1s
Precision: 64
\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
\[\sqrt[3]{{\left(\log y\right)}^{2}} \cdot \left(\sqrt[3]{\log y} \cdot x\right) + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\sqrt[3]{{\left(\log y\right)}^{2}} \cdot \left(\sqrt[3]{\log y} \cdot x\right) + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r446249 = x;
        double r446250 = y;
        double r446251 = log(r446250);
        double r446252 = r446249 * r446251;
        double r446253 = z;
        double r446254 = 1.0;
        double r446255 = r446254 - r446250;
        double r446256 = log(r446255);
        double r446257 = r446253 * r446256;
        double r446258 = r446252 + r446257;
        double r446259 = t;
        double r446260 = r446258 - r446259;
        return r446260;
}

double f(double x, double y, double z, double t) {
        double r446261 = y;
        double r446262 = log(r446261);
        double r446263 = 2.0;
        double r446264 = pow(r446262, r446263);
        double r446265 = cbrt(r446264);
        double r446266 = cbrt(r446262);
        double r446267 = x;
        double r446268 = r446266 * r446267;
        double r446269 = r446265 * r446268;
        double r446270 = z;
        double r446271 = 1.0;
        double r446272 = log(r446271);
        double r446273 = r446270 * r446261;
        double r446274 = 0.5;
        double r446275 = pow(r446261, r446263);
        double r446276 = r446270 * r446275;
        double r446277 = pow(r446271, r446263);
        double r446278 = r446276 / r446277;
        double r446279 = r446274 * r446278;
        double r446280 = fma(r446271, r446273, r446279);
        double r446281 = -r446280;
        double r446282 = fma(r446270, r446272, r446281);
        double r446283 = t;
        double r446284 = r446282 - r446283;
        double r446285 = r446269 + r446284;
        return r446285;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original9.6
Target0.3
Herbie0.6
\[\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.333333333333333315}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)\]

Derivation

  1. Initial program 9.6

    \[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t\]
  2. Simplified9.6

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, z \cdot \log \left(1 - y\right) - t\right)}\]
  3. Taylor expanded around 0 0.3

    \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(z \cdot \log 1 - \left(1 \cdot \left(z \cdot y\right) + \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right)} - t\right)\]
  4. Simplified0.3

    \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right)} - t\right)\]
  5. Using strategy rm
  6. Applied fma-udef0.3

    \[\leadsto \color{blue}{\log y \cdot x + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)}\]
  7. Using strategy rm
  8. Applied add-cube-cbrt0.8

    \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \sqrt[3]{\log y}\right)} \cdot x + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
  9. Applied associate-*l*0.8

    \[\leadsto \color{blue}{\left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot x\right)} + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
  10. Using strategy rm
  11. Applied cbrt-unprod0.6

    \[\leadsto \color{blue}{\sqrt[3]{\log y \cdot \log y}} \cdot \left(\sqrt[3]{\log y} \cdot x\right) + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
  12. Simplified0.6

    \[\leadsto \sqrt[3]{\color{blue}{{\left(\log y\right)}^{2}}} \cdot \left(\sqrt[3]{\log y} \cdot x\right) + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]
  13. Final simplification0.6

    \[\leadsto \sqrt[3]{{\left(\log y\right)}^{2}} \cdot \left(\sqrt[3]{\log y} \cdot x\right) + \left(\mathsf{fma}\left(z, \log 1, -\mathsf{fma}\left(1, z \cdot y, \frac{1}{2} \cdot \frac{z \cdot {y}^{2}}{{1}^{2}}\right)\right) - t\right)\]

Reproduce

herbie shell --seed 2020036 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1 y)))) t))