Average Error: 7.1 → 0.3
Time: 11.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 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 r74421 = x;
        double r74422 = 1.0;
        double r74423 = r74421 - r74422;
        double r74424 = y;
        double r74425 = log(r74424);
        double r74426 = r74423 * r74425;
        double r74427 = z;
        double r74428 = r74427 - r74422;
        double r74429 = r74422 - r74424;
        double r74430 = log(r74429);
        double r74431 = r74428 * r74430;
        double r74432 = r74426 + r74431;
        double r74433 = t;
        double r74434 = r74432 - r74433;
        return r74434;
}

double f(double x, double y, double z, double t) {
        double r74435 = y;
        double r74436 = log(r74435);
        double r74437 = x;
        double r74438 = 1.0;
        double r74439 = r74437 - r74438;
        double r74440 = z;
        double r74441 = r74440 - r74438;
        double r74442 = log(r74438);
        double r74443 = r74438 * r74435;
        double r74444 = 0.5;
        double r74445 = 2.0;
        double r74446 = pow(r74435, r74445);
        double r74447 = pow(r74438, r74445);
        double r74448 = r74446 / r74447;
        double r74449 = r74444 * r74448;
        double r74450 = r74443 + r74449;
        double r74451 = r74442 - r74450;
        double r74452 = r74441 * r74451;
        double r74453 = t;
        double r74454 = r74452 - r74453;
        double r74455 = fma(r74436, r74439, r74454);
        return r74455;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.1

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

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