Average Error: 2.2 → 0.3
Time: 17.0s
Precision: 64
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\]
\[\sqrt{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 \left(\sqrt{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\right)\]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\sqrt{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 \left(\sqrt{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\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r117172 = x;
        double r117173 = y;
        double r117174 = z;
        double r117175 = log(r117174);
        double r117176 = t;
        double r117177 = r117175 - r117176;
        double r117178 = r117173 * r117177;
        double r117179 = a;
        double r117180 = 1.0;
        double r117181 = r117180 - r117174;
        double r117182 = log(r117181);
        double r117183 = b;
        double r117184 = r117182 - r117183;
        double r117185 = r117179 * r117184;
        double r117186 = r117178 + r117185;
        double r117187 = exp(r117186);
        double r117188 = r117172 * r117187;
        return r117188;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r117189 = y;
        double r117190 = z;
        double r117191 = log(r117190);
        double r117192 = t;
        double r117193 = r117191 - r117192;
        double r117194 = a;
        double r117195 = 1.0;
        double r117196 = log(r117195);
        double r117197 = 0.5;
        double r117198 = 2.0;
        double r117199 = pow(r117190, r117198);
        double r117200 = pow(r117195, r117198);
        double r117201 = r117199 / r117200;
        double r117202 = r117195 * r117190;
        double r117203 = fma(r117197, r117201, r117202);
        double r117204 = r117196 - r117203;
        double r117205 = b;
        double r117206 = r117204 - r117205;
        double r117207 = r117194 * r117206;
        double r117208 = fma(r117189, r117193, r117207);
        double r117209 = exp(r117208);
        double r117210 = sqrt(r117209);
        double r117211 = x;
        double r117212 = r117210 * r117211;
        double r117213 = r117210 * r117212;
        return r117213;
}

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 add-sqr-sqrt0.3

    \[\leadsto \color{blue}{\left(\sqrt{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 \sqrt{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)} \cdot x\]
  7. Applied associate-*l*0.3

    \[\leadsto \color{blue}{\sqrt{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 \left(\sqrt{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\right)}\]
  8. Final simplification0.3

    \[\leadsto \sqrt{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 \left(\sqrt{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\right)\]

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))))))