Average Error: 6.7 → 0.4
Time: 25.8s
Precision: 64
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\mathsf{fma}\left(x - 1, 2 \cdot \log \left(\sqrt[3]{y}\right), \left(x - 1\right) \cdot \log \left(\sqrt[3]{y}\right)\right) + \left(z - 1\right) \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t\]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\left(\mathsf{fma}\left(x - 1, 2 \cdot \log \left(\sqrt[3]{y}\right), \left(x - 1\right) \cdot \log \left(\sqrt[3]{y}\right)\right) + \left(z - 1\right) \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r48974 = x;
        double r48975 = 1.0;
        double r48976 = r48974 - r48975;
        double r48977 = y;
        double r48978 = log(r48977);
        double r48979 = r48976 * r48978;
        double r48980 = z;
        double r48981 = r48980 - r48975;
        double r48982 = r48975 - r48977;
        double r48983 = log(r48982);
        double r48984 = r48981 * r48983;
        double r48985 = r48979 + r48984;
        double r48986 = t;
        double r48987 = r48985 - r48986;
        return r48987;
}

double f(double x, double y, double z, double t) {
        double r48988 = x;
        double r48989 = 1.0;
        double r48990 = r48988 - r48989;
        double r48991 = 2.0;
        double r48992 = y;
        double r48993 = cbrt(r48992);
        double r48994 = log(r48993);
        double r48995 = r48991 * r48994;
        double r48996 = r48990 * r48994;
        double r48997 = fma(r48990, r48995, r48996);
        double r48998 = z;
        double r48999 = r48998 - r48989;
        double r49000 = log(r48989);
        double r49001 = 0.5;
        double r49002 = pow(r48992, r48991);
        double r49003 = pow(r48989, r48991);
        double r49004 = r49002 / r49003;
        double r49005 = r49001 * r49004;
        double r49006 = fma(r48989, r48992, r49005);
        double r49007 = r49000 - r49006;
        double r49008 = r48999 * r49007;
        double r49009 = r48997 + r49008;
        double r49010 = t;
        double r49011 = r49009 - r49010;
        return r49011;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.7

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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