Average Error: 6.9 → 0.4
Time: 10.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 y, x - 1, \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)\]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(\log y, x - 1, \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)
double f(double x, double y, double z, double t) {
        double r63888 = x;
        double r63889 = 1.0;
        double r63890 = r63888 - r63889;
        double r63891 = y;
        double r63892 = log(r63891);
        double r63893 = r63890 * r63892;
        double r63894 = z;
        double r63895 = r63894 - r63889;
        double r63896 = r63889 - r63891;
        double r63897 = log(r63896);
        double r63898 = r63895 * r63897;
        double r63899 = r63893 + r63898;
        double r63900 = t;
        double r63901 = r63899 - r63900;
        return r63901;
}

double f(double x, double y, double z, double t) {
        double r63902 = y;
        double r63903 = log(r63902);
        double r63904 = x;
        double r63905 = 1.0;
        double r63906 = r63904 - r63905;
        double r63907 = z;
        double r63908 = r63907 - r63905;
        double r63909 = log(r63905);
        double r63910 = r63905 * r63902;
        double r63911 = 0.5;
        double r63912 = 2.0;
        double r63913 = pow(r63902, r63912);
        double r63914 = pow(r63905, r63912);
        double r63915 = r63913 / r63914;
        double r63916 = r63911 * r63915;
        double r63917 = r63910 + r63916;
        double r63918 = r63909 - r63917;
        double r63919 = r63908 * r63918;
        double r63920 = t;
        double r63921 = r63919 - r63920;
        double r63922 = fma(r63903, r63906, r63921);
        return r63922;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.9

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

    \[\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. Final simplification0.4

    \[\leadsto \mathsf{fma}\left(\log y, x - 1, \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)\]

Reproduce

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