Average Error: 2.2 → 0.3
Time: 14.8s
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 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\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 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, 1 \cdot z\right)\right) - b\right)\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r117209 = x;
        double r117210 = y;
        double r117211 = z;
        double r117212 = log(r117211);
        double r117213 = t;
        double r117214 = r117212 - r117213;
        double r117215 = r117210 * r117214;
        double r117216 = a;
        double r117217 = 1.0;
        double r117218 = r117217 - r117211;
        double r117219 = log(r117218);
        double r117220 = b;
        double r117221 = r117219 - r117220;
        double r117222 = r117216 * r117221;
        double r117223 = r117215 + r117222;
        double r117224 = exp(r117223);
        double r117225 = r117209 * r117224;
        return r117225;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r117226 = y;
        double r117227 = z;
        double r117228 = log(r117227);
        double r117229 = t;
        double r117230 = r117228 - r117229;
        double r117231 = a;
        double r117232 = 1.0;
        double r117233 = log(r117232);
        double r117234 = 0.5;
        double r117235 = 2.0;
        double r117236 = pow(r117227, r117235);
        double r117237 = pow(r117232, r117235);
        double r117238 = r117236 / r117237;
        double r117239 = r117232 * r117227;
        double r117240 = fma(r117234, r117238, r117239);
        double r117241 = r117233 - r117240;
        double r117242 = b;
        double r117243 = r117241 - r117242;
        double r117244 = r117231 * r117243;
        double r117245 = fma(r117226, r117230, r117244);
        double r117246 = exp(r117245);
        double r117247 = x;
        double r117248 = r117246 * r117247;
        return r117248;
}

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.2

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

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

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

    \[\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. Final simplification0.3

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

Reproduce

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