Average Error: 7.1 → 0.4
Time: 12.2s
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 r52216 = x;
        double r52217 = 1.0;
        double r52218 = r52216 - r52217;
        double r52219 = y;
        double r52220 = log(r52219);
        double r52221 = r52218 * r52220;
        double r52222 = z;
        double r52223 = r52222 - r52217;
        double r52224 = r52217 - r52219;
        double r52225 = log(r52224);
        double r52226 = r52223 * r52225;
        double r52227 = r52221 + r52226;
        double r52228 = t;
        double r52229 = r52227 - r52228;
        return r52229;
}

double f(double x, double y, double z, double t) {
        double r52230 = y;
        double r52231 = log(r52230);
        double r52232 = x;
        double r52233 = 1.0;
        double r52234 = r52232 - r52233;
        double r52235 = z;
        double r52236 = r52235 - r52233;
        double r52237 = log(r52233);
        double r52238 = r52233 * r52230;
        double r52239 = 0.5;
        double r52240 = 2.0;
        double r52241 = pow(r52230, r52240);
        double r52242 = pow(r52233, r52240);
        double r52243 = r52241 / r52242;
        double r52244 = r52239 * r52243;
        double r52245 = r52238 + r52244;
        double r52246 = r52237 - r52245;
        double r52247 = r52236 * r52246;
        double r52248 = t;
        double r52249 = r52247 - r52248;
        double r52250 = fma(r52231, r52234, r52249);
        return r52250;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 7.1

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\]
  2. Taylor expanded around 0 0.4

    \[\leadsto \left(\left(x - 1\right) \cdot \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\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.4

    \[\leadsto \left(\left(x - 1\right) \cdot \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)\right) - \color{blue}{1 \cdot t}\]
  5. Applied *-un-lft-identity0.4

    \[\leadsto \color{blue}{1 \cdot \left(\left(x - 1\right) \cdot \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)\right)} - 1 \cdot t\]
  6. Applied distribute-lft-out--0.4

    \[\leadsto \color{blue}{1 \cdot \left(\left(\left(x - 1\right) \cdot \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)\right) - t\right)}\]
  7. Simplified0.4

    \[\leadsto 1 \cdot \color{blue}{\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)}\]
  8. Final simplification0.4

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