Average Error: 6.7 → 0.4
Time: 20.7s
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(x - 1, \log y, 0.5 \cdot {y}^{2} - \mathsf{fma}\left(1, z \cdot y, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)\right) - t\]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\mathsf{fma}\left(x - 1, \log y, 0.5 \cdot {y}^{2} - \mathsf{fma}\left(1, z \cdot y, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r53448 = x;
        double r53449 = 1.0;
        double r53450 = r53448 - r53449;
        double r53451 = y;
        double r53452 = log(r53451);
        double r53453 = r53450 * r53452;
        double r53454 = z;
        double r53455 = r53454 - r53449;
        double r53456 = r53449 - r53451;
        double r53457 = log(r53456);
        double r53458 = r53455 * r53457;
        double r53459 = r53453 + r53458;
        double r53460 = t;
        double r53461 = r53459 - r53460;
        return r53461;
}

double f(double x, double y, double z, double t) {
        double r53462 = x;
        double r53463 = 1.0;
        double r53464 = r53462 - r53463;
        double r53465 = y;
        double r53466 = log(r53465);
        double r53467 = 0.5;
        double r53468 = 2.0;
        double r53469 = pow(r53465, r53468);
        double r53470 = r53467 * r53469;
        double r53471 = z;
        double r53472 = r53471 * r53465;
        double r53473 = r53471 * r53469;
        double r53474 = r53467 * r53473;
        double r53475 = fma(r53463, r53472, r53474);
        double r53476 = r53470 - r53475;
        double r53477 = fma(r53464, r53466, r53476);
        double r53478 = t;
        double r53479 = r53477 - r53478;
        return r53479;
}

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(x - 1, \log y, \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t}\]
  3. Taylor expanded around 0 0.3

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

    \[\leadsto \mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \color{blue}{\left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)}\right) - t\]
  5. Taylor expanded around inf 0.4

    \[\leadsto \mathsf{fma}\left(x - 1, \log y, \color{blue}{0.5 \cdot {y}^{2} - \left(1 \cdot \left(z \cdot y\right) + 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)}\right) - t\]
  6. Simplified0.4

    \[\leadsto \mathsf{fma}\left(x - 1, \log y, \color{blue}{0.5 \cdot {y}^{2} - \mathsf{fma}\left(1, z \cdot y, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)}\right) - t\]
  7. Final simplification0.4

    \[\leadsto \mathsf{fma}\left(x - 1, \log y, 0.5 \cdot {y}^{2} - \mathsf{fma}\left(1, z \cdot y, 0.5 \cdot \left(z \cdot {y}^{2}\right)\right)\right) - t\]

Reproduce

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