Average Error: 1.9 → 0.4
Time: 13.6s
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 -5.2777310543672989 \cdot 10^{-33} \lor \neg \left(x \le 4.9366026309761553 \cdot 10^{-158}\right):\\ \;\;\;\;x \cdot \left(\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)}} \cdot \frac{1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\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)}}}{\frac{y}{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}\;x \le -5.2777310543672989 \cdot 10^{-33} \lor \neg \left(x \le 4.9366026309761553 \cdot 10^{-158}\right):\\
\;\;\;\;x \cdot \left(\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)}} \cdot \frac{1}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\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)}}}{\frac{y}{x}}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r443973 = x;
        double r443974 = y;
        double r443975 = z;
        double r443976 = log(r443975);
        double r443977 = r443974 * r443976;
        double r443978 = t;
        double r443979 = 1.0;
        double r443980 = r443978 - r443979;
        double r443981 = a;
        double r443982 = log(r443981);
        double r443983 = r443980 * r443982;
        double r443984 = r443977 + r443983;
        double r443985 = b;
        double r443986 = r443984 - r443985;
        double r443987 = exp(r443986);
        double r443988 = r443973 * r443987;
        double r443989 = r443988 / r443974;
        return r443989;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r443990 = x;
        double r443991 = -5.277731054367299e-33;
        bool r443992 = r443990 <= r443991;
        double r443993 = 4.936602630976155e-158;
        bool r443994 = r443990 <= r443993;
        double r443995 = !r443994;
        bool r443996 = r443992 || r443995;
        double r443997 = 1.0;
        double r443998 = a;
        double r443999 = r443997 / r443998;
        double r444000 = 1.0;
        double r444001 = pow(r443999, r444000);
        double r444002 = y;
        double r444003 = z;
        double r444004 = r443997 / r444003;
        double r444005 = log(r444004);
        double r444006 = log(r443999);
        double r444007 = t;
        double r444008 = b;
        double r444009 = fma(r444006, r444007, r444008);
        double r444010 = fma(r444002, r444005, r444009);
        double r444011 = exp(r444010);
        double r444012 = r444001 / r444011;
        double r444013 = r443997 / r444002;
        double r444014 = r444012 * r444013;
        double r444015 = r443990 * r444014;
        double r444016 = r444002 / r443990;
        double r444017 = r444012 / r444016;
        double r444018 = r443996 ? r444015 : r444017;
        return r444018;
}

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.9
Target11.7
Herbie0.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 x < -5.277731054367299e-33 or 4.936602630976155e-158 < x

    1. Initial program 1.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 1.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. Simplified0.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 div-inv0.4

      \[\leadsto \color{blue}{\left(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)}}\right) \cdot \frac{1}{y}}\]
    6. Using strategy rm
    7. Applied associate-*l*0.5

      \[\leadsto \color{blue}{x \cdot \left(\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)}} \cdot \frac{1}{y}\right)}\]

    if -5.277731054367299e-33 < x < 4.936602630976155e-158

    1. Initial program 3.2

      \[\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.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}}\]
    3. Simplified0.1

      \[\leadsto \color{blue}{\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)}}}{\frac{y}{x}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.2777310543672989 \cdot 10^{-33} \lor \neg \left(x \le 4.9366026309761553 \cdot 10^{-158}\right):\\ \;\;\;\;x \cdot \left(\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)}} \cdot \frac{1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\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)}}}{\frac{y}{x}}\\ \end{array}\]

Reproduce

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