Average Error: 6.7 → 0.4
Time: 8.5s
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 r50396 = x;
        double r50397 = 1.0;
        double r50398 = r50396 - r50397;
        double r50399 = y;
        double r50400 = log(r50399);
        double r50401 = r50398 * r50400;
        double r50402 = z;
        double r50403 = r50402 - r50397;
        double r50404 = r50397 - r50399;
        double r50405 = log(r50404);
        double r50406 = r50403 * r50405;
        double r50407 = r50401 + r50406;
        double r50408 = t;
        double r50409 = r50407 - r50408;
        return r50409;
}

double f(double x, double y, double z, double t) {
        double r50410 = y;
        double r50411 = log(r50410);
        double r50412 = x;
        double r50413 = 1.0;
        double r50414 = r50412 - r50413;
        double r50415 = z;
        double r50416 = r50415 - r50413;
        double r50417 = log(r50413);
        double r50418 = r50413 * r50410;
        double r50419 = 0.5;
        double r50420 = 2.0;
        double r50421 = pow(r50410, r50420);
        double r50422 = pow(r50413, r50420);
        double r50423 = r50421 / r50422;
        double r50424 = r50419 * r50423;
        double r50425 = r50418 + r50424;
        double r50426 = r50417 - r50425;
        double r50427 = r50416 * r50426;
        double r50428 = t;
        double r50429 = r50427 - r50428;
        double r50430 = fma(r50411, r50414, r50429);
        return r50430;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.7

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

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