Average Error: 2.0 → 0.1
Time: 18.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}\;a \le 3.2005961165294398 \cdot 10^{-5}:\\ \;\;\;\;\frac{x \cdot \frac{{\left(\frac{1}{a}\right)}^{1}}{e^{\mathsf{fma}\left(y, \log \left(\frac{1}{z}\right), \mathsf{fma}\left(\log \left(\frac{1}{a}\right), t, b\right)\right)}}}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{{\left(\frac{1}{a}\right)}^{1}}{e^{\mathsf{fma}\left(y, \log \left(\frac{1}{z}\right), \mathsf{fma}\left(\log \left(\frac{1}{a}\right), t, b\right)\right)}}}{y}\\ \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 3.2005961165294398 \cdot 10^{-5}:\\
\;\;\;\;\frac{x \cdot \frac{{\left(\frac{1}{a}\right)}^{1}}{e^{\mathsf{fma}\left(y, \log \left(\frac{1}{z}\right), \mathsf{fma}\left(\log \left(\frac{1}{a}\right), t, b\right)\right)}}}{y}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r377998 = x;
        double r377999 = y;
        double r378000 = z;
        double r378001 = log(r378000);
        double r378002 = r377999 * r378001;
        double r378003 = t;
        double r378004 = 1.0;
        double r378005 = r378003 - r378004;
        double r378006 = a;
        double r378007 = log(r378006);
        double r378008 = r378005 * r378007;
        double r378009 = r378002 + r378008;
        double r378010 = b;
        double r378011 = r378009 - r378010;
        double r378012 = exp(r378011);
        double r378013 = r377998 * r378012;
        double r378014 = r378013 / r377999;
        return r378014;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r378015 = a;
        double r378016 = 3.20059611652944e-05;
        bool r378017 = r378015 <= r378016;
        double r378018 = x;
        double r378019 = 1.0;
        double r378020 = r378019 / r378015;
        double r378021 = 1.0;
        double r378022 = pow(r378020, r378021);
        double r378023 = y;
        double r378024 = z;
        double r378025 = r378019 / r378024;
        double r378026 = log(r378025);
        double r378027 = log(r378020);
        double r378028 = t;
        double r378029 = b;
        double r378030 = fma(r378027, r378028, r378029);
        double r378031 = fma(r378023, r378026, r378030);
        double r378032 = exp(r378031);
        double r378033 = r378022 / r378032;
        double r378034 = r378018 * r378033;
        double r378035 = r378034 / r378023;
        double r378036 = r378033 / r378023;
        double r378037 = r378018 * r378036;
        double r378038 = r378017 ? r378035 : r378037;
        return r378038;
}

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.3
Herbie0.1
\[\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 a < 3.20059611652944e-05

    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(y \cdot \log \left(\frac{1}{z}\right) + \left(\log \left(\frac{1}{a}\right) \cdot t + b\right)\right)}}}{y}\]
    3. Simplified0.1

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

    if 3.20059611652944e-05 < a

    1. Initial program 3.1

      \[\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.1

      \[\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. Simplified2.3

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

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

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

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

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

Reproduce

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