
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* (/ y (+ y x)) (/ x (+ y (+ x 1.0)))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (y + x)) * (x / (y + (x + 1.0d0)))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + Float64(x + 1.0)))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + x)) * (x / (y + (x + 1.0)))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x} \cdot \frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
frac-times67.0%
*-commutative67.0%
*-un-lft-identity67.0%
frac-times70.6%
associate-*l/70.6%
*-un-lft-identity70.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (/ y (+ y x)) (/ x (+ x 1.0))) (+ y x))))
(if (<= y 1.55e-15)
t_0
(if (<= y 2.4e+27)
(/ (/ 1.0 (+ y x)) (/ (+ y 1.0) x))
(if (<= y 3.25e+50) t_0 (* x (/ (/ 1.0 y) (+ y x))))))))assert(x < y);
double code(double x, double y) {
double t_0 = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
double tmp;
if (y <= 1.55e-15) {
tmp = t_0;
} else if (y <= 2.4e+27) {
tmp = (1.0 / (y + x)) / ((y + 1.0) / x);
} else if (y <= 3.25e+50) {
tmp = t_0;
} else {
tmp = x * ((1.0 / y) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 = ((y / (y + x)) * (x / (x + 1.0d0))) / (y + x)
if (y <= 1.55d-15) then
tmp = t_0
else if (y <= 2.4d+27) then
tmp = (1.0d0 / (y + x)) / ((y + 1.0d0) / x)
else if (y <= 3.25d+50) then
tmp = t_0
else
tmp = x * ((1.0d0 / y) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
double tmp;
if (y <= 1.55e-15) {
tmp = t_0;
} else if (y <= 2.4e+27) {
tmp = (1.0 / (y + x)) / ((y + 1.0) / x);
} else if (y <= 3.25e+50) {
tmp = t_0;
} else {
tmp = x * ((1.0 / y) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = ((y / (y + x)) * (x / (x + 1.0))) / (y + x) tmp = 0 if y <= 1.55e-15: tmp = t_0 elif y <= 2.4e+27: tmp = (1.0 / (y + x)) / ((y + 1.0) / x) elif y <= 3.25e+50: tmp = t_0 else: tmp = x * ((1.0 / y) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + 1.0))) / Float64(y + x)) tmp = 0.0 if (y <= 1.55e-15) tmp = t_0; elseif (y <= 2.4e+27) tmp = Float64(Float64(1.0 / Float64(y + x)) / Float64(Float64(y + 1.0) / x)); elseif (y <= 3.25e+50) tmp = t_0; else tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
tmp = 0.0;
if (y <= 1.55e-15)
tmp = t_0;
elseif (y <= 2.4e+27)
tmp = (1.0 / (y + x)) / ((y + 1.0) / x);
elseif (y <= 3.25e+50)
tmp = t_0;
else
tmp = x * ((1.0 / y) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.55e-15], t$95$0, If[LessEqual[y, 2.4e+27], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.25e+50], t$95$0, N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{y + x} \cdot \frac{x}{x + 1}}{y + x}\\
\mathbf{if}\;y \leq 1.55 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{1}{y + x}}{\frac{y + 1}{x}}\\
\mathbf{elif}\;y \leq 3.25 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\end{array}
\end{array}
if y < 1.5499999999999999e-15 or 2.39999999999999998e27 < y < 3.2500000000000001e50Initial program 68.1%
associate-*l*68.1%
times-frac96.4%
+-commutative96.4%
+-commutative96.4%
associate-+r+96.4%
+-commutative96.4%
associate-+l+96.4%
Applied egg-rr96.4%
frac-times68.1%
*-commutative68.1%
*-un-lft-identity68.1%
frac-times71.0%
associate-*l/71.0%
*-un-lft-identity71.0%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 80.9%
+-commutative80.9%
Simplified80.9%
if 1.5499999999999999e-15 < y < 2.39999999999999998e27Initial program 99.9%
associate-*l*99.6%
times-frac99.5%
+-commutative99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
Applied egg-rr99.5%
frac-times99.6%
*-commutative99.6%
*-un-lft-identity99.6%
frac-times99.5%
*-commutative99.5%
clear-num99.4%
frac-times99.2%
metadata-eval99.2%
+-commutative99.2%
*-commutative99.2%
times-frac99.4%
Applied egg-rr99.4%
*-commutative99.4%
associate-/r*99.4%
Simplified99.4%
Taylor expanded in x around 0 62.6%
+-commutative62.6%
Simplified62.6%
if 3.2500000000000001e50 < y Initial program 54.6%
associate-*l*54.6%
times-frac85.5%
+-commutative85.5%
+-commutative85.5%
associate-+r+85.5%
+-commutative85.5%
associate-+l+85.5%
Applied egg-rr85.5%
frac-times54.6%
*-commutative54.6%
*-un-lft-identity54.6%
frac-times61.8%
associate-*l/61.8%
*-un-lft-identity61.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 82.7%
div-inv82.7%
associate-/l*86.2%
Applied egg-rr86.2%
Final simplification81.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 2.4e-20)
(/ (* (/ y (+ y x)) (/ x (+ x 1.0))) (+ y x))
(if (<= y 1.3e+53)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(* x (/ (/ 1.0 y) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.4e-20) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else if (y <= 1.3e+53) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = x * ((1.0 / y) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.4d-20) then
tmp = ((y / (y + x)) * (x / (x + 1.0d0))) / (y + x)
else if (y <= 1.3d+53) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = x * ((1.0d0 / y) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.4e-20) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else if (y <= 1.3e+53) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = x * ((1.0 / y) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.4e-20: tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x) elif y <= 1.3e+53: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = x * ((1.0 / y) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.4e-20) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + 1.0))) / Float64(y + x)); elseif (y <= 1.3e+53) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(x * Float64(Float64(1.0 / y) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.4e-20)
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
elseif (y <= 1.3e+53)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = x * ((1.0 / y) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.4e-20], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+53], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{x + 1}}{y + x}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+53}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\
\end{array}
\end{array}
if y < 2.39999999999999993e-20Initial program 67.6%
associate-*l*67.6%
times-frac96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
frac-times67.6%
*-commutative67.6%
*-un-lft-identity67.6%
frac-times70.5%
associate-*l/70.6%
*-un-lft-identity70.6%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 81.1%
+-commutative81.1%
Simplified81.1%
if 2.39999999999999993e-20 < y < 1.29999999999999999e53Initial program 99.9%
associate-/l*99.5%
associate-+l+99.5%
Simplified99.5%
if 1.29999999999999999e53 < y Initial program 53.7%
associate-*l*53.7%
times-frac85.2%
+-commutative85.2%
+-commutative85.2%
associate-+r+85.2%
+-commutative85.2%
associate-+l+85.2%
Applied egg-rr85.2%
frac-times53.7%
*-commutative53.7%
*-un-lft-identity53.7%
frac-times61.0%
associate-*l/61.0%
*-un-lft-identity61.0%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 82.3%
div-inv82.3%
associate-/l*86.0%
Applied egg-rr86.0%
Final simplification83.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.3e-20) (/ (* (/ y (+ y x)) (/ x (+ x 1.0))) (+ y x)) (* x (/ (/ y (* (+ y x) (+ y (+ x 1.0)))) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.3e-20) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.3d-20) then
tmp = ((y / (y + x)) * (x / (x + 1.0d0))) / (y + x)
else
tmp = x * ((y / ((y + x) * (y + (x + 1.0d0)))) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.3e-20) {
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
} else {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.3e-20: tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x) else: tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.3e-20) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + 1.0))) / Float64(y + x)); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.3e-20)
tmp = ((y / (y + x)) * (x / (x + 1.0))) / (y + x);
else
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.3e-20], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}}{y + x}\\
\end{array}
\end{array}
if y < 2.2999999999999999e-20Initial program 67.6%
associate-*l*67.6%
times-frac96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
frac-times67.6%
*-commutative67.6%
*-un-lft-identity67.6%
frac-times70.5%
associate-*l/70.6%
*-un-lft-identity70.6%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 81.1%
+-commutative81.1%
Simplified81.1%
if 2.2999999999999999e-20 < y Initial program 65.3%
associate-/l*83.3%
associate-+l+83.3%
Simplified83.3%
*-un-lft-identity83.3%
associate-+r+83.3%
associate-*l*83.2%
times-frac87.3%
+-commutative87.3%
+-commutative87.3%
associate-+r+87.3%
+-commutative87.3%
associate-+l+87.3%
Applied egg-rr87.3%
associate-*l/87.4%
*-lft-identity87.4%
+-commutative87.4%
Simplified87.4%
Final simplification82.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ y x)) (/ y (* (+ y x) (+ y (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
return (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0d0))))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}
\end{array}
Initial program 67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
Final simplification94.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ y (+ y (+ x 1.0))) (/ (/ x (+ y x)) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + (x + 1.0))) * ((x / (y + x)) / (y + x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + (x + 1.0d0))) * ((x / (y + x)) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + (x + 1.0))) * ((x / (y + x)) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + (x + 1.0))) * ((x / (y + x)) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + Float64(x + 1.0))) * Float64(Float64(x / Float64(y + x)) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + (x + 1.0))) * ((x / (y + x)) / (y + x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + \left(x + 1\right)} \cdot \frac{\frac{x}{y + x}}{y + x}
\end{array}
Initial program 67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
frac-times67.0%
*-commutative67.0%
*-un-lft-identity67.0%
frac-times70.6%
associate-*l/70.6%
*-un-lft-identity70.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
frac-times70.6%
clear-num70.6%
*-commutative70.6%
frac-times99.7%
associate-/r*99.7%
clear-num99.8%
Applied egg-rr99.8%
div-inv99.8%
clear-num99.8%
associate-/l*99.7%
Applied egg-rr99.7%
Final simplification99.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* x (/ (/ y (+ y x)) (+ y (+ x 1.0)))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return (x * ((y / (y + x)) / (y + (x + 1.0)))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((y / (y + x)) / (y + (x + 1.0d0)))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return (x * ((y / (y + x)) / (y + (x + 1.0)))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return (x * ((y / (y + x)) / (y + (x + 1.0)))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x * Float64(Float64(y / Float64(y + x)) / Float64(y + Float64(x + 1.0)))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x * ((y / (y + x)) / (y + (x + 1.0)))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x \cdot \frac{\frac{y}{y + x}}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
associate-*l/94.3%
associate-/r*99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.6e-154) (/ y (* (+ y x) (+ y (+ x 1.0)))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.6e-154) {
tmp = y / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.6d-154)) then
tmp = y / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.6e-154) {
tmp = y / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.6e-154: tmp = y / ((y + x) * (y + (x + 1.0))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.6e-154) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.6e-154)
tmp = y / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.6e-154], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.60000000000000002e-154Initial program 62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
Taylor expanded in x around inf 72.6%
if -1.60000000000000002e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.6%
associate-/r*64.1%
+-commutative64.1%
Simplified64.1%
associate-/l/63.6%
*-commutative63.6%
div-inv63.7%
associate-/r*65.1%
Applied egg-rr65.1%
Final simplification67.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ (/ y (+ x 1.0)) (+ y x)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / (x + 1.0)) / (y + x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / (x + 1.0)) / (y + x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = (y / (x + 1.0)) / (y + x) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = (y / (x + 1.0)) / (y + x);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
frac-times62.7%
*-commutative62.7%
*-un-lft-identity62.7%
frac-times67.7%
associate-*l/67.7%
*-un-lft-identity67.7%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 66.1%
+-commutative66.1%
Simplified66.1%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.6%
associate-/r*64.1%
+-commutative64.1%
Simplified64.1%
associate-/l/63.6%
*-commutative63.6%
div-inv63.7%
associate-/r*65.1%
Applied egg-rr65.1%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.55e-8) (* (/ y x) (/ 1.0 x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.55e-8) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.55d-8)) then
tmp = (y / x) * (1.0d0 / x)
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.55e-8) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.55e-8: tmp = (y / x) * (1.0 / x) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.55e-8) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.55e-8)
tmp = (y / x) * (1.0 / x);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.55e-8], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.55e-8Initial program 57.7%
*-un-lft-identity57.7%
associate-*l*57.7%
times-frac64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-+r+64.8%
+-commutative64.8%
associate-+l+64.8%
Applied egg-rr64.8%
Taylor expanded in x around inf 70.6%
Taylor expanded in y around 0 70.1%
if -1.55e-8 < x Initial program 69.6%
associate-/l*86.7%
associate-+l+86.7%
Simplified86.7%
Taylor expanded in x around 0 62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around 0 36.9%
Final simplification44.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.55e-8) (* (/ y x) (/ 1.0 x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.55e-8) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.55d-8)) then
tmp = (y / x) * (1.0d0 / x)
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.55e-8) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.55e-8: tmp = (y / x) * (1.0 / x) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.55e-8) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.55e-8)
tmp = (y / x) * (1.0 / x);
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.55e-8], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.55e-8Initial program 57.7%
*-un-lft-identity57.7%
associate-*l*57.7%
times-frac64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-+r+64.8%
+-commutative64.8%
associate-+l+64.8%
Applied egg-rr64.8%
Taylor expanded in x around inf 70.6%
Taylor expanded in y around 0 70.1%
if -1.55e-8 < x Initial program 69.6%
associate-/l*86.7%
associate-+l+86.7%
Simplified86.7%
Taylor expanded in x around 0 62.2%
+-commutative62.2%
Simplified62.2%
Final simplification64.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 67.5%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
+-commutative63.7%
Simplified63.7%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 67.5%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.6%
associate-/r*64.1%
+-commutative64.1%
Simplified64.1%
associate-/l/63.6%
*-commutative63.6%
div-inv63.7%
associate-/r*65.1%
Applied egg-rr65.1%
Final simplification65.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 67.5%
associate-/r*65.9%
+-commutative65.9%
Simplified65.9%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.6%
associate-/r*64.1%
+-commutative64.1%
Simplified64.1%
associate-/l/63.6%
*-commutative63.6%
div-inv63.7%
associate-/r*65.1%
Applied egg-rr65.1%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (+ y x)))
assert(x < y);
double code(double x, double y) {
return x / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return x / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return x / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + x}
\end{array}
Initial program 67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
frac-times67.0%
*-commutative67.0%
*-un-lft-identity67.0%
frac-times70.6%
associate-*l/70.6%
*-un-lft-identity70.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in y around 0 29.7%
Final simplification29.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 67.0%
*-un-lft-identity67.0%
associate-*l*67.0%
times-frac70.6%
+-commutative70.6%
*-commutative70.6%
+-commutative70.6%
associate-+r+70.6%
+-commutative70.6%
associate-+l+70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 34.1%
Taylor expanded in y around inf 4.1%
Final simplification4.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 67.0%
associate-/l*84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in x around 0 54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in y around 0 29.2%
Final simplification29.2%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024067
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))