Average Error: 2.1 → 0.3
Time: 27.1s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(\mathsf{fma}\left(z \cdot 1, \frac{-1}{2} \cdot z, \log 1 - z \cdot 1\right) - b, a, \left(\log z - t\right) \cdot y\right)}\right)\right)\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
x \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(e^{\mathsf{fma}\left(\mathsf{fma}\left(z \cdot 1, \frac{-1}{2} \cdot z, \log 1 - z \cdot 1\right) - b, a, \left(\log z - t\right) \cdot y\right)}\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r4749046 = x;
        double r4749047 = y;
        double r4749048 = z;
        double r4749049 = log(r4749048);
        double r4749050 = t;
        double r4749051 = r4749049 - r4749050;
        double r4749052 = r4749047 * r4749051;
        double r4749053 = a;
        double r4749054 = 1.0;
        double r4749055 = r4749054 - r4749048;
        double r4749056 = log(r4749055);
        double r4749057 = b;
        double r4749058 = r4749056 - r4749057;
        double r4749059 = r4749053 * r4749058;
        double r4749060 = r4749052 + r4749059;
        double r4749061 = exp(r4749060);
        double r4749062 = r4749046 * r4749061;
        return r4749062;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r4749063 = x;
        double r4749064 = z;
        double r4749065 = 1.0;
        double r4749066 = r4749064 * r4749065;
        double r4749067 = -0.5;
        double r4749068 = r4749067 * r4749064;
        double r4749069 = log(r4749065);
        double r4749070 = r4749069 - r4749066;
        double r4749071 = fma(r4749066, r4749068, r4749070);
        double r4749072 = b;
        double r4749073 = r4749071 - r4749072;
        double r4749074 = a;
        double r4749075 = log(r4749064);
        double r4749076 = t;
        double r4749077 = r4749075 - r4749076;
        double r4749078 = y;
        double r4749079 = r4749077 * r4749078;
        double r4749080 = fma(r4749073, r4749074, r4749079);
        double r4749081 = exp(r4749080);
        double r4749082 = log1p(r4749081);
        double r4749083 = expm1(r4749082);
        double r4749084 = r4749063 * r4749083;
        return r4749084;
}

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

    \[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}{x \cdot e^{\mathsf{fma}\left(y, \log z - t, \left(\log \left(1 - z\right) - b\right) \cdot a\right)}}\]
  3. Taylor expanded around 0 0.2

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

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

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

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

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

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

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

Reproduce

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