Average Error: 1.7 → 0.7
Time: 19.5s
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}\;\log a \le -211.7074222693128717764921020716428756714:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y \cdot {a}^{1}\right) \cdot e^{b - \mathsf{fma}\left(\log z, y, \log a \cdot t\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}\;\log a \le -211.7074222693128717764921020716428756714:\\
\;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r542202 = x;
        double r542203 = y;
        double r542204 = z;
        double r542205 = log(r542204);
        double r542206 = r542203 * r542205;
        double r542207 = t;
        double r542208 = 1.0;
        double r542209 = r542207 - r542208;
        double r542210 = a;
        double r542211 = log(r542210);
        double r542212 = r542209 * r542211;
        double r542213 = r542206 + r542212;
        double r542214 = b;
        double r542215 = r542213 - r542214;
        double r542216 = exp(r542215);
        double r542217 = r542202 * r542216;
        double r542218 = r542217 / r542203;
        return r542218;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r542219 = a;
        double r542220 = log(r542219);
        double r542221 = -211.70742226931287;
        bool r542222 = r542220 <= r542221;
        double r542223 = x;
        double r542224 = y;
        double r542225 = z;
        double r542226 = log(r542225);
        double r542227 = r542224 * r542226;
        double r542228 = t;
        double r542229 = 1.0;
        double r542230 = r542228 - r542229;
        double r542231 = r542230 * r542220;
        double r542232 = r542227 + r542231;
        double r542233 = b;
        double r542234 = r542232 - r542233;
        double r542235 = exp(r542234);
        double r542236 = r542223 * r542235;
        double r542237 = r542236 / r542224;
        double r542238 = pow(r542219, r542229);
        double r542239 = r542224 * r542238;
        double r542240 = r542220 * r542228;
        double r542241 = fma(r542226, r542224, r542240);
        double r542242 = r542233 - r542241;
        double r542243 = exp(r542242);
        double r542244 = r542239 * r542243;
        double r542245 = r542223 / r542244;
        double r542246 = r542222 ? r542237 : r542245;
        return r542246;
}

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

Original1.7
Target11.8
Herbie0.7
\[\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 (log a) < -211.70742226931287

    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 -211.70742226931287 < (log a)

    1. Initial program 2.2

      \[\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 add-cube-cbrt2.2

      \[\leadsto \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - \color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}}}{y}\]
    4. Applied add-cube-cbrt2.6

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

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

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

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

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

      \[\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}}\]
    10. Simplified0.8

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

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

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

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

Reproduce

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