Average Error: 1.8 → 0.2
Time: 55.7s
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}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{1} \cdot \frac{-1}{2}, \frac{z}{1}, \log 1 - \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)\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}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{1} \cdot \frac{-1}{2}, \frac{z}{1}, \log 1 - \mathsf{fma}\left(z, 1, b\right)\right), a, \left(\log z - t\right) \cdot y\right)\right)}\right)\right) \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r3868871 = x;
        double r3868872 = y;
        double r3868873 = z;
        double r3868874 = log(r3868873);
        double r3868875 = t;
        double r3868876 = r3868874 - r3868875;
        double r3868877 = r3868872 * r3868876;
        double r3868878 = a;
        double r3868879 = 1.0;
        double r3868880 = r3868879 - r3868873;
        double r3868881 = log(r3868880);
        double r3868882 = b;
        double r3868883 = r3868881 - r3868882;
        double r3868884 = r3868878 * r3868883;
        double r3868885 = r3868877 + r3868884;
        double r3868886 = exp(r3868885);
        double r3868887 = r3868871 * r3868886;
        return r3868887;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r3868888 = exp(1.0);
        double r3868889 = z;
        double r3868890 = 1.0;
        double r3868891 = r3868889 / r3868890;
        double r3868892 = -0.5;
        double r3868893 = r3868891 * r3868892;
        double r3868894 = log(r3868890);
        double r3868895 = b;
        double r3868896 = fma(r3868889, r3868890, r3868895);
        double r3868897 = r3868894 - r3868896;
        double r3868898 = fma(r3868893, r3868891, r3868897);
        double r3868899 = a;
        double r3868900 = log(r3868889);
        double r3868901 = t;
        double r3868902 = r3868900 - r3868901;
        double r3868903 = y;
        double r3868904 = r3868902 * r3868903;
        double r3868905 = fma(r3868898, r3868899, r3868904);
        double r3868906 = pow(r3868888, r3868905);
        double r3868907 = log1p(r3868906);
        double r3868908 = expm1(r3868907);
        double r3868909 = x;
        double r3868910 = r3868908 * r3868909;
        return r3868910;
}

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 1.8

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

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

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

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

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

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

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

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

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

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

Reproduce

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