Average Error: 6.5 → 0.4
Time: 31.5s
Precision: 64
\[\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \log \left(1.0 - y\right)\right) - t\]
\[\mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{1}{2}, \frac{y}{1.0} \cdot \frac{y}{1.0}, y \cdot 1.0\right), z - 1.0, \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right), \left(x - 1.0\right) + \left(x - 1.0\right), \left(x - 1.0\right) \cdot \log \left({y}^{\frac{1}{3}}\right)\right) - t\right)\]
\left(\left(x - 1.0\right) \cdot \log y + \left(z - 1.0\right) \cdot \log \left(1.0 - y\right)\right) - t
\mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{1}{2}, \frac{y}{1.0} \cdot \frac{y}{1.0}, y \cdot 1.0\right), z - 1.0, \mathsf{fma}\left(\log \left(\sqrt[3]{y}\right), \left(x - 1.0\right) + \left(x - 1.0\right), \left(x - 1.0\right) \cdot \log \left({y}^{\frac{1}{3}}\right)\right) - t\right)
double f(double x, double y, double z, double t) {
        double r1919839 = x;
        double r1919840 = 1.0;
        double r1919841 = r1919839 - r1919840;
        double r1919842 = y;
        double r1919843 = log(r1919842);
        double r1919844 = r1919841 * r1919843;
        double r1919845 = z;
        double r1919846 = r1919845 - r1919840;
        double r1919847 = r1919840 - r1919842;
        double r1919848 = log(r1919847);
        double r1919849 = r1919846 * r1919848;
        double r1919850 = r1919844 + r1919849;
        double r1919851 = t;
        double r1919852 = r1919850 - r1919851;
        return r1919852;
}

double f(double x, double y, double z, double t) {
        double r1919853 = 1.0;
        double r1919854 = log(r1919853);
        double r1919855 = 0.5;
        double r1919856 = y;
        double r1919857 = r1919856 / r1919853;
        double r1919858 = r1919857 * r1919857;
        double r1919859 = r1919856 * r1919853;
        double r1919860 = fma(r1919855, r1919858, r1919859);
        double r1919861 = r1919854 - r1919860;
        double r1919862 = z;
        double r1919863 = r1919862 - r1919853;
        double r1919864 = cbrt(r1919856);
        double r1919865 = log(r1919864);
        double r1919866 = x;
        double r1919867 = r1919866 - r1919853;
        double r1919868 = r1919867 + r1919867;
        double r1919869 = 0.3333333333333333;
        double r1919870 = pow(r1919856, r1919869);
        double r1919871 = log(r1919870);
        double r1919872 = r1919867 * r1919871;
        double r1919873 = fma(r1919865, r1919868, r1919872);
        double r1919874 = t;
        double r1919875 = r1919873 - r1919874;
        double r1919876 = fma(r1919861, r1919863, r1919875);
        return r1919876;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 6.5

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{1}{2}, \frac{y}{1.0} \cdot \frac{y}{1.0}, 1.0 \cdot y\right), z - 1.0, \left(x - 1.0\right) \cdot \log \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} - t\right)\]
  7. Applied log-prod0.4

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

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

    \[\leadsto \mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{1}{2}, \frac{y}{1.0} \cdot \frac{y}{1.0}, 1.0 \cdot y\right), z - 1.0, \left(\color{blue}{\log \left(\sqrt[3]{y}\right) \cdot \left(\left(x - 1.0\right) + \left(x - 1.0\right)\right)} + \left(x - 1.0\right) \cdot \log \left(\sqrt[3]{y}\right)\right) - t\right)\]
  10. Using strategy rm
  11. Applied pow1/30.4

    \[\leadsto \mathsf{fma}\left(\log 1.0 - \mathsf{fma}\left(\frac{1}{2}, \frac{y}{1.0} \cdot \frac{y}{1.0}, 1.0 \cdot y\right), z - 1.0, \left(\log \left(\sqrt[3]{y}\right) \cdot \left(\left(x - 1.0\right) + \left(x - 1.0\right)\right) + \left(x - 1.0\right) \cdot \log \color{blue}{\left({y}^{\frac{1}{3}}\right)}\right) - t\right)\]
  12. Using strategy rm
  13. Applied fma-def0.4

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

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

Reproduce

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