Average Error: 2.0 → 10.9
Time: 21.6s
Precision: binary64
Cost: 7308
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\begin{array}{l} t_1 := \frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{if}\;b \leq 6.5 \cdot 10^{-252}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{y \cdot \frac{a}{{z}^{y}}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\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
 (let* ((t_1 (* (/ (/ (pow a t) a) y) x)))
   (if (<= b 6.5e-252)
     t_1
     (if (<= b 2.7e-158)
       (/ x (* y (/ a (pow z y))))
       (if (<= b 2.4e-8) t_1 (/ x (* y (* a (exp b)))))))))
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 = ((pow(a, t) / a) / y) * x;
	double tmp;
	if (b <= 6.5e-252) {
		tmp = t_1;
	} else if (b <= 2.7e-158) {
		tmp = x / (y * (a / pow(z, y)));
	} else if (b <= 2.4e-8) {
		tmp = t_1;
	} else {
		tmp = x / (y * (a * exp(b)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (((a ** t) / a) / y) * x
    if (b <= 6.5d-252) then
        tmp = t_1
    else if (b <= 2.7d-158) then
        tmp = x / (y * (a / (z ** y)))
    else if (b <= 2.4d-8) then
        tmp = t_1
    else
        tmp = x / (y * (a * exp(b)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((Math.pow(a, t) / a) / y) * x;
	double tmp;
	if (b <= 6.5e-252) {
		tmp = t_1;
	} else if (b <= 2.7e-158) {
		tmp = x / (y * (a / Math.pow(z, y)));
	} else if (b <= 2.4e-8) {
		tmp = t_1;
	} else {
		tmp = x / (y * (a * Math.exp(b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
def code(x, y, z, t, a, b):
	t_1 = ((math.pow(a, t) / a) / y) * x
	tmp = 0
	if b <= 6.5e-252:
		tmp = t_1
	elif b <= 2.7e-158:
		tmp = x / (y * (a / math.pow(z, y)))
	elif b <= 2.4e-8:
		tmp = t_1
	else:
		tmp = x / (y * (a * math.exp(b)))
	return tmp
function code(x, y, z, t, a, b)
	return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y)
end
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64((a ^ t) / a) / y) * x)
	tmp = 0.0
	if (b <= 6.5e-252)
		tmp = t_1;
	elseif (b <= 2.7e-158)
		tmp = Float64(x / Float64(y * Float64(a / (z ^ y))));
	elseif (b <= 2.4e-8)
		tmp = t_1;
	else
		tmp = Float64(x / Float64(y * Float64(a * exp(b))));
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b)
	tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (((a ^ t) / a) / y) * x;
	tmp = 0.0;
	if (b <= 6.5e-252)
		tmp = t_1;
	elseif (b <= 2.7e-158)
		tmp = x / (y * (a / (z ^ y)));
	elseif (b <= 2.4e-8)
		tmp = t_1;
	else
		tmp = x / (y * (a * exp(b)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[Power[a, t], $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, 6.5e-252], t$95$1, If[LessEqual[b, 2.7e-158], N[(x / N[(y * N[(a / N[Power[z, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-8], t$95$1, N[(x / N[(y * N[(a * N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\begin{array}{l}
t_1 := \frac{\frac{{a}^{t}}{a}}{y} \cdot x\\
\mathbf{if}\;b \leq 6.5 \cdot 10^{-252}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 2.7 \cdot 10^{-158}:\\
\;\;\;\;\frac{x}{y \cdot \frac{a}{{z}^{y}}}\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target11.1
Herbie10.9
\[\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 b < 6.4999999999999998e-252 or 2.6999999999999998e-158 < b < 2.39999999999999998e-8

    1. Initial program 3.2

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

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

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

      \[\leadsto \frac{\color{blue}{{a}^{\left(t - 1\right)} \cdot x}}{y} \]
    5. Simplified17.3

      \[\leadsto \frac{\color{blue}{{a}^{\left(t + -1\right)} \cdot x}}{y} \]
    6. Applied egg-rr16.4

      \[\leadsto \color{blue}{\frac{\frac{{a}^{t}}{a}}{y} \cdot x} \]

    if 6.4999999999999998e-252 < b < 2.6999999999999998e-158

    1. Initial program 3.6

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

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

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot x}{y \cdot \left(a \cdot e^{b}\right)}} \]
    4. Taylor expanded in b around 0 21.7

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot x}{y \cdot a}} \]
    5. Taylor expanded in z around inf 21.7

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \frac{a}{{z}^{y}}}} \]

    if 2.39999999999999998e-8 < b

    1. Initial program 0.1

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

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

      \[\leadsto \color{blue}{\frac{{z}^{y} \cdot x}{y \cdot \left(a \cdot e^{b}\right)}} \]
    4. Taylor expanded in y around 0 0.7

      \[\leadsto \frac{\color{blue}{x}}{y \cdot \left(a \cdot e^{b}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{-252}:\\ \;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{y \cdot \frac{a}{{z}^{y}}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{{a}^{t}}{a}}{y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error13.4
Cost7044
\[\begin{array}{l} \mathbf{if}\;b \leq 1.08 \cdot 10^{-19}:\\ \;\;\;\;\frac{x}{y \cdot \frac{a}{{z}^{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 2
Error17.2
Cost6980
\[\begin{array}{l} \mathbf{if}\;b \leq 1.08 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(\left(1 + \frac{1}{a \cdot y}\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot e^{b}\right)}\\ \end{array} \]
Alternative 3
Error35.4
Cost844
\[\begin{array}{l} \mathbf{if}\;b \leq 10^{-305}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{elif}\;b \leq 9.435307359856984 \cdot 10^{+179}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(b \cdot y\right)}\\ \end{array} \]
Alternative 4
Error28.7
Cost844
\[\begin{array}{l} \mathbf{if}\;b \leq 8 \cdot 10^{-50}:\\ \;\;\;\;x \cdot \left(\left(1 + \frac{1}{a \cdot y}\right) + -1\right)\\ \mathbf{elif}\;b \leq 2.2521494428558348 \cdot 10^{+129}:\\ \;\;\;\;\left(1 + \frac{x}{a \cdot y}\right) + -1\\ \mathbf{elif}\;b \leq 4.368108781595108 \cdot 10^{+180}:\\ \;\;\;\;\frac{\frac{\frac{x}{b}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(b \cdot y\right)}\\ \end{array} \]
Alternative 5
Error36.6
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq 10^{-305}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{b \cdot a}\\ \end{array} \]
Alternative 6
Error35.5
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq 10^{-305}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(b \cdot y\right)}\\ \end{array} \]
Alternative 7
Error29.5
Cost708
\[\begin{array}{l} \mathbf{if}\;b \leq 1.724102524421848 \cdot 10^{+124}:\\ \;\;\;\;\left(1 + \frac{x}{a \cdot y}\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(b \cdot y\right)}\\ \end{array} \]
Alternative 8
Error39.7
Cost584
\[\begin{array}{l} t_1 := \frac{x}{a \cdot y}\\ \mathbf{if}\;y \leq -1 \cdot 10^{-18}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 10^{-82}:\\ \;\;\;\;\frac{\frac{x}{a}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error37.9
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 10^{-12}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot y}\\ \end{array} \]
Alternative 10
Error41.3
Cost320
\[\frac{x}{a \cdot y} \]

Error

Reproduce

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