Average Error: 2.0 → 1.3
Time: 18.4s
Precision: 64
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
\[\frac{\frac{x}{e^{\mathsf{fma}\left(y, -\log z, b - t \cdot \log a\right)}} \cdot {\left(\frac{1}{{a}^{1}}\right)}^{1}}{y}\]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\frac{\frac{x}{e^{\mathsf{fma}\left(y, -\log z, b - t \cdot \log a\right)}} \cdot {\left(\frac{1}{{a}^{1}}\right)}^{1}}{y}
double f(double x, double y, double z, double t, double a, double b) {
        double r512373 = x;
        double r512374 = y;
        double r512375 = z;
        double r512376 = log(r512375);
        double r512377 = r512374 * r512376;
        double r512378 = t;
        double r512379 = 1.0;
        double r512380 = r512378 - r512379;
        double r512381 = a;
        double r512382 = log(r512381);
        double r512383 = r512380 * r512382;
        double r512384 = r512377 + r512383;
        double r512385 = b;
        double r512386 = r512384 - r512385;
        double r512387 = exp(r512386);
        double r512388 = r512373 * r512387;
        double r512389 = r512388 / r512374;
        return r512389;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r512390 = x;
        double r512391 = y;
        double r512392 = z;
        double r512393 = log(r512392);
        double r512394 = -r512393;
        double r512395 = b;
        double r512396 = t;
        double r512397 = a;
        double r512398 = log(r512397);
        double r512399 = r512396 * r512398;
        double r512400 = r512395 - r512399;
        double r512401 = fma(r512391, r512394, r512400);
        double r512402 = exp(r512401);
        double r512403 = r512390 / r512402;
        double r512404 = 1.0;
        double r512405 = 1.0;
        double r512406 = pow(r512397, r512405);
        double r512407 = r512404 / r512406;
        double r512408 = pow(r512407, r512405);
        double r512409 = r512403 * r512408;
        double r512410 = r512409 / r512391;
        return r512410;
}

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

Target

Original2.0
Target11.2
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;t \lt -0.88458485041274715:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t \lt 852031.22883740731:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array}\]

Derivation

  1. Initial program 2.0

    \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
  2. Taylor expanded around inf 2.0

    \[\leadsto \frac{x \cdot \color{blue}{e^{1 \cdot \log \left(\frac{1}{a}\right) - \left(y \cdot \log \left(\frac{1}{z}\right) + \left(\log \left(\frac{1}{a}\right) \cdot t + b\right)\right)}}}{y}\]
  3. Simplified1.3

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

    \[\leadsto \frac{\color{blue}{{\left(\frac{1}{{a}^{1}}\right)}^{1} \cdot \left(e^{-\left(y \cdot \log \left(\frac{1}{z}\right) + \left(\log \left(\frac{1}{a}\right) \cdot t + b\right)\right)} \cdot x\right)}}{y}\]
  5. Simplified1.3

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

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

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

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

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z))))))

  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1) (log a))) b))) y))