Average Error: 7.2 → 0.5
Time: 24.2s
Precision: 64
\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\]
\[\left(\mathsf{fma}\left(x - 1, 2 \cdot \log \left(\sqrt[3]{y}\right), \left(x - 1\right) \cdot \log \left(\sqrt[3]{y}\right)\right) + \left(z - 1\right) \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{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
\left(\mathsf{fma}\left(x - 1, 2 \cdot \log \left(\sqrt[3]{y}\right), \left(x - 1\right) \cdot \log \left(\sqrt[3]{y}\right)\right) + \left(z - 1\right) \cdot \left(\log 1 - \mathsf{fma}\left(1, y, \frac{1}{2} \cdot \frac{{y}^{2}}{{1}^{2}}\right)\right)\right) - t
double f(double x, double y, double z, double t) {
        double r45003 = x;
        double r45004 = 1.0;
        double r45005 = r45003 - r45004;
        double r45006 = y;
        double r45007 = log(r45006);
        double r45008 = r45005 * r45007;
        double r45009 = z;
        double r45010 = r45009 - r45004;
        double r45011 = r45004 - r45006;
        double r45012 = log(r45011);
        double r45013 = r45010 * r45012;
        double r45014 = r45008 + r45013;
        double r45015 = t;
        double r45016 = r45014 - r45015;
        return r45016;
}

double f(double x, double y, double z, double t) {
        double r45017 = x;
        double r45018 = 1.0;
        double r45019 = r45017 - r45018;
        double r45020 = 2.0;
        double r45021 = y;
        double r45022 = cbrt(r45021);
        double r45023 = log(r45022);
        double r45024 = r45020 * r45023;
        double r45025 = r45019 * r45023;
        double r45026 = fma(r45019, r45024, r45025);
        double r45027 = z;
        double r45028 = r45027 - r45018;
        double r45029 = log(r45018);
        double r45030 = 0.5;
        double r45031 = pow(r45021, r45020);
        double r45032 = pow(r45018, r45020);
        double r45033 = r45031 / r45032;
        double r45034 = r45030 * r45033;
        double r45035 = fma(r45018, r45021, r45034);
        double r45036 = r45029 - r45035;
        double r45037 = r45028 * r45036;
        double r45038 = r45026 + r45037;
        double r45039 = t;
        double r45040 = r45038 - r45039;
        return r45040;
}

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

    \[\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.4

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

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

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

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

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

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

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

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

Reproduce

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