?

Average Error: 2.86% → 4.58%
Time: 29.4s
Precision: binary64
Cost: 20425

?

\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-259} \lor \neg \left(y \leq 9 \cdot 10^{-132}\right):\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{{a}^{\left(1 - t\right)} \cdot \left(y \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
 (if (or (<= y -1e-259) (not (<= y 9e-132)))
   (/ (* x (exp (- (+ (* y (log z)) (* (+ t -1.0) (log a))) b))) y)
   (/ x (* (pow a (- 1.0 t)) (* y (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 tmp;
	if ((y <= -1e-259) || !(y <= 9e-132)) {
		tmp = (x * exp((((y * log(z)) + ((t + -1.0) * log(a))) - b))) / y;
	} else {
		tmp = x / (pow(a, (1.0 - t)) * (y * 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) :: tmp
    if ((y <= (-1d-259)) .or. (.not. (y <= 9d-132))) then
        tmp = (x * exp((((y * log(z)) + ((t + (-1.0d0)) * log(a))) - b))) / y
    else
        tmp = x / ((a ** (1.0d0 - t)) * (y * 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 tmp;
	if ((y <= -1e-259) || !(y <= 9e-132)) {
		tmp = (x * Math.exp((((y * Math.log(z)) + ((t + -1.0) * Math.log(a))) - b))) / y;
	} else {
		tmp = x / (Math.pow(a, (1.0 - t)) * (y * 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):
	tmp = 0
	if (y <= -1e-259) or not (y <= 9e-132):
		tmp = (x * math.exp((((y * math.log(z)) + ((t + -1.0) * math.log(a))) - b))) / y
	else:
		tmp = x / (math.pow(a, (1.0 - t)) * (y * 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)
	tmp = 0.0
	if ((y <= -1e-259) || !(y <= 9e-132))
		tmp = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t + -1.0) * log(a))) - b))) / y);
	else
		tmp = Float64(x / Float64((a ^ Float64(1.0 - t)) * Float64(y * 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)
	tmp = 0.0;
	if ((y <= -1e-259) || ~((y <= 9e-132)))
		tmp = (x * exp((((y * log(z)) + ((t + -1.0) * log(a))) - b))) / y;
	else
		tmp = x / ((a ^ (1.0 - t)) * (y * 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_] := If[Or[LessEqual[y, -1e-259], N[Not[LessEqual[y, 9e-132]], $MachinePrecision]], 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], N[(x / N[(N[Power[a, N[(1.0 - t), $MachinePrecision]], $MachinePrecision] * N[(y * 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}
\mathbf{if}\;y \leq -1 \cdot 10^{-259} \lor \neg \left(y \leq 9 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z + \left(t + -1\right) \cdot \log a\right) - b}}{y}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.86%
Target17.07%
Herbie4.58%
\[\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 < -1.0000000000000001e-259 or 8.9999999999999999e-132 < y

    1. Initial program 1.96

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

    if -1.0000000000000001e-259 < y < 8.9999999999999999e-132

    1. Initial program 6.98

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

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

      [Start]6.98

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

      associate-*r/ [<=]6.72

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

      exp-diff [=>]18.68

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

      associate-/l/ [=>]18.68

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(e^{b} \cdot {a}^{\left(1 - t\right)}\right)}} \]
    4. Simplified16.49

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

      [Start]16.48

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

      associate-*r* [=>]16.49

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

      *-commutative [<=]16.49

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

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

Alternatives

Alternative 1
Error3.86%
Cost26692
\[\begin{array}{l} \mathbf{if}\;\left(t + -1\right) \cdot \log a \leq -647:\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{\left(y \cdot \log z - \log a\right) - b}}{y}\\ \end{array} \]
Alternative 2
Error14.39%
Cost14032
\[\begin{array}{l} t_1 := \frac{x \cdot e^{\left(t + -1\right) \cdot \log a - b}}{y}\\ t_2 := \frac{{z}^{y}}{a} \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq -4.9 \cdot 10^{+126}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.5 \cdot 10^{-260}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-130}:\\ \;\;\;\;\frac{x}{{a}^{\left(1 - t\right)} \cdot \left(y \cdot e^{b}\right)}\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error15.44%
Cost13836
\[\begin{array}{l} t_1 := y \cdot e^{b}\\ \mathbf{if}\;b \leq -380:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq -7.5 \cdot 10^{-169}:\\ \;\;\;\;\frac{x}{{a}^{\left(1 - t\right)} \cdot t_1}\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-290}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{{z}^{y}}{a \cdot e^{b}}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot t_1}\\ \end{array} \]
Alternative 4
Error17.62%
Cost7440
\[\begin{array}{l} t_1 := \frac{x \cdot {a}^{t}}{y \cdot a}\\ \mathbf{if}\;b \leq -17500000000000:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq -1.02 \cdot 10^{-167}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 4.5 \cdot 10^{-164}:\\ \;\;\;\;\frac{{z}^{y}}{a} \cdot \frac{x}{y}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 5
Error19.19%
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -2.9:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{-86}:\\ \;\;\;\;\frac{{z}^{y}}{a} \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 6
Error14.41%
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -17500000000000:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{\frac{x \cdot {a}^{t}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 7
Error29.43%
Cost7112
\[\begin{array}{l} \mathbf{if}\;b \leq -145:\\ \;\;\;\;\frac{x}{y} \cdot \left(a \cdot e^{b}\right)\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-161}:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 8
Error28.81%
Cost7112
\[\begin{array}{l} \mathbf{if}\;b \leq -2.9:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq 3.05 \cdot 10^{-153}:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 9
Error29.08%
Cost7112
\[\begin{array}{l} \mathbf{if}\;b \leq -2.9:\\ \;\;\;\;\frac{a \cdot \left(x \cdot e^{b}\right)}{y}\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-153}:\\ \;\;\;\;\frac{\frac{\frac{x}{y}}{e^{b}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot e^{b}\right)}\\ \end{array} \]
Alternative 10
Error29.73%
Cost7048
\[\begin{array}{l} \mathbf{if}\;b \leq -240:\\ \;\;\;\;\frac{x}{y} \cdot \left(a \cdot e^{b}\right)\\ \mathbf{elif}\;b \leq 250:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{-b}}{y}\\ \end{array} \]
Alternative 11
Error34.77%
Cost6916
\[\begin{array}{l} \mathbf{if}\;b \leq 190:\\ \;\;\;\;\frac{\frac{\frac{x}{1 + b}}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot e^{-b}}{y}\\ \end{array} \]
Alternative 12
Error47.75%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -2.35 \cdot 10^{-107} \lor \neg \left(x \leq 6 \cdot 10^{-37}\right):\\ \;\;\;\;\frac{x}{a \cdot \left(y + y \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{1 + b}}{y}}{a}\\ \end{array} \]
Alternative 13
Error64.45%
Cost717
\[\begin{array}{l} \mathbf{if}\;a \leq 1.06 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+107} \lor \neg \left(a \leq 1.5 \cdot 10^{+182}\right):\\ \;\;\;\;\frac{x}{y \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{a}}{y}\\ \end{array} \]
Alternative 14
Error54.45%
Cost713
\[\begin{array}{l} \mathbf{if}\;b \leq -380000000 \lor \neg \left(b \leq 0.49\right):\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \end{array} \]
Alternative 15
Error54.21%
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq -800:\\ \;\;\;\;\frac{x}{a \cdot \left(y \cdot b\right)}\\ \mathbf{elif}\;b \leq 205000:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot b\right)}\\ \end{array} \]
Alternative 16
Error54.18%
Cost712
\[\begin{array}{l} \mathbf{if}\;b \leq -8.5 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{a \cdot \left(y + y \cdot b\right)}\\ \mathbf{elif}\;b \leq 0.00065:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(a \cdot b\right)}\\ \end{array} \]
Alternative 17
Error61.02%
Cost580
\[\begin{array}{l} \mathbf{if}\;a \leq 3 \cdot 10^{-22}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 18
Error60.4%
Cost580
\[\begin{array}{l} \mathbf{if}\;a \leq 2 \cdot 10^{-23}:\\ \;\;\;\;\frac{1}{a \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 19
Error63.64%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 1.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 20
Error61.01%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 1.2 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{x}{y}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot a}\\ \end{array} \]
Alternative 21
Error85.33%
Cost192
\[\frac{x}{y} \]

Error

Reproduce?

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