Average Error: 7.0 → 0.3
Time: 21.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 r126864 = x;
        double r126865 = 1.0;
        double r126866 = r126864 - r126865;
        double r126867 = y;
        double r126868 = log(r126867);
        double r126869 = r126866 * r126868;
        double r126870 = z;
        double r126871 = r126870 - r126865;
        double r126872 = r126865 - r126867;
        double r126873 = log(r126872);
        double r126874 = r126871 * r126873;
        double r126875 = r126869 + r126874;
        double r126876 = t;
        double r126877 = r126875 - r126876;
        return r126877;
}

double f(double x, double y, double z, double t) {
        double r126878 = y;
        double r126879 = log(r126878);
        double r126880 = x;
        double r126881 = 1.0;
        double r126882 = r126880 - r126881;
        double r126883 = z;
        double r126884 = r126883 - r126881;
        double r126885 = log(r126881);
        double r126886 = r126881 * r126878;
        double r126887 = 0.5;
        double r126888 = 2.0;
        double r126889 = pow(r126878, r126888);
        double r126890 = pow(r126881, r126888);
        double r126891 = r126889 / r126890;
        double r126892 = r126887 * r126891;
        double r126893 = r126886 + r126892;
        double r126894 = r126885 - r126893;
        double r126895 = r126884 * r126894;
        double r126896 = t;
        double r126897 = r126895 - r126896;
        double r126898 = fma(r126879, r126882, r126897);
        return r126898;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.0

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

    \[\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.3

    \[\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.3

    \[\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 2020081 +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))