Average Error: 6.4 → 1.4
Time: 7.6s
Precision: binary64
\[x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \]
\[\begin{array}{l} \mathbf{if}\;y \leq 2.6512083876927243 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{\left(\left|\frac{\sqrt{y}}{\sqrt{y + z}}\right|\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y}\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z)
 :precision binary64
 (if (<= y 2.6512083876927243e-77)
   (+ x (/ 1.0 y))
   (+
    x
    (/
     (*
      (pow (fabs (/ (sqrt y) (sqrt (+ y z)))) y)
      (pow (sqrt (/ y (+ y z))) 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 tmp;
	if (y <= 2.6512083876927243e-77) {
		tmp = x + (1.0 / y);
	} else {
		tmp = x + ((pow(fabs((sqrt(y) / sqrt((y + z)))), y) * pow(sqrt((y / (y + z))), 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) :: tmp
    if (y <= 2.6512083876927243d-77) then
        tmp = x + (1.0d0 / y)
    else
        tmp = x + (((abs((sqrt(y) / sqrt((y + z)))) ** y) * (sqrt((y / (y + z))) ** 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 tmp;
	if (y <= 2.6512083876927243e-77) {
		tmp = x + (1.0 / y);
	} else {
		tmp = x + ((Math.pow(Math.abs((Math.sqrt(y) / Math.sqrt((y + z)))), y) * Math.pow(Math.sqrt((y / (y + z))), 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):
	tmp = 0
	if y <= 2.6512083876927243e-77:
		tmp = x + (1.0 / y)
	else:
		tmp = x + ((math.pow(math.fabs((math.sqrt(y) / math.sqrt((y + z)))), y) * math.pow(math.sqrt((y / (y + z))), 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)
	tmp = 0.0
	if (y <= 2.6512083876927243e-77)
		tmp = Float64(x + Float64(1.0 / y));
	else
		tmp = Float64(x + Float64(Float64((abs(Float64(sqrt(y) / sqrt(Float64(y + z)))) ^ y) * (sqrt(Float64(y / Float64(y + z))) ^ 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)
	tmp = 0.0;
	if (y <= 2.6512083876927243e-77)
		tmp = x + (1.0 / y);
	else
		tmp = x + (((abs((sqrt(y) / sqrt((y + z)))) ^ y) * (sqrt((y / (y + z))) ^ 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_] := If[LessEqual[y, 2.6512083876927243e-77], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[Power[N[Abs[N[(N[Sqrt[y], $MachinePrecision] / N[Sqrt[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y], $MachinePrecision] * N[Power[N[Sqrt[N[(y / N[(y + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
\mathbf{if}\;y \leq 2.6512083876927243 \cdot 10^{-77}:\\
\;\;\;\;x + \frac{1}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{{\left(\left|\frac{\sqrt{y}}{\sqrt{y + z}}\right|\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y}\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target1.2
Herbie1.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. Split input into 2 regimes
  2. if y < 2.6512083876927243e-77

    1. Initial program 9.0

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

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

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

    if 2.6512083876927243e-77 < y

    1. Initial program 1.9

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

      \[\leadsto \color{blue}{x + \frac{{\left(\frac{y}{y + z}\right)}^{y}}{y}} \]
    3. Applied add-sqr-sqrt_binary641.9

      \[\leadsto x + \frac{{\color{blue}{\left(\sqrt{\frac{y}{y + z}} \cdot \sqrt{\frac{y}{y + z}}\right)}}^{y}}{y} \]
    4. Applied unpow-prod-down_binary641.9

      \[\leadsto x + \frac{\color{blue}{{\left(\sqrt{\frac{y}{y + z}}\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}}{y} \]
    5. Applied add-sqr-sqrt_binary643.6

      \[\leadsto x + \frac{{\left(\sqrt{\frac{y}{\color{blue}{\sqrt{y + z} \cdot \sqrt{y + z}}}}\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y} \]
    6. Applied add-sqr-sqrt_binary641.9

      \[\leadsto x + \frac{{\left(\sqrt{\frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\sqrt{y + z} \cdot \sqrt{y + z}}}\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y} \]
    7. Applied times-frac_binary641.9

      \[\leadsto x + \frac{{\left(\sqrt{\color{blue}{\frac{\sqrt{y}}{\sqrt{y + z}} \cdot \frac{\sqrt{y}}{\sqrt{y + z}}}}\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y} \]
    8. Applied rem-sqrt-square_binary641.9

      \[\leadsto x + \frac{{\color{blue}{\left(\left|\frac{\sqrt{y}}{\sqrt{y + z}}\right|\right)}}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.6512083876927243 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{{\left(\left|\frac{\sqrt{y}}{\sqrt{y + z}}\right|\right)}^{y} \cdot {\left(\sqrt{\frac{y}{y + z}}\right)}^{y}}{y}\\ \end{array} \]

Reproduce

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