Average Error: 2.1 → 0.4
Time: 29.9s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[e^{\mathsf{log1p}\left(\mathsf{expm1}\left(\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, y \cdot \left(\log z - t\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)}
e^{\mathsf{log1p}\left(\mathsf{expm1}\left(\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, y \cdot \left(\log z - t\right)\right)\right)\right)} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r161945 = x;
        double r161946 = y;
        double r161947 = z;
        double r161948 = log(r161947);
        double r161949 = t;
        double r161950 = r161948 - r161949;
        double r161951 = r161946 * r161950;
        double r161952 = a;
        double r161953 = 1.0;
        double r161954 = r161953 - r161947;
        double r161955 = log(r161954);
        double r161956 = b;
        double r161957 = r161955 - r161956;
        double r161958 = r161952 * r161957;
        double r161959 = r161951 + r161958;
        double r161960 = exp(r161959);
        double r161961 = r161945 * r161960;
        return r161961;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r161962 = 1.0;
        double r161963 = log(r161962);
        double r161964 = 0.5;
        double r161965 = z;
        double r161966 = 2.0;
        double r161967 = pow(r161965, r161966);
        double r161968 = pow(r161962, r161966);
        double r161969 = r161967 / r161968;
        double r161970 = b;
        double r161971 = fma(r161962, r161965, r161970);
        double r161972 = fma(r161964, r161969, r161971);
        double r161973 = r161963 - r161972;
        double r161974 = a;
        double r161975 = y;
        double r161976 = log(r161965);
        double r161977 = t;
        double r161978 = r161976 - r161977;
        double r161979 = r161975 * r161978;
        double r161980 = fma(r161973, r161974, r161979);
        double r161981 = expm1(r161980);
        double r161982 = log1p(r161981);
        double r161983 = exp(r161982);
        double r161984 = x;
        double r161985 = r161983 * r161984;
        return r161985;
}

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}{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 log1p-expm1-u0.4

    \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\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.4

    \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\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, y \cdot \left(\log z - t\right)\right)\right)}\right)} \cdot x\]
  8. Final simplification0.4

    \[\leadsto e^{\mathsf{log1p}\left(\mathsf{expm1}\left(\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, y \cdot \left(\log z - t\right)\right)\right)\right)} \cdot x\]

Reproduce

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