Average Error: 2.2 → 2.0
Time: 28.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} t_1 := \left(t - 1\right) \cdot \log a\\ \mathbf{if}\;t_1 \leq -1453183373067794000 \lor \neg \left(t_1 \leq -293.00410533057493\right):\\ \;\;\;\;\frac{x \cdot e^{\left(t_1 + y \cdot \log z\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{e^{b}}}{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 -1453183373067794000 \lor \neg \left(t_1 \leq -293.00410533057493\right):\\
\;\;\;\;\frac{x \cdot e^{\left(t_1 + y \cdot \log z\right) - b}}{y}\\

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.2
Target10.9
Herbie2.0
\[\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)) < -1453183373067793900 or -293.00410533057493 < (*.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} \]

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

    1. Initial program 7.4

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

      \[\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_binary642.3

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

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

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

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

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

Reproduce

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