Average Error: 2.0 → 0.5
Time: 10.2s
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}\;x \leq -5.06359644977106 \cdot 10^{-218} \lor \neg \left(x \leq 3.731887299802218 \cdot 10^{-81}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b - \left(t \cdot \log a + y \cdot \log z\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{a \cdot e^{b - \left(t \cdot \log a + y \cdot \log z\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}\;x \leq -5.06359644977106 \cdot 10^{-218} \lor \neg \left(x \leq 3.731887299802218 \cdot 10^{-81}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b - \left(t \cdot \log a + y \cdot \log z\right)}\right)}\\

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

\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 (<= x -5.06359644977106e-218) (not (<= x 3.731887299802218e-81)))
   (/ x (* y (* a (exp (- b (+ (* t (log a)) (* y (log z))))))))
   (/ (/ x y) (* a (exp (- b (+ (* t (log a)) (* y (log z)))))))))
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 ((x <= -5.06359644977106e-218) || !(x <= 3.731887299802218e-81)) {
		tmp = x / (y * (a * exp(b - ((t * log(a)) + (y * log(z))))));
	} else {
		tmp = (x / y) / (a * exp(b - ((t * log(a)) + (y * log(z)))));
	}
	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.4
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 x < -5.06358e-218 or 3.73191e-81 < x

    1. Initial program 1.4

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

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{a \cdot e^{y \cdot \left(-\log z\right) + \left(b + t \cdot \left(-\log a\right)\right)}}}}{y}\]
    4. Using strategy rm
    5. Applied un-div-inv_binary64_37860.7

      \[\leadsto \frac{\color{blue}{\frac{x}{a \cdot e^{y \cdot \left(-\log z\right) + \left(b + t \cdot \left(-\log a\right)\right)}}}}{y}\]
    6. Applied associate-/l/_binary64_38500.6

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

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

    if -5.06358e-218 < x < 3.73191e-81

    1. Initial program 3.5

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

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{a \cdot e^{y \cdot \left(-\log z\right) + \left(b + t \cdot \left(-\log a\right)\right)}}}}{y}\]
    4. Using strategy rm
    5. Applied un-div-inv_binary64_37862.7

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

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

      \[\leadsto \frac{x}{\color{blue}{y \cdot \left(a \cdot e^{b - \left(t \cdot \log a + y \cdot \log z\right)}\right)}}\]
    8. Using strategy rm
    9. Applied associate-/r*_binary64_38470.1

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

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

Reproduce

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