Average Error: 6.6 → 0.7
Time: 25.6s
Precision: 64
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{y \cdot y}{1}, y \cdot 1\right), z - 1, \sqrt[3]{\log y \cdot x} \cdot \left(\left(\sqrt[3]{\log y \cdot x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{\log y}\right) + \left(-\log y\right) \cdot 1\right) - t\]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{y \cdot y}{1}, y \cdot 1\right), z - 1, \sqrt[3]{\log y \cdot x} \cdot \left(\left(\sqrt[3]{\log y \cdot x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{\log y}\right) + \left(-\log y\right) \cdot 1\right) - t
double f(double x, double y, double z, double t) {
        double r35285 = x;
        double r35286 = 1.0;
        double r35287 = r35285 - r35286;
        double r35288 = y;
        double r35289 = log(r35288);
        double r35290 = r35287 * r35289;
        double r35291 = z;
        double r35292 = r35291 - r35286;
        double r35293 = r35286 - r35288;
        double r35294 = log(r35293);
        double r35295 = r35292 * r35294;
        double r35296 = r35290 + r35295;
        double r35297 = t;
        double r35298 = r35296 - r35297;
        return r35298;
}

double f(double x, double y, double z, double t) {
        double r35299 = 1.0;
        double r35300 = log(r35299);
        double r35301 = 0.5;
        double r35302 = r35301 / r35299;
        double r35303 = y;
        double r35304 = r35303 * r35303;
        double r35305 = r35304 / r35299;
        double r35306 = r35303 * r35299;
        double r35307 = fma(r35302, r35305, r35306);
        double r35308 = r35300 - r35307;
        double r35309 = z;
        double r35310 = r35309 - r35299;
        double r35311 = log(r35303);
        double r35312 = x;
        double r35313 = r35311 * r35312;
        double r35314 = cbrt(r35313);
        double r35315 = cbrt(r35312);
        double r35316 = r35314 * r35315;
        double r35317 = cbrt(r35311);
        double r35318 = r35316 * r35317;
        double r35319 = r35314 * r35318;
        double r35320 = -r35311;
        double r35321 = r35320 * r35299;
        double r35322 = r35319 + r35321;
        double r35323 = fma(r35308, r35310, r35322);
        double r35324 = t;
        double r35325 = r35323 - r35324;
        return r35325;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.6

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{\frac{1}{2}}{1}, \frac{y \cdot y}{1}, 1 \cdot y\right), z - 1, \log y \cdot \color{blue}{\left(x + \left(-1\right)\right)}\right) - t\]
  7. Applied distribute-lft-in0.4

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))