?

Average Accuracy: 90.8% → 95.7%
Time: 12.5s
Precision: binary64
Cost: 34185

?

\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]
\[\begin{array}{l} t_0 := \frac{y}{y + z}\\ t_1 := x + \frac{e^{y \cdot \log t_0}}{y}\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+283} \lor \neg \left(t_1 \leq 5 \cdot 10^{-150}\right):\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{t_0}^{y}}{y}\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ y (+ y z))) (t_1 (+ x (/ (exp (* y (log t_0))) y))))
   (if (or (<= t_1 -1e+283) (not (<= t_1 5e-150)))
     (+ x (/ 1.0 y))
     (+ x (/ (pow t_0 y) y)))))
double code(double x, double y, double z) {
	return x + (exp((y * log((y / (z + y))))) / y);
}
double code(double x, double y, double z) {
	double t_0 = y / (y + z);
	double t_1 = x + (exp((y * log(t_0))) / y);
	double tmp;
	if ((t_1 <= -1e+283) || !(t_1 <= 5e-150)) {
		tmp = x + (1.0 / y);
	} else {
		tmp = x + (pow(t_0, y) / y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (exp((y * log((y / (z + y))))) / y)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y / (y + z)
    t_1 = x + (exp((y * log(t_0))) / y)
    if ((t_1 <= (-1d+283)) .or. (.not. (t_1 <= 5d-150))) then
        tmp = x + (1.0d0 / y)
    else
        tmp = x + ((t_0 ** y) / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
public static double code(double x, double y, double z) {
	double t_0 = y / (y + z);
	double t_1 = x + (Math.exp((y * Math.log(t_0))) / y);
	double tmp;
	if ((t_1 <= -1e+283) || !(t_1 <= 5e-150)) {
		tmp = x + (1.0 / y);
	} else {
		tmp = x + (Math.pow(t_0, y) / y);
	}
	return tmp;
}
def code(x, y, z):
	return x + (math.exp((y * math.log((y / (z + y))))) / y)
def code(x, y, z):
	t_0 = y / (y + z)
	t_1 = x + (math.exp((y * math.log(t_0))) / y)
	tmp = 0
	if (t_1 <= -1e+283) or not (t_1 <= 5e-150):
		tmp = x + (1.0 / y)
	else:
		tmp = x + (math.pow(t_0, y) / y)
	return tmp
function code(x, y, z)
	return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y))
end
function code(x, y, z)
	t_0 = Float64(y / Float64(y + z))
	t_1 = Float64(x + Float64(exp(Float64(y * log(t_0))) / y))
	tmp = 0.0
	if ((t_1 <= -1e+283) || !(t_1 <= 5e-150))
		tmp = Float64(x + Float64(1.0 / y));
	else
		tmp = Float64(x + Float64((t_0 ^ y) / y));
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = x + (exp((y * log((y / (z + y))))) / y);
end
function tmp_2 = code(x, y, z)
	t_0 = y / (y + z);
	t_1 = x + (exp((y * log(t_0))) / y);
	tmp = 0.0;
	if ((t_1 <= -1e+283) || ~((t_1 <= 5e-150)))
		tmp = x + (1.0 / y);
	else
		tmp = x + ((t_0 ^ y) / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(y + z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(N[Exp[N[(y * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+283], N[Not[LessEqual[t$95$1, 5e-150]], $MachinePrecision]], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Power[t$95$0, y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
t_0 := \frac{y}{y + z}\\
t_1 := x + \frac{e^{y \cdot \log t_0}}{y}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+283} \lor \neg \left(t_1 \leq 5 \cdot 10^{-150}\right):\\
\;\;\;\;x + \frac{1}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{{t_0}^{y}}{y}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original90.8%
Target98.3%
Herbie95.7%
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z + y} < 7.11541576 \cdot 10^{-315}:\\ \;\;\;\;x + \frac{e^{\frac{-1}{z}}}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{e^{\log \left({\left(\frac{y}{y + z}\right)}^{y}\right)}}{y}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (exp.f64 (*.f64 y (log.f64 (/.f64 y (+.f64 z y))))) y)) < -9.99999999999999955e282 or 4.9999999999999999e-150 < (+.f64 x (/.f64 (exp.f64 (*.f64 y (log.f64 (/.f64 y (+.f64 z y))))) y))

    1. Initial program 88.7%

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]
    2. Simplified99.3%

      \[\leadsto \color{blue}{x + \frac{{\left(e^{y}\right)}^{\log \left(\frac{y}{y + z}\right)}}{y}} \]
      Proof

      [Start]88.7

      \[ x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]

      exp-prod [=>]99.3

      \[ x + \frac{\color{blue}{{\left(e^{y}\right)}^{\log \left(\frac{y}{z + y}\right)}}}{y} \]

      sqr-pow [=>]99.3

      \[ x + \frac{\color{blue}{{\left(e^{y}\right)}^{\left(\frac{\log \left(\frac{y}{z + y}\right)}{2}\right)} \cdot {\left(e^{y}\right)}^{\left(\frac{\log \left(\frac{y}{z + y}\right)}{2}\right)}}}{y} \]

      sqr-pow [<=]99.3

      \[ x + \frac{\color{blue}{{\left(e^{y}\right)}^{\log \left(\frac{y}{z + y}\right)}}}{y} \]

      +-commutative [=>]99.3

      \[ x + \frac{{\left(e^{y}\right)}^{\log \left(\frac{y}{\color{blue}{y + z}}\right)}}{y} \]
    3. Taylor expanded in y around inf 98.4%

      \[\leadsto \color{blue}{\frac{1}{y} + x} \]

    if -9.99999999999999955e282 < (+.f64 x (/.f64 (exp.f64 (*.f64 y (log.f64 (/.f64 y (+.f64 z y))))) y)) < 4.9999999999999999e-150

    1. Initial program 93.0%

      \[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]
    2. Simplified93.0%

      \[\leadsto \color{blue}{x + \frac{{\left(\frac{y}{y + z}\right)}^{y}}{y}} \]
      Proof

      [Start]93.0

      \[ x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]

      *-commutative [=>]93.0

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

      exp-prod [=>]93.0

      \[ x + \frac{\color{blue}{{\left(e^{\log \left(\frac{y}{z + y}\right)}\right)}^{y}}}{y} \]

      rem-exp-log [=>]93.0

      \[ x + \frac{{\color{blue}{\left(\frac{y}{z + y}\right)}}^{y}}{y} \]

      +-commutative [=>]93.0

      \[ x + \frac{{\left(\frac{y}{\color{blue}{y + z}}\right)}^{y}}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{e^{y \cdot \log \left(\frac{y}{y + z}\right)}}{y} \leq -1 \cdot 10^{+283} \lor \neg \left(x + \frac{e^{y \cdot \log \left(\frac{y}{y + z}\right)}}{y} \leq 5 \cdot 10^{-150}\right):\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{\left(\frac{y}{y + z}\right)}^{y}}{y}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy98.3%
Cost19840
\[x + \frac{{\left(e^{y}\right)}^{\log \left(\frac{y}{y + z}\right)}}{y} \]
Alternative 2
Accuracy95.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq 3.5 \cdot 10^{-6} \lor \neg \left(y \leq 1.45 \cdot 10^{+73}\right):\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy77.2%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.85 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-59}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy57.0%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023138 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
  :precision binary64

  :herbie-target
  (if (< (/ y (+ z y)) 7.11541576e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))

  (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))