Average Error: 1.9 → 0.9
Time: 21.9s
Precision: binary64
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\begin{array}{l} t_1 := \left(t - 1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -283096.8059359662:\\ \;\;\;\;\frac{\mathsf{fma}\left(\log z, y, 1\right) \cdot \left({a}^{\left(t - 1\right)} \cdot x\right)}{y}\\ \mathbf{elif}\;t_1 \leq -71.88509251222985:\\ \;\;\;\;\frac{x}{a \cdot y} \cdot e^{\log z \cdot y - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\mathsf{fma}\left(\log z, y, \mathsf{fma}\left(\log a, t - 1, -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}
t_1 := \left(t - 1\right) \cdot \log a\\
\mathbf{if}\;t_1 \leq -283096.8059359662:\\
\;\;\;\;\frac{\mathsf{fma}\left(\log z, y, 1\right) \cdot \left({a}^{\left(t - 1\right)} \cdot x\right)}{y}\\

\mathbf{elif}\;t_1 \leq -71.88509251222985:\\
\;\;\;\;\frac{x}{a \cdot y} \cdot e^{\log z \cdot y - b}\\

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


\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- t 1.0) (log a))))
   (if (<= t_1 -283096.8059359662)
     (/ (* (fma (log z) y 1.0) (* (pow a (- t 1.0)) x)) y)
     (if (<= t_1 -71.88509251222985)
       (* (/ x (* a y)) (exp (- (* (log z) y) b)))
       (/ (* x (exp (fma (log z) y (fma (log a) (- t 1.0) (- b))))) y)))))
double code(double x, double y, double z, double t, double a, double b) {
	return (x * exp(((y * log(z)) + ((t - 1.0) * log(a))) - b)) / y;
}
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (t - 1.0) * log(a);
	double tmp;
	if (t_1 <= -283096.8059359662) {
		tmp = (fma(log(z), y, 1.0) * (pow(a, (t - 1.0)) * x)) / y;
	} else if (t_1 <= -71.88509251222985) {
		tmp = (x / (a * y)) * exp((log(z) * y) - b);
	} else {
		tmp = (x * exp(fma(log(z), y, fma(log(a), (t - 1.0), -b)))) / y;
	}
	return tmp;
}

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.2
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;t < -0.8845848504127471:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t < 852031.2288374073:\\ \;\;\;\;\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 3 regimes
  2. if (*.f64 (-.f64 t 1) (log.f64 a)) < -283096.8059359662

    1. Initial program 0

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{y}{\left(\frac{{a}^{\left(t + -1\right)}}{e^{b}} \cdot {z}^{y}\right) \cdot x}}} \]
    4. Taylor expanded in b around 0 10.1

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

      \[\leadsto \color{blue}{\frac{{a}^{\left(t - 1\right)} \cdot \left(x \cdot {z}^{y}\right)}{y}} \]
    6. Taylor expanded in y around 0 0

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

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

    if -283096.8059359662 < (*.f64 (-.f64 t 1) (log.f64 a)) < -71.885092512229846

    1. Initial program 6.1

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{y}{\left(\frac{{a}^{\left(t + -1\right)}}{e^{b}} \cdot {z}^{y}\right) \cdot x}}} \]
    4. Taylor expanded in t around 0 12.9

      \[\leadsto \frac{1}{\frac{y}{\color{blue}{\frac{e^{\log z \cdot y} \cdot x}{e^{b} \cdot a}}}} \]
    5. Simplified12.9

      \[\leadsto \frac{1}{\frac{y}{\color{blue}{\frac{x \cdot {z}^{y}}{e^{b} \cdot a}}}} \]
    6. Taylor expanded in z around inf 8.4

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

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

    if -71.885092512229846 < (*.f64 (-.f64 t 1) (log.f64 a))

    1. Initial program 1.0

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
    2. Applied add-exp-log_binary641.0

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

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

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

Reproduce

herbie shell --seed 2022077 
(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.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))