Average Error: 2.2 → 0.3
Time: 32.0s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, \mathsf{fma}\left(1, z, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}\right)\right) \cdot x\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(\log 1 - \mathsf{fma}\left(\frac{1}{2}, \frac{{z}^{2}}{{1}^{2}}, \mathsf{fma}\left(1, z, b\right)\right), a, \left(\log z - t\right) \cdot y\right)}\right)\right) \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r90196 = x;
        double r90197 = y;
        double r90198 = z;
        double r90199 = log(r90198);
        double r90200 = t;
        double r90201 = r90199 - r90200;
        double r90202 = r90197 * r90201;
        double r90203 = a;
        double r90204 = 1.0;
        double r90205 = r90204 - r90198;
        double r90206 = log(r90205);
        double r90207 = b;
        double r90208 = r90206 - r90207;
        double r90209 = r90203 * r90208;
        double r90210 = r90202 + r90209;
        double r90211 = exp(r90210);
        double r90212 = r90196 * r90211;
        return r90212;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r90213 = 1.0;
        double r90214 = log(r90213);
        double r90215 = 0.5;
        double r90216 = z;
        double r90217 = 2.0;
        double r90218 = pow(r90216, r90217);
        double r90219 = pow(r90213, r90217);
        double r90220 = r90218 / r90219;
        double r90221 = b;
        double r90222 = fma(r90213, r90216, r90221);
        double r90223 = fma(r90215, r90220, r90222);
        double r90224 = r90214 - r90223;
        double r90225 = a;
        double r90226 = log(r90216);
        double r90227 = t;
        double r90228 = r90226 - r90227;
        double r90229 = y;
        double r90230 = r90228 * r90229;
        double r90231 = fma(r90224, r90225, r90230);
        double r90232 = exp(r90231);
        double r90233 = log1p(r90232);
        double r90234 = expm1(r90233);
        double r90235 = x;
        double r90236 = r90234 * r90235;
        return r90236;
}

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. Using strategy rm
  6. Applied expm1-log1p-u0.3

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(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)}\right)\right)} \cdot x\]
  7. Simplified0.3

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

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

Reproduce

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