Average Error: 2.1 → 1.4
Time: 18.7s
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}\;\left(t - 1\right) \cdot \log a \le -7.27577864358483626 \cdot 10^{49} \lor \neg \left(\left(t - 1\right) \cdot \log a \le -24.655976153418436\right):\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{a \cdot y}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(-\log a, t, b\right)\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}\;\left(t - 1\right) \cdot \log a \le -7.27577864358483626 \cdot 10^{49} \lor \neg \left(\left(t - 1\right) \cdot \log a \le -24.655976153418436\right):\\
\;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r425224 = x;
        double r425225 = y;
        double r425226 = z;
        double r425227 = log(r425226);
        double r425228 = r425225 * r425227;
        double r425229 = t;
        double r425230 = 1.0;
        double r425231 = r425229 - r425230;
        double r425232 = a;
        double r425233 = log(r425232);
        double r425234 = r425231 * r425233;
        double r425235 = r425228 + r425234;
        double r425236 = b;
        double r425237 = r425235 - r425236;
        double r425238 = exp(r425237);
        double r425239 = r425224 * r425238;
        double r425240 = r425239 / r425225;
        return r425240;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r425241 = t;
        double r425242 = 1.0;
        double r425243 = r425241 - r425242;
        double r425244 = a;
        double r425245 = log(r425244);
        double r425246 = r425243 * r425245;
        double r425247 = -7.275778643584836e+49;
        bool r425248 = r425246 <= r425247;
        double r425249 = -24.655976153418436;
        bool r425250 = r425246 <= r425249;
        double r425251 = !r425250;
        bool r425252 = r425248 || r425251;
        double r425253 = x;
        double r425254 = y;
        double r425255 = z;
        double r425256 = log(r425255);
        double r425257 = r425254 * r425256;
        double r425258 = r425257 + r425246;
        double r425259 = b;
        double r425260 = r425258 - r425259;
        double r425261 = exp(r425260);
        double r425262 = r425253 * r425261;
        double r425263 = r425262 / r425254;
        double r425264 = r425244 * r425254;
        double r425265 = r425253 / r425264;
        double r425266 = -r425256;
        double r425267 = -r425245;
        double r425268 = fma(r425267, r425241, r425259);
        double r425269 = fma(r425254, r425266, r425268);
        double r425270 = exp(r425269);
        double r425271 = r425265 / r425270;
        double r425272 = r425252 ? r425263 : r425271;
        return r425272;
}

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.1
Target11.3
Herbie1.4
\[\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. Split input into 2 regimes
  2. if (* (- t 1.0) (log a)) < -7.275778643584836e+49 or -24.655976153418436 < (* (- t 1.0) (log a))

    1. Initial program 0.6

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

    if -7.275778643584836e+49 < (* (- t 1.0) (log a)) < -24.655976153418436

    1. Initial program 5.3

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

      \[\leadsto \color{blue}{\frac{x \cdot 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. Simplified6.9

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

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

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

Reproduce

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