
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y) :precision binary64 (* x (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return x * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return x * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return x * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(x * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = x * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(x * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
Initial program 87.5%
associate-/l*99.8%
Simplified99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= y -9.6e-34)
t_0
(if (<= y 8.5e-39)
(/ x (+ y (/ y x)))
(if (<= y 1.3e-8) x (if (<= y 7.2e+65) (/ x y) t_0))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (y <= -9.6e-34) {
tmp = t_0;
} else if (y <= 8.5e-39) {
tmp = x / (y + (y / x));
} else if (y <= 1.3e-8) {
tmp = x;
} else if (y <= 7.2e+65) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + 1.0d0)
if (y <= (-9.6d-34)) then
tmp = t_0
else if (y <= 8.5d-39) then
tmp = x / (y + (y / x))
else if (y <= 1.3d-8) then
tmp = x
else if (y <= 7.2d+65) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (y <= -9.6e-34) {
tmp = t_0;
} else if (y <= 8.5e-39) {
tmp = x / (y + (y / x));
} else if (y <= 1.3e-8) {
tmp = x;
} else if (y <= 7.2e+65) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if y <= -9.6e-34: tmp = t_0 elif y <= 8.5e-39: tmp = x / (y + (y / x)) elif y <= 1.3e-8: tmp = x elif y <= 7.2e+65: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (y <= -9.6e-34) tmp = t_0; elseif (y <= 8.5e-39) tmp = Float64(x / Float64(y + Float64(y / x))); elseif (y <= 1.3e-8) tmp = x; elseif (y <= 7.2e+65) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (y <= -9.6e-34) tmp = t_0; elseif (y <= 8.5e-39) tmp = x / (y + (y / x)); elseif (y <= 1.3e-8) tmp = x; elseif (y <= 7.2e+65) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.6e-34], t$95$0, If[LessEqual[y, 8.5e-39], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-8], x, If[LessEqual[y, 7.2e+65], N[(x / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;y \leq -9.6 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+65}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -9.59999999999999965e-34 or 7.19999999999999957e65 < y Initial program 89.3%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
Simplified79.1%
if -9.59999999999999965e-34 < y < 8.5000000000000005e-39Initial program 89.9%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.8%
+-commutative99.8%
div-inv99.7%
div-inv99.7%
distribute-rgt-out99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 78.4%
Taylor expanded in x around inf 78.4%
if 8.5000000000000005e-39 < y < 1.3000000000000001e-8Initial program 100.0%
Taylor expanded in x around 0 79.8%
if 1.3000000000000001e-8 < y < 7.19999999999999957e65Initial program 57.6%
Taylor expanded in x around inf 67.8%
(FPCore (x y) :precision binary64 (if (or (<= x -4.8e+162) (not (<= x 1.8e+125))) (/ x y) (* x (/ (+ x y) (* y (+ x 1.0))))))
double code(double x, double y) {
double tmp;
if ((x <= -4.8e+162) || !(x <= 1.8e+125)) {
tmp = x / y;
} else {
tmp = x * ((x + y) / (y * (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-4.8d+162)) .or. (.not. (x <= 1.8d+125))) then
tmp = x / y
else
tmp = x * ((x + y) / (y * (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -4.8e+162) || !(x <= 1.8e+125)) {
tmp = x / y;
} else {
tmp = x * ((x + y) / (y * (x + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -4.8e+162) or not (x <= 1.8e+125): tmp = x / y else: tmp = x * ((x + y) / (y * (x + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -4.8e+162) || !(x <= 1.8e+125)) tmp = Float64(x / y); else tmp = Float64(x * Float64(Float64(x + y) / Float64(y * Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -4.8e+162) || ~((x <= 1.8e+125))) tmp = x / y; else tmp = x * ((x + y) / (y * (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -4.8e+162], N[Not[LessEqual[x, 1.8e+125]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x * N[(N[(x + y), $MachinePrecision] / N[(y * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+162} \lor \neg \left(x \leq 1.8 \cdot 10^{+125}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x + y}{y \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -4.80000000000000018e162 or 1.8000000000000002e125 < x Initial program 58.8%
Taylor expanded in x around inf 84.9%
if -4.80000000000000018e162 < x < 1.8000000000000002e125Initial program 97.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
*-lft-identity99.8%
+-commutative99.8%
associate-*l/99.7%
*-lft-identity99.7%
+-commutative99.7%
associate-*l/99.7%
distribute-lft-in99.7%
associate-*l/99.7%
*-lft-identity99.7%
associate-/l/96.7%
Simplified96.7%
Final simplification93.8%
(FPCore (x y) :precision binary64 (if (or (<= x -5.5e-11) (not (<= x 0.0064))) (/ x (+ y (/ y x))) (* x (+ 1.0 (- (/ x y) x)))))
double code(double x, double y) {
double tmp;
if ((x <= -5.5e-11) || !(x <= 0.0064)) {
tmp = x / (y + (y / x));
} else {
tmp = x * (1.0 + ((x / y) - x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-5.5d-11)) .or. (.not. (x <= 0.0064d0))) then
tmp = x / (y + (y / x))
else
tmp = x * (1.0d0 + ((x / y) - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -5.5e-11) || !(x <= 0.0064)) {
tmp = x / (y + (y / x));
} else {
tmp = x * (1.0 + ((x / y) - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -5.5e-11) or not (x <= 0.0064): tmp = x / (y + (y / x)) else: tmp = x * (1.0 + ((x / y) - x)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -5.5e-11) || !(x <= 0.0064)) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = Float64(x * Float64(1.0 + Float64(Float64(x / y) - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -5.5e-11) || ~((x <= 0.0064))) tmp = x / (y + (y / x)); else tmp = x * (1.0 + ((x / y) - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -5.5e-11], N[Not[LessEqual[x, 0.0064]], $MachinePrecision]], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-11} \lor \neg \left(x \leq 0.0064\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \left(\frac{x}{y} - x\right)\right)\\
\end{array}
\end{array}
if x < -5.49999999999999975e-11 or 0.00640000000000000031 < x Initial program 73.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.9%
+-commutative99.9%
div-inv99.8%
div-inv99.7%
distribute-rgt-out99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 60.9%
Taylor expanded in x around inf 74.9%
if -5.49999999999999975e-11 < x < 0.00640000000000000031Initial program 99.8%
Taylor expanded in x around 0 98.9%
Taylor expanded in y around inf 99.0%
neg-mul-199.0%
+-commutative99.0%
unsub-neg99.0%
Simplified99.0%
Final simplification87.8%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (/ x y) (if (<= x -7.2e-48) (* x (/ x y)) (if (<= x 0.7) x (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = x / y;
} else if (x <= -7.2e-48) {
tmp = x * (x / y);
} else if (x <= 0.7) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= (-7.2d-48)) then
tmp = x * (x / y)
else if (x <= 0.7d0) then
tmp = x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = x / y;
} else if (x <= -7.2e-48) {
tmp = x * (x / y);
} else if (x <= 0.7) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.0: tmp = x / y elif x <= -7.2e-48: tmp = x * (x / y) elif x <= 0.7: tmp = x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(x / y); elseif (x <= -7.2e-48) tmp = Float64(x * Float64(x / y)); elseif (x <= 0.7) tmp = x; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.0) tmp = x / y; elseif (x <= -7.2e-48) tmp = x * (x / y); elseif (x <= 0.7) tmp = x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, -7.2e-48], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.7], x, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-48}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1 or 0.69999999999999996 < x Initial program 72.3%
Taylor expanded in x around inf 74.0%
if -1 < x < -7.2000000000000003e-48Initial program 99.6%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in y around 0 72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in x around 0 62.9%
if -7.2000000000000003e-48 < x < 0.69999999999999996Initial program 99.8%
Taylor expanded in x around 0 73.0%
(FPCore (x y) :precision binary64 (if (or (<= x -2.45e+16) (not (<= x 42000000000000.0))) (/ x y) (/ x (+ x 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -2.45e+16) || !(x <= 42000000000000.0)) {
tmp = x / y;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-2.45d+16)) .or. (.not. (x <= 42000000000000.0d0))) then
tmp = x / y
else
tmp = x / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2.45e+16) || !(x <= 42000000000000.0)) {
tmp = x / y;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2.45e+16) or not (x <= 42000000000000.0): tmp = x / y else: tmp = x / (x + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -2.45e+16) || !(x <= 42000000000000.0)) tmp = Float64(x / y); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2.45e+16) || ~((x <= 42000000000000.0))) tmp = x / y; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2.45e+16], N[Not[LessEqual[x, 42000000000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+16} \lor \neg \left(x \leq 42000000000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -2.45e16 or 4.2e13 < x Initial program 71.1%
Taylor expanded in x around inf 76.4%
if -2.45e16 < x < 4.2e13Initial program 99.8%
Taylor expanded in y around inf 69.4%
+-commutative69.4%
Simplified69.4%
Final simplification72.4%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 0.7))) (/ x y) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.7)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 0.7d0))) then
tmp = x / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 0.7)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 0.7): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.7)) tmp = Float64(x / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 0.7))) tmp = x / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.7]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.7\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 0.69999999999999996 < x Initial program 72.3%
Taylor expanded in x around inf 74.0%
if -1 < x < 0.69999999999999996Initial program 99.8%
Taylor expanded in x around 0 68.6%
Final simplification71.0%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 87.5%
Taylor expanded in x around 0 39.4%
(FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
herbie shell --seed 2024111
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:alt
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))