Average Error: 2.0 → 0.8
Time: 35.8s
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}\;x \le -808322652601083008563229753769570055749600 \lor \neg \left(x \le 3.736249666656283139374015083616032025791 \cdot 10^{85}\right):\\ \;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + \log z \cdot y\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{1}{{a}^{1}}\right)}^{1} \cdot \left(e^{\mathsf{fma}\left(\log z, y, \log a \cdot t\right) - b} \cdot \frac{x}{y}\right)\\ \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}\;x \le -808322652601083008563229753769570055749600 \lor \neg \left(x \le 3.736249666656283139374015083616032025791 \cdot 10^{85}\right):\\
\;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + \log z \cdot y\right) - b}}{y}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r311023 = x;
        double r311024 = y;
        double r311025 = z;
        double r311026 = log(r311025);
        double r311027 = r311024 * r311026;
        double r311028 = t;
        double r311029 = 1.0;
        double r311030 = r311028 - r311029;
        double r311031 = a;
        double r311032 = log(r311031);
        double r311033 = r311030 * r311032;
        double r311034 = r311027 + r311033;
        double r311035 = b;
        double r311036 = r311034 - r311035;
        double r311037 = exp(r311036);
        double r311038 = r311023 * r311037;
        double r311039 = r311038 / r311024;
        return r311039;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r311040 = x;
        double r311041 = -8.08322652601083e+41;
        bool r311042 = r311040 <= r311041;
        double r311043 = 3.736249666656283e+85;
        bool r311044 = r311040 <= r311043;
        double r311045 = !r311044;
        bool r311046 = r311042 || r311045;
        double r311047 = t;
        double r311048 = 1.0;
        double r311049 = r311047 - r311048;
        double r311050 = a;
        double r311051 = log(r311050);
        double r311052 = r311049 * r311051;
        double r311053 = z;
        double r311054 = log(r311053);
        double r311055 = y;
        double r311056 = r311054 * r311055;
        double r311057 = r311052 + r311056;
        double r311058 = b;
        double r311059 = r311057 - r311058;
        double r311060 = exp(r311059);
        double r311061 = r311040 * r311060;
        double r311062 = r311061 / r311055;
        double r311063 = 1.0;
        double r311064 = pow(r311050, r311048);
        double r311065 = r311063 / r311064;
        double r311066 = pow(r311065, r311048);
        double r311067 = r311051 * r311047;
        double r311068 = fma(r311054, r311055, r311067);
        double r311069 = r311068 - r311058;
        double r311070 = exp(r311069);
        double r311071 = r311040 / r311055;
        double r311072 = r311070 * r311071;
        double r311073 = r311066 * r311072;
        double r311074 = r311046 ? r311062 : r311073;
        return r311074;
}

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.5
Herbie0.8
\[\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 x < -8.08322652601083e+41 or 3.736249666656283e+85 < x

    1. Initial program 0.7

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

    if -8.08322652601083e+41 < x < 3.736249666656283e+85

    1. Initial program 2.8

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
    2. Using strategy rm
    3. Applied associate-/l*2.7

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

      \[\leadsto \frac{x}{\color{blue}{\frac{y}{\frac{{a}^{\left(t - 1\right)} \cdot {z}^{y}}{e^{b}}}}}\]
    5. Using strategy rm
    6. Applied pow-sub18.4

      \[\leadsto \frac{x}{\frac{y}{\frac{\color{blue}{\frac{{a}^{t}}{{a}^{1}}} \cdot {z}^{y}}{e^{b}}}}\]
    7. Taylor expanded around inf 16.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -808322652601083008563229753769570055749600 \lor \neg \left(x \le 3.736249666656283139374015083616032025791 \cdot 10^{85}\right):\\ \;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + \log z \cdot y\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{1}{{a}^{1}}\right)}^{1} \cdot \left(e^{\mathsf{fma}\left(\log z, y, \log a \cdot t\right) - b} \cdot \frac{x}{y}\right)\\ \end{array}\]

Reproduce

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