Average Error: 7.4 → 1.0
Time: 7.8s
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(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right), z - 1, \left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot \left(x - 1\right)\right) - t\right) + \mathsf{fma}\left(-t, 1, t \cdot 1\right)\]
\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(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right), z - 1, \left(\sqrt[3]{\log y} \cdot \sqrt[3]{\log y}\right) \cdot \left(\sqrt[3]{\log y} \cdot \left(x - 1\right)\right) - t\right) + \mathsf{fma}\left(-t, 1, t \cdot 1\right)
double f(double x, double y, double z, double t) {
        double r53984 = x;
        double r53985 = 1.0;
        double r53986 = r53984 - r53985;
        double r53987 = y;
        double r53988 = log(r53987);
        double r53989 = r53986 * r53988;
        double r53990 = z;
        double r53991 = r53990 - r53985;
        double r53992 = r53985 - r53987;
        double r53993 = log(r53992);
        double r53994 = r53991 * r53993;
        double r53995 = r53989 + r53994;
        double r53996 = t;
        double r53997 = r53995 - r53996;
        return r53997;
}

double f(double x, double y, double z, double t) {
        double r53998 = 1.0;
        double r53999 = log(r53998);
        double r54000 = y;
        double r54001 = 0.5;
        double r54002 = 2.0;
        double r54003 = pow(r54000, r54002);
        double r54004 = pow(r53998, r54002);
        double r54005 = r54003 / r54004;
        double r54006 = r54001 * r54005;
        double r54007 = fma(r53998, r54000, r54006);
        double r54008 = r53999 - r54007;
        double r54009 = z;
        double r54010 = r54009 - r53998;
        double r54011 = log(r54000);
        double r54012 = cbrt(r54011);
        double r54013 = r54012 * r54012;
        double r54014 = x;
        double r54015 = r54014 - r53998;
        double r54016 = r54012 * r54015;
        double r54017 = r54013 * r54016;
        double r54018 = t;
        double r54019 = r54017 - r54018;
        double r54020 = fma(r54008, r54010, r54019);
        double r54021 = -r54018;
        double r54022 = 1.0;
        double r54023 = r54018 * r54022;
        double r54024 = fma(r54021, r54022, r54023);
        double r54025 = r54020 + r54024;
        return r54025;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.4

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

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

    \[\leadsto \mathsf{fma}\left(\log y, x - 1, \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)} - t\right)\]
  4. Using strategy rm
  5. Applied fma-udef0.4

    \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\left(z - 1\right) \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - t\right)}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto \log y \cdot \left(x - 1\right) + \left(\left(z - 1\right) \cdot \left(\log 1 - \left(1 \cdot y + \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right) - \color{blue}{1 \cdot t}\right)\]
  8. Applied prod-diff0.4

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

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

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

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

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

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

Reproduce

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