Average Error: 2.0 → 0.2
Time: 19.0s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\left(\log 1 - b\right) - 1 \cdot z\right)\right)} \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\left(\log 1 - b\right) - 1 \cdot z\right)\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r117351 = x;
        double r117352 = y;
        double r117353 = z;
        double r117354 = log(r117353);
        double r117355 = t;
        double r117356 = r117354 - r117355;
        double r117357 = r117352 * r117356;
        double r117358 = a;
        double r117359 = 1.0;
        double r117360 = r117359 - r117353;
        double r117361 = log(r117360);
        double r117362 = b;
        double r117363 = r117361 - r117362;
        double r117364 = r117358 * r117363;
        double r117365 = r117357 + r117364;
        double r117366 = exp(r117365);
        double r117367 = r117351 * r117366;
        return r117367;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r117368 = y;
        double r117369 = z;
        double r117370 = log(r117369);
        double r117371 = t;
        double r117372 = r117370 - r117371;
        double r117373 = a;
        double r117374 = 1.0;
        double r117375 = log(r117374);
        double r117376 = b;
        double r117377 = r117375 - r117376;
        double r117378 = r117374 * r117369;
        double r117379 = r117377 - r117378;
        double r117380 = r117373 * r117379;
        double r117381 = fma(r117368, r117372, r117380);
        double r117382 = exp(r117381);
        double r117383 = x;
        double r117384 = r117382 * r117383;
        return r117384;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 2.0

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
  2. Simplified1.8

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)} \cdot x}\]
  3. Taylor expanded around 0 0.2

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

    \[\leadsto e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\color{blue}{\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right)} - b\right)\right)} \cdot x\]
  5. Taylor expanded around 0 0.2

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

    \[\leadsto e^{\mathsf{fma}\left(y, \log z - t, \color{blue}{a \cdot \left(\left(\log 1 - b\right) - 1 \cdot z\right)}\right)} \cdot x\]
  7. Final simplification0.2

    \[\leadsto e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\left(\log 1 - b\right) - 1 \cdot z\right)\right)} \cdot x\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1 z)) b))))))