Average Error: 6.9 → 0.4
Time: 9.0s
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 r62060 = x;
        double r62061 = 1.0;
        double r62062 = r62060 - r62061;
        double r62063 = y;
        double r62064 = log(r62063);
        double r62065 = r62062 * r62064;
        double r62066 = z;
        double r62067 = r62066 - r62061;
        double r62068 = r62061 - r62063;
        double r62069 = log(r62068);
        double r62070 = r62067 * r62069;
        double r62071 = r62065 + r62070;
        double r62072 = t;
        double r62073 = r62071 - r62072;
        return r62073;
}

double f(double x, double y, double z, double t) {
        double r62074 = y;
        double r62075 = log(r62074);
        double r62076 = x;
        double r62077 = 1.0;
        double r62078 = r62076 - r62077;
        double r62079 = z;
        double r62080 = r62079 - r62077;
        double r62081 = log(r62077);
        double r62082 = r62077 * r62074;
        double r62083 = 0.5;
        double r62084 = 2.0;
        double r62085 = pow(r62074, r62084);
        double r62086 = pow(r62077, r62084);
        double r62087 = r62085 / r62086;
        double r62088 = r62083 * r62087;
        double r62089 = r62082 + r62088;
        double r62090 = r62081 - r62089;
        double r62091 = r62080 * r62090;
        double r62092 = t;
        double r62093 = r62091 - r62092;
        double r62094 = fma(r62075, r62078, r62093);
        return r62094;
}

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 2020056 +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))