Average Error: 6.1 → 2.4
Time: 6.7s
Precision: binary64
Cost: 320
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]
\[\frac{1}{y} + x \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z) :precision binary64 (+ (/ 1.0 y) x))
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) {
	return (1.0 / y) + x;
}
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
    code = (1.0d0 / y) + x
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) {
	return (1.0 / y) + x;
}
def code(x, y, z):
	return x + (math.exp((y * math.log((y / (z + y))))) / y)
def code(x, y, z):
	return (1.0 / y) + x
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)
	return Float64(Float64(1.0 / y) + x)
end
function tmp = code(x, y, z)
	tmp = x + (exp((y * log((y / (z + y))))) / y);
end
function tmp = code(x, y, z)
	tmp = (1.0 / y) + x;
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_] := N[(N[(1.0 / y), $MachinePrecision] + x), $MachinePrecision]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\frac{1}{y} + x

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.1
Target1.0
Herbie2.4
\[\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. Initial program 6.1

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

    \[\leadsto \color{blue}{x + \frac{{\left(\frac{y}{y + z}\right)}^{y}}{y}} \]
  3. Taylor expanded in z around 0 2.4

    \[\leadsto \color{blue}{\frac{1}{y} + x} \]
  4. Final simplification2.4

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

Alternatives

Alternative 1
Error15.9
Cost984
\[\begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+79}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.9:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1.75 \cdot 10^{-54}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-136}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-106}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-63}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error27.6
Cost64
\[x \]

Error

Reproduce

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