Average Error: 7.0 → 0.3
Time: 10.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 r61642 = x;
        double r61643 = 1.0;
        double r61644 = r61642 - r61643;
        double r61645 = y;
        double r61646 = log(r61645);
        double r61647 = r61644 * r61646;
        double r61648 = z;
        double r61649 = r61648 - r61643;
        double r61650 = r61643 - r61645;
        double r61651 = log(r61650);
        double r61652 = r61649 * r61651;
        double r61653 = r61647 + r61652;
        double r61654 = t;
        double r61655 = r61653 - r61654;
        return r61655;
}

double f(double x, double y, double z, double t) {
        double r61656 = y;
        double r61657 = log(r61656);
        double r61658 = x;
        double r61659 = 1.0;
        double r61660 = r61658 - r61659;
        double r61661 = z;
        double r61662 = r61661 - r61659;
        double r61663 = log(r61659);
        double r61664 = r61659 * r61656;
        double r61665 = 0.5;
        double r61666 = 2.0;
        double r61667 = pow(r61656, r61666);
        double r61668 = pow(r61659, r61666);
        double r61669 = r61667 / r61668;
        double r61670 = r61665 * r61669;
        double r61671 = r61664 + r61670;
        double r61672 = r61663 - r61671;
        double r61673 = r61662 * r61672;
        double r61674 = t;
        double r61675 = r61673 - r61674;
        double r61676 = fma(r61657, r61660, r61675);
        return r61676;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.0

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

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