Average Error: 2.0 → 0.1
Time: 29.1s
Precision: 64
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
\[\begin{array}{l} \mathbf{if}\;a \le 4.101568142873870858526423599510479789387 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{\sqrt[3]{{\left(b - \mathsf{fma}\left(\log z, y, t \cdot \log a\right)\right)}^{3}}}} \cdot x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{b - \mathsf{fma}\left(t, \log a, \log z \cdot y\right)}}}{y} \cdot x\\ \end{array}\]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\begin{array}{l}
\mathbf{if}\;a \le 4.101568142873870858526423599510479789387 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{\sqrt[3]{{\left(b - \mathsf{fma}\left(\log z, y, t \cdot \log a\right)\right)}^{3}}}} \cdot x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{b - \mathsf{fma}\left(t, \log a, \log z \cdot y\right)}}}{y} \cdot x\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r297467 = x;
        double r297468 = y;
        double r297469 = z;
        double r297470 = log(r297469);
        double r297471 = r297468 * r297470;
        double r297472 = t;
        double r297473 = 1.0;
        double r297474 = r297472 - r297473;
        double r297475 = a;
        double r297476 = log(r297475);
        double r297477 = r297474 * r297476;
        double r297478 = r297471 + r297477;
        double r297479 = b;
        double r297480 = r297478 - r297479;
        double r297481 = exp(r297480);
        double r297482 = r297467 * r297481;
        double r297483 = r297482 / r297468;
        return r297483;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r297484 = a;
        double r297485 = 4.101568142873871e-06;
        bool r297486 = r297484 <= r297485;
        double r297487 = 1.0;
        double r297488 = -r297487;
        double r297489 = pow(r297484, r297488);
        double r297490 = b;
        double r297491 = z;
        double r297492 = log(r297491);
        double r297493 = y;
        double r297494 = t;
        double r297495 = log(r297484);
        double r297496 = r297494 * r297495;
        double r297497 = fma(r297492, r297493, r297496);
        double r297498 = r297490 - r297497;
        double r297499 = 3.0;
        double r297500 = pow(r297498, r297499);
        double r297501 = cbrt(r297500);
        double r297502 = exp(r297501);
        double r297503 = r297489 / r297502;
        double r297504 = x;
        double r297505 = r297503 * r297504;
        double r297506 = r297505 / r297493;
        double r297507 = r297492 * r297493;
        double r297508 = fma(r297494, r297495, r297507);
        double r297509 = r297490 - r297508;
        double r297510 = exp(r297509);
        double r297511 = r297489 / r297510;
        double r297512 = r297511 / r297493;
        double r297513 = r297512 * r297504;
        double r297514 = r297486 ? r297506 : r297513;
        return r297514;
}

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
Target10.8
Herbie0.1
\[\begin{array}{l} \mathbf{if}\;t \lt -0.8845848504127471478852839936735108494759:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t \lt 852031.228837407310493290424346923828125:\\ \;\;\;\;\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. Split input into 2 regimes
  2. if a < 4.101568142873871e-06

    1. Initial program 0.7

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

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(t, -\log a, b\right)\right)}}}}{y}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube0.1

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

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

    if 4.101568142873871e-06 < a

    1. Initial program 3.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 3.0

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(t, -\log a, b\right)\right)}}}}{y}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube2.2

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

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

      \[\leadsto \color{blue}{\left(x \cdot \frac{{a}^{\left(-1\right)}}{e^{\sqrt[3]{{\left(b - \mathsf{fma}\left(\log z, y, t \cdot \log a\right)\right)}^{3}}}}\right) \cdot \frac{1}{y}}\]
    9. Using strategy rm
    10. Applied associate-*l*0.1

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{{a}^{\left(-1\right)}}{e^{b - \mathsf{fma}\left(t, \log a, \log z \cdot y\right)}}}{y}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le 4.101568142873870858526423599510479789387 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{\sqrt[3]{{\left(b - \mathsf{fma}\left(\log z, y, t \cdot \log a\right)\right)}^{3}}}} \cdot x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{a}^{\left(-1\right)}}{e^{b - \mathsf{fma}\left(t, \log a, \log z \cdot y\right)}}}{y} \cdot x\\ \end{array}\]

Reproduce

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

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

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