Average Error: 7.2 → 0.3
Time: 23.1s
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 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{1}{2}, \frac{y}{1}, y \cdot 1\right), z - 1, \log y \cdot \left(x - 1\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 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{1}{2}, \frac{y}{1}, y \cdot 1\right), z - 1, \log y \cdot \left(x - 1\right) - t\right)
double f(double x, double y, double z, double t) {
        double r1866416 = x;
        double r1866417 = 1.0;
        double r1866418 = r1866416 - r1866417;
        double r1866419 = y;
        double r1866420 = log(r1866419);
        double r1866421 = r1866418 * r1866420;
        double r1866422 = z;
        double r1866423 = r1866422 - r1866417;
        double r1866424 = r1866417 - r1866419;
        double r1866425 = log(r1866424);
        double r1866426 = r1866423 * r1866425;
        double r1866427 = r1866421 + r1866426;
        double r1866428 = t;
        double r1866429 = r1866427 - r1866428;
        return r1866429;
}

double f(double x, double y, double z, double t) {
        double r1866430 = 1.0;
        double r1866431 = log(r1866430);
        double r1866432 = y;
        double r1866433 = r1866432 / r1866430;
        double r1866434 = 0.5;
        double r1866435 = r1866433 * r1866434;
        double r1866436 = r1866432 * r1866430;
        double r1866437 = fma(r1866435, r1866433, r1866436);
        double r1866438 = r1866431 - r1866437;
        double r1866439 = z;
        double r1866440 = r1866439 - r1866430;
        double r1866441 = log(r1866432);
        double r1866442 = x;
        double r1866443 = r1866442 - r1866430;
        double r1866444 = r1866441 * r1866443;
        double r1866445 = t;
        double r1866446 = r1866444 - r1866445;
        double r1866447 = fma(r1866438, r1866440, r1866446);
        return r1866447;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.2

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log \left(1 - y\right), z - 1, \log y \cdot \left(x - 1\right)\right) - t}\]
  3. Taylor expanded around 0 0.3

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

    \[\leadsto \mathsf{fma}\left(\color{blue}{\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right)}, z - 1, \log y \cdot \left(x - 1\right)\right) - t\]
  5. Using strategy rm
  6. Applied sub-neg0.3

    \[\leadsto \mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right), z - 1, \log y \cdot \color{blue}{\left(x + \left(-1\right)\right)}\right) - t\]
  7. Applied distribute-rgt-in0.3

    \[\leadsto \mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right), z - 1, \color{blue}{x \cdot \log y + \left(-1\right) \cdot \log y}\right) - t\]
  8. Using strategy rm
  9. Applied *-un-lft-identity0.3

    \[\leadsto \mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right), z - 1, x \cdot \log y + \left(-1\right) \cdot \log y\right) - \color{blue}{1 \cdot t}\]
  10. Applied *-un-lft-identity0.3

    \[\leadsto \color{blue}{1 \cdot \mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right), z - 1, x \cdot \log y + \left(-1\right) \cdot \log y\right)} - 1 \cdot t\]
  11. Applied distribute-lft-out--0.3

    \[\leadsto \color{blue}{1 \cdot \left(\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(1, y, \left(\frac{y}{1} \cdot \frac{y}{1}\right) \cdot \frac{1}{2}\right), z - 1, x \cdot \log y + \left(-1\right) \cdot \log y\right) - t\right)}\]
  12. Simplified0.3

    \[\leadsto 1 \cdot \color{blue}{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{y}{1} \cdot \frac{1}{2}, \frac{y}{1}, y \cdot 1\right), z - 1, \left(x - 1\right) \cdot \log y - t\right)}\]
  13. Final simplification0.3

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))