Average Error: 2.0 → 0.5
Time: 9.0s
Precision: binary64
\[\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 \leq -822418.5775519771 \lor \neg \left(\left(t - 1\right) \cdot \log a \leq 163.81790623472583\right):\\ \;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + y \cdot \log z\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left({a}^{t} \cdot e^{y \cdot \log z - b}\right)}{a \cdot 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}\;\left(t - 1\right) \cdot \log a \leq -822418.5775519771 \lor \neg \left(\left(t - 1\right) \cdot \log a \leq 163.81790623472583\right):\\
\;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + y \cdot \log z\right) - b}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left({a}^{t} \cdot e^{y \cdot \log z - b}\right)}{a \cdot 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
 (if (or (<= (* (- t 1.0) (log a)) -822418.5775519771)
         (not (<= (* (- t 1.0) (log a)) 163.81790623472583)))
   (/ (* x (exp (- (+ (* (- t 1.0) (log a)) (* y (log z))) b))) y)
   (/ (* x (* (pow a t) (exp (- (* y (log z)) b)))) (* a 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 tmp;
	if ((((t - 1.0) * log(a)) <= -822418.5775519771) || !(((t - 1.0) * log(a)) <= 163.81790623472583)) {
		tmp = (x * exp((((t - 1.0) * log(a)) + (y * log(z))) - b)) / y;
	} else {
		tmp = (x * (pow(a, t) * exp((y * log(z)) - b))) / (a * 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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target11.2
Herbie0.5
\[\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 2 regimes
  2. if (*.f64 (-.f64 t 1) (log.f64 a)) < -822418.577551977127 or 163.817906234725825 < (*.f64 (-.f64 t 1) (log.f64 a))

    1. Initial program 0.4

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

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

    1. Initial program 4.9

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

      \[\leadsto \frac{x \cdot \color{blue}{e^{\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. Simplified9.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - 1\right) \cdot \log a \leq -822418.5775519771 \lor \neg \left(\left(t - 1\right) \cdot \log a \leq 163.81790623472583\right):\\ \;\;\;\;\frac{x \cdot e^{\left(\left(t - 1\right) \cdot \log a + y \cdot \log z\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left({a}^{t} \cdot e^{y \cdot \log z - b}\right)}{a \cdot y}\\ \end{array}\]

Reproduce

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