Average Error: 1.7 → 0.4
Time: 19.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 := e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}\\ t_2 := \frac{x \cdot t_1}{y}\\ \mathbf{if}\;t_2 \leq -8.813710034410774 \cdot 10^{-97}:\\ \;\;\;\;\frac{x \cdot \left(\frac{{z}^{y}}{a \cdot e^{b}} \cdot {a}^{t}\right)}{y}\\ \mathbf{elif}\;t_2 \leq 3.8472901968920143 \cdot 10^{-149}:\\ \;\;\;\;\frac{x}{\frac{y}{t_1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{z}^{y}}{e^{b}}}{\frac{y}{\frac{x}{a}}}\\ \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 := e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}\\
t_2 := \frac{x \cdot t_1}{y}\\
\mathbf{if}\;t_2 \leq -8.813710034410774 \cdot 10^{-97}:\\
\;\;\;\;\frac{x \cdot \left(\frac{{z}^{y}}{a \cdot e^{b}} \cdot {a}^{t}\right)}{y}\\

\mathbf{elif}\;t_2 \leq 3.8472901968920143 \cdot 10^{-149}:\\
\;\;\;\;\frac{x}{\frac{y}{t_1}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{{z}^{y}}{e^{b}}}{\frac{y}{\frac{x}{a}}}\\


\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 (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b)))
        (t_2 (/ (* x t_1) y)))
   (if (<= t_2 -8.813710034410774e-97)
     (/ (* x (* (/ (pow z y) (* a (exp b))) (pow a t))) y)
     (if (<= t_2 3.8472901968920143e-149)
       (/ x (/ y t_1))
       (/ (/ (pow z y) (exp b)) (/ y (/ x a)))))))
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 = exp(((y * log(z)) + ((t - 1.0) * log(a))) - b);
	double t_2 = (x * t_1) / y;
	double tmp;
	if (t_2 <= -8.813710034410774e-97) {
		tmp = (x * ((pow(z, y) / (a * exp(b))) * pow(a, t))) / y;
	} else if (t_2 <= 3.8472901968920143e-149) {
		tmp = x / (y / t_1);
	} else {
		tmp = (pow(z, y) / exp(b)) / (y / (x / a));
	}
	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

Original1.7
Target11.3
Herbie0.4
\[\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 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < -8.8137100344107737e-97

    1. Initial program 6.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_binary646.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. Simplified6.0

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

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

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

    if -8.8137100344107737e-97 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y) < 3.8472901968920143e-149

    1. Initial program 1.2

      \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
    2. Applied associate-/l*_binary640.2

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

    if 3.8472901968920143e-149 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t 1) (log.f64 a))) b))) y)

    1. Initial program 5.7

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

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

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

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

      \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{{z}^{y}}{a \cdot e^{b}} \cdot {a}^{t}\right)}}{y} \]
    6. Taylor expanded in a around inf 9.9

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

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

      \[\leadsto \color{blue}{\frac{e^{\log z \cdot y - b} \cdot x}{a \cdot y}} \]
    9. Simplified2.4

      \[\leadsto \color{blue}{\frac{\frac{{z}^{y}}{e^{b}}}{\frac{y}{\frac{x}{a}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

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

Reproduce

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