Average Error: 2.1 → 1.7
Time: 1.2min
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 := y \cdot \log z\\ t_2 := \frac{x \cdot e^{\left(t_1 + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\ \mathbf{if}\;y \leq -9.962165043974629 \cdot 10^{-213}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 0.02142220437323121:\\ \;\;\;\;\frac{x \cdot e^{t_1}}{a \cdot \left(y \cdot e^{b + t \cdot \log \left(\frac{1}{a}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \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 := y \cdot \log z\\
t_2 := \frac{x \cdot e^{\left(t_1 + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;y \leq -9.962165043974629 \cdot 10^{-213}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 0.02142220437323121:\\
\;\;\;\;\frac{x \cdot e^{t_1}}{a \cdot \left(y \cdot e^{b + t \cdot \log \left(\frac{1}{a}\right)}\right)}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\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 (* y (log z)))
        (t_2 (/ (* x (exp (- (+ t_1 (* (- t 1.0) (log a))) b))) y)))
   (if (<= y -9.962165043974629e-213)
     t_2
     (if (<= y 0.02142220437323121)
       (/ (* x (exp t_1)) (* a (* y (exp (+ b (* t (log (/ 1.0 a))))))))
       t_2))))
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 = y * log(z);
	double t_2 = (x * exp(((t_1 + ((t - 1.0) * log(a))) - b))) / y;
	double tmp;
	if (y <= -9.962165043974629e-213) {
		tmp = t_2;
	} else if (y <= 0.02142220437323121) {
		tmp = (x * exp(t_1)) / (a * (y * exp((b + (t * log((1.0 / a)))))));
	} else {
		tmp = t_2;
	}
	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.1
Target10.9
Herbie1.7
\[\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 y < -9.9621650439746286e-213 or 0.02142220437323121 < y

    1. Initial program 1.1

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

    if -9.9621650439746286e-213 < y < 0.02142220437323121

    1. Initial program 4.1

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{{z}^{y}}{\frac{e^{b}}{{a}^{\left(t + -1\right)}}}}{y}} \]
    6. Applied unpow-prod-up_binary6410.6

      \[\leadsto x \cdot \frac{\frac{{z}^{y}}{\frac{e^{b}}{\color{blue}{{a}^{t} \cdot {a}^{-1}}}}}{y} \]
    7. Applied associate-/r*_binary6410.6

      \[\leadsto x \cdot \frac{\frac{{z}^{y}}{\color{blue}{\frac{\frac{e^{b}}{{a}^{t}}}{{a}^{-1}}}}}{y} \]
    8. Applied pow-to-exp_binary6410.6

      \[\leadsto x \cdot \frac{\frac{{z}^{y}}{\frac{\frac{e^{b}}{\color{blue}{e^{\log a \cdot t}}}}{{a}^{-1}}}}{y} \]
    9. Applied div-exp_binary643.3

      \[\leadsto x \cdot \frac{\frac{{z}^{y}}{\frac{\color{blue}{e^{b - \log a \cdot t}}}{{a}^{-1}}}}{y} \]
    10. Taylor expanded in a around inf 3.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.962165043974629 \cdot 10^{-213}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\ \mathbf{elif}\;y \leq 0.02142220437323121:\\ \;\;\;\;\frac{x \cdot e^{y \cdot \log z}}{a \cdot \left(y \cdot e^{b + t \cdot \log \left(\frac{1}{a}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\ \end{array} \]

Reproduce

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