Average Error: 6.7 → 0.7
Time: 9.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(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \mathsf{fma}\left(\mathsf{fma}\left(-1, 1, 1\right), \log y, \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(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \mathsf{fma}\left(\mathsf{fma}\left(-1, 1, 1\right), \log y, \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 r56654 = x;
        double r56655 = 1.0;
        double r56656 = r56654 - r56655;
        double r56657 = y;
        double r56658 = log(r56657);
        double r56659 = r56656 * r56658;
        double r56660 = z;
        double r56661 = r56660 - r56655;
        double r56662 = r56655 - r56657;
        double r56663 = log(r56662);
        double r56664 = r56661 * r56663;
        double r56665 = r56659 + r56664;
        double r56666 = t;
        double r56667 = r56665 - r56666;
        return r56667;
}

double f(double x, double y, double z, double t) {
        double r56668 = x;
        double r56669 = cbrt(r56668);
        double r56670 = r56669 * r56669;
        double r56671 = 1.0;
        double r56672 = 1.0;
        double r56673 = r56671 * r56672;
        double r56674 = -r56673;
        double r56675 = fma(r56670, r56669, r56674);
        double r56676 = y;
        double r56677 = log(r56676);
        double r56678 = r56675 * r56677;
        double r56679 = -r56671;
        double r56680 = fma(r56679, r56672, r56671);
        double r56681 = z;
        double r56682 = r56681 - r56671;
        double r56683 = log(r56671);
        double r56684 = r56671 * r56676;
        double r56685 = 0.5;
        double r56686 = 2.0;
        double r56687 = pow(r56676, r56686);
        double r56688 = pow(r56671, r56686);
        double r56689 = r56687 / r56688;
        double r56690 = r56685 * r56689;
        double r56691 = r56684 + r56690;
        double r56692 = r56683 - r56691;
        double r56693 = r56682 * r56692;
        double r56694 = t;
        double r56695 = r56693 - r56694;
        double r56696 = fma(r56680, r56677, r56695);
        double r56697 = r56678 + r56696;
        return r56697;
}

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. Using strategy rm
  5. Applied fma-udef0.4

    \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\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)}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.4

    \[\leadsto \log y \cdot \left(x - \color{blue}{1 \cdot 1}\right) + \left(\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)\]
  8. Applied add-cube-cbrt0.7

    \[\leadsto \log y \cdot \left(\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - 1 \cdot 1\right) + \left(\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)\]
  9. Applied prod-diff0.7

    \[\leadsto \log y \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) + \mathsf{fma}\left(-1, 1, 1 \cdot 1\right)\right)} + \left(\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)\]
  10. Applied distribute-rgt-in0.7

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \mathsf{fma}\left(-1, 1, 1 \cdot 1\right) \cdot \log y\right)} + \left(\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)\]
  11. Applied associate-+l+0.7

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \left(\mathsf{fma}\left(-1, 1, 1 \cdot 1\right) \cdot \log y + \left(\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)\right)}\]
  12. Simplified0.7

    \[\leadsto \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-1, 1, 1\right), \log y, \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)}\]
  13. Final simplification0.7

    \[\leadsto \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -1 \cdot 1\right) \cdot \log y + \mathsf{fma}\left(\mathsf{fma}\left(-1, 1, 1\right), \log y, \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 2019353 +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))