
(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 15 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 (/ (* x (/ (/ y (+ x y)) (+ y (+ x 1.0)))) (+ x y)))
assert(x < y);
double code(double x, double y) {
return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (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 / (x + y)) / (y + (x + 1.0d0)))) / (x + y)
end function
assert x < y;
public static double code(double x, double y) {
return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
}
[x, y] = sort([x, y]) def code(x, y): return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x * Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0)))) / Float64(x + y)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
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[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 69.1%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
*-un-lft-identity82.8%
associate-+r+82.8%
associate-*l*82.8%
times-frac91.5%
+-commutative91.5%
+-commutative91.5%
associate-+r+91.5%
+-commutative91.5%
associate-+l+91.5%
Applied egg-rr91.5%
associate-*l/91.6%
*-lft-identity91.6%
+-commutative91.6%
Simplified91.6%
associate-*r/93.5%
associate-/r*99.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 (+ x (+ y 1.0))))
(if (<= y 4.6e-221)
(/ (/ y t_0) (+ x y))
(if (<= y 8e-176)
(/ x (* (+ y (+ x 1.0)) (+ x y)))
(if (<= y 7.5e+99)
(* x (/ y (* t_0 (* (+ x y) (+ x y)))))
(/ (/ x y) (* (/ (+ x y) y) t_0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 4.6e-221) {
tmp = (y / t_0) / (x + y);
} else if (y <= 8e-176) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else if (y <= 7.5e+99) {
tmp = x * (y / (t_0 * ((x + y) * (x + y))));
} else {
tmp = (x / y) / (((x + y) / y) * t_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) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (y <= 4.6d-221) then
tmp = (y / t_0) / (x + y)
else if (y <= 8d-176) then
tmp = x / ((y + (x + 1.0d0)) * (x + y))
else if (y <= 7.5d+99) then
tmp = x * (y / (t_0 * ((x + y) * (x + y))))
else
tmp = (x / y) / (((x + y) / y) * t_0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 4.6e-221) {
tmp = (y / t_0) / (x + y);
} else if (y <= 8e-176) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else if (y <= 7.5e+99) {
tmp = x * (y / (t_0 * ((x + y) * (x + y))));
} else {
tmp = (x / y) / (((x + y) / y) * t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 4.6e-221: tmp = (y / t_0) / (x + y) elif y <= 8e-176: tmp = x / ((y + (x + 1.0)) * (x + y)) elif y <= 7.5e+99: tmp = x * (y / (t_0 * ((x + y) * (x + y)))) else: tmp = (x / y) / (((x + y) / y) * t_0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 4.6e-221) tmp = Float64(Float64(y / t_0) / Float64(x + y)); elseif (y <= 8e-176) tmp = Float64(x / Float64(Float64(y + Float64(x + 1.0)) * Float64(x + y))); elseif (y <= 7.5e+99) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(x + y) * Float64(x + y))))); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (y <= 4.6e-221)
tmp = (y / t_0) / (x + y);
elseif (y <= 8e-176)
tmp = x / ((y + (x + 1.0)) * (x + y));
elseif (y <= 7.5e+99)
tmp = x * (y / (t_0 * ((x + y) * (x + y))));
else
tmp = (x / y) / (((x + y) / y) * t_0);
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[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.6e-221], N[(N[(y / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-176], N[(x / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+99], N[(x * N[(y / N[(t$95$0 * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 4.6 \cdot 10^{-221}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-176}:\\
\;\;\;\;\frac{x}{\left(y + \left(x + 1\right)\right) \cdot \left(x + y\right)}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot t\_0}\\
\end{array}
\end{array}
if y < 4.6e-221Initial program 66.2%
*-commutative66.2%
associate-*l*66.2%
times-frac95.5%
+-commutative95.5%
+-commutative95.5%
associate-+r+95.5%
+-commutative95.5%
associate-+l+95.5%
Applied egg-rr95.5%
*-commutative95.5%
clear-num95.5%
frac-times95.5%
*-un-lft-identity95.5%
+-commutative95.5%
associate-+r+95.5%
+-commutative95.5%
Applied egg-rr95.5%
*-un-lft-identity95.5%
*-commutative95.5%
times-frac95.4%
associate-/l*99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-lft-identity99.7%
associate-*r/95.5%
*-commutative95.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in x around inf 58.2%
if 4.6e-221 < y < 8e-176Initial program 56.8%
*-commutative56.8%
associate-*l*56.8%
times-frac99.5%
+-commutative99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 46.8%
if 8e-176 < y < 7.49999999999999963e99Initial program 84.2%
associate-/l*92.1%
associate-+l+92.1%
Simplified92.1%
if 7.49999999999999963e99 < y Initial program 59.2%
*-commutative59.2%
associate-*l*59.2%
times-frac80.7%
+-commutative80.7%
+-commutative80.7%
associate-+r+80.7%
+-commutative80.7%
associate-+l+80.7%
Applied egg-rr80.7%
clear-num80.7%
associate-/r*99.8%
+-commutative99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
+-commutative99.5%
+-commutative99.5%
associate-+r+99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 87.9%
Final simplification70.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (+ x 1.0)))))
(if (<= y 1.25e-186)
t_0
(if (<= y 2.4e-51)
(/ x y)
(if (<= y 8e-7)
t_0
(if (<= y 7.5e+187) (/ x (* y (+ y 1.0))) (/ (/ x (+ x y)) y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (y <= 1.25e-186) {
tmp = t_0;
} else if (y <= 2.4e-51) {
tmp = x / y;
} else if (y <= 8e-7) {
tmp = t_0;
} else if (y <= 7.5e+187) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / (x + y)) / 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) :: t_0
real(8) :: tmp
t_0 = y / (x * (x + 1.0d0))
if (y <= 1.25d-186) then
tmp = t_0
else if (y <= 2.4d-51) then
tmp = x / y
else if (y <= 8d-7) then
tmp = t_0
else if (y <= 7.5d+187) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (x / (x + y)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (y <= 1.25e-186) {
tmp = t_0;
} else if (y <= 2.4e-51) {
tmp = x / y;
} else if (y <= 8e-7) {
tmp = t_0;
} else if (y <= 7.5e+187) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / (x + y)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x * (x + 1.0)) tmp = 0 if y <= 1.25e-186: tmp = t_0 elif y <= 2.4e-51: tmp = x / y elif y <= 8e-7: tmp = t_0 elif y <= 7.5e+187: tmp = x / (y * (y + 1.0)) else: tmp = (x / (x + y)) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * Float64(x + 1.0))) tmp = 0.0 if (y <= 1.25e-186) tmp = t_0; elseif (y <= 2.4e-51) tmp = Float64(x / y); elseif (y <= 8e-7) tmp = t_0; elseif (y <= 7.5e+187) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(x + y)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (x * (x + 1.0));
tmp = 0.0;
if (y <= 1.25e-186)
tmp = t_0;
elseif (y <= 2.4e-51)
tmp = x / y;
elseif (y <= 8e-7)
tmp = t_0;
elseif (y <= 7.5e+187)
tmp = x / (y * (y + 1.0));
else
tmp = (x / (x + y)) / y;
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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.25e-186], t$95$0, If[LessEqual[y, 2.4e-51], N[(x / y), $MachinePrecision], If[LessEqual[y, 8e-7], t$95$0, If[LessEqual[y, 7.5e+187], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 1.25 \cdot 10^{-186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-51}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+187}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\
\end{array}
\end{array}
if y < 1.25e-186 or 2.4e-51 < y < 7.9999999999999996e-7Initial program 67.7%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
Taylor expanded in y around 0 58.0%
if 1.25e-186 < y < 2.4e-51Initial program 76.9%
associate-/l*88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in y around 0 38.1%
if 7.9999999999999996e-7 < y < 7.5000000000000002e187Initial program 70.7%
associate-/l*80.8%
associate-+l+80.8%
Simplified80.8%
Taylor expanded in x around 0 66.2%
+-commutative66.2%
Simplified66.2%
if 7.5000000000000002e187 < y Initial program 64.1%
*-commutative64.1%
associate-*l*64.1%
times-frac79.2%
+-commutative79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
Applied egg-rr79.2%
clear-num79.2%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 91.8%
Final simplification59.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 8e+153) (* x (/ (/ y (* (+ y (+ x 1.0)) (+ x y))) (+ x y))) (/ (/ x y) (* (/ (+ x y) y) (+ x (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 8e+153) {
tmp = x * ((y / ((y + (x + 1.0)) * (x + y))) / (x + y));
} else {
tmp = (x / y) / (((x + y) / y) * (x + (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 (y <= 8d+153) then
tmp = x * ((y / ((y + (x + 1.0d0)) * (x + y))) / (x + y))
else
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 8e+153) {
tmp = x * ((y / ((y + (x + 1.0)) * (x + y))) / (x + y));
} else {
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 8e+153: tmp = x * ((y / ((y + (x + 1.0)) * (x + y))) / (x + y)) else: tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 8e+153) tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + Float64(x + 1.0)) * Float64(x + y))) / Float64(x + y))); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * Float64(x + Float64(y + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 8e+153)
tmp = x * ((y / ((y + (x + 1.0)) * (x + y))) / (x + y));
else
tmp = (x / y) / (((x + y) / y) * (x + (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[y, 8e+153], N[(x * N[(N[(y / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+153}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + \left(x + 1\right)\right) \cdot \left(x + y\right)}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot \left(x + \left(y + 1\right)\right)}\\
\end{array}
\end{array}
if y < 8e153Initial program 69.7%
associate-/l*83.5%
associate-+l+83.5%
Simplified83.5%
*-un-lft-identity83.5%
associate-+r+83.5%
associate-*l*83.5%
times-frac93.5%
+-commutative93.5%
+-commutative93.5%
associate-+r+93.5%
+-commutative93.5%
associate-+l+93.5%
Applied egg-rr93.5%
associate-*l/93.6%
*-lft-identity93.6%
+-commutative93.6%
Simplified93.6%
if 8e153 < y Initial program 64.8%
*-commutative64.8%
associate-*l*64.8%
times-frac78.3%
+-commutative78.3%
+-commutative78.3%
associate-+r+78.3%
+-commutative78.3%
associate-+l+78.3%
Applied egg-rr78.3%
clear-num78.3%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 88.8%
Final simplification93.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 6.1e+153) (* (/ y (+ x y)) (/ x (* (+ y (+ x 1.0)) (+ x y)))) (/ (/ x y) (* (/ (+ x y) y) (+ x (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 6.1e+153) {
tmp = (y / (x + y)) * (x / ((y + (x + 1.0)) * (x + y)));
} else {
tmp = (x / y) / (((x + y) / y) * (x + (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 (y <= 6.1d+153) then
tmp = (y / (x + y)) * (x / ((y + (x + 1.0d0)) * (x + y)))
else
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 6.1e+153) {
tmp = (y / (x + y)) * (x / ((y + (x + 1.0)) * (x + y)));
} else {
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 6.1e+153: tmp = (y / (x + y)) * (x / ((y + (x + 1.0)) * (x + y))) else: tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 6.1e+153) tmp = Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(y + Float64(x + 1.0)) * Float64(x + y)))); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * Float64(x + Float64(y + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 6.1e+153)
tmp = (y / (x + y)) * (x / ((y + (x + 1.0)) * (x + y)));
else
tmp = (x / y) / (((x + y) / y) * (x + (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[y, 6.1e+153], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.1 \cdot 10^{+153}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(y + \left(x + 1\right)\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot \left(x + \left(y + 1\right)\right)}\\
\end{array}
\end{array}
if y < 6.0999999999999998e153Initial program 69.7%
*-commutative69.7%
associate-*l*69.7%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
if 6.0999999999999998e153 < y Initial program 64.8%
*-commutative64.8%
associate-*l*64.8%
times-frac78.3%
+-commutative78.3%
+-commutative78.3%
associate-+r+78.3%
+-commutative78.3%
associate-+l+78.3%
Applied egg-rr78.3%
clear-num78.3%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 88.8%
Final simplification94.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 4.6e-221)
(* (/ y (+ x y)) (/ 1.0 (+ x 1.0)))
(if (<= y 2.7e+186)
(/ x (* (+ y (+ x 1.0)) (+ x y)))
(/ (/ x (+ x y)) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.6e-221) {
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
} else if (y <= 2.7e+186) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else {
tmp = (x / (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 (y <= 4.6d-221) then
tmp = (y / (x + y)) * (1.0d0 / (x + 1.0d0))
else if (y <= 2.7d+186) then
tmp = x / ((y + (x + 1.0d0)) * (x + y))
else
tmp = (x / (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 (y <= 4.6e-221) {
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
} else if (y <= 2.7e+186) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.6e-221: tmp = (y / (x + y)) * (1.0 / (x + 1.0)) elif y <= 2.7e+186: tmp = x / ((y + (x + 1.0)) * (x + y)) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.6e-221) tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / Float64(x + 1.0))); elseif (y <= 2.7e+186) tmp = Float64(x / Float64(Float64(y + Float64(x + 1.0)) * Float64(x + y))); else tmp = Float64(Float64(x / 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 (y <= 4.6e-221)
tmp = (y / (x + y)) * (1.0 / (x + 1.0));
elseif (y <= 2.7e+186)
tmp = x / ((y + (x + 1.0)) * (x + y));
else
tmp = (x / (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[y, 4.6e-221], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+186], N[(x / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{-221}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+186}:\\
\;\;\;\;\frac{x}{\left(y + \left(x + 1\right)\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 4.6e-221Initial program 66.2%
*-commutative66.2%
associate-*l*66.2%
times-frac95.5%
+-commutative95.5%
+-commutative95.5%
associate-+r+95.5%
+-commutative95.5%
associate-+l+95.5%
Applied egg-rr95.5%
Taylor expanded in y around 0 57.6%
+-commutative57.6%
Simplified57.6%
if 4.6e-221 < y < 2.6999999999999999e186Initial program 75.2%
*-commutative75.2%
associate-*l*75.2%
times-frac93.5%
+-commutative93.5%
+-commutative93.5%
associate-+r+93.5%
+-commutative93.5%
associate-+l+93.5%
Applied egg-rr93.5%
Taylor expanded in y around inf 67.5%
if 2.6999999999999999e186 < y Initial program 64.1%
*-commutative64.1%
associate-*l*64.1%
times-frac79.2%
+-commutative79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
Applied egg-rr79.2%
clear-num79.2%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 91.8%
+-commutative91.8%
Simplified91.8%
Final simplification63.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 4.6e-221)
(/ (/ y (+ x (+ y 1.0))) (+ x y))
(if (<= y 3e+187)
(/ x (* (+ y (+ x 1.0)) (+ x y)))
(/ (/ x (+ x y)) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.6e-221) {
tmp = (y / (x + (y + 1.0))) / (x + y);
} else if (y <= 3e+187) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else {
tmp = (x / (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 (y <= 4.6d-221) then
tmp = (y / (x + (y + 1.0d0))) / (x + y)
else if (y <= 3d+187) then
tmp = x / ((y + (x + 1.0d0)) * (x + y))
else
tmp = (x / (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 (y <= 4.6e-221) {
tmp = (y / (x + (y + 1.0))) / (x + y);
} else if (y <= 3e+187) {
tmp = x / ((y + (x + 1.0)) * (x + y));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.6e-221: tmp = (y / (x + (y + 1.0))) / (x + y) elif y <= 3e+187: tmp = x / ((y + (x + 1.0)) * (x + y)) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.6e-221) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y)); elseif (y <= 3e+187) tmp = Float64(x / Float64(Float64(y + Float64(x + 1.0)) * Float64(x + y))); else tmp = Float64(Float64(x / 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 (y <= 4.6e-221)
tmp = (y / (x + (y + 1.0))) / (x + y);
elseif (y <= 3e+187)
tmp = x / ((y + (x + 1.0)) * (x + y));
else
tmp = (x / (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[y, 4.6e-221], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+187], N[(x / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{-221}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+187}:\\
\;\;\;\;\frac{x}{\left(y + \left(x + 1\right)\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 4.6e-221Initial program 66.2%
*-commutative66.2%
associate-*l*66.2%
times-frac95.5%
+-commutative95.5%
+-commutative95.5%
associate-+r+95.5%
+-commutative95.5%
associate-+l+95.5%
Applied egg-rr95.5%
*-commutative95.5%
clear-num95.5%
frac-times95.5%
*-un-lft-identity95.5%
+-commutative95.5%
associate-+r+95.5%
+-commutative95.5%
Applied egg-rr95.5%
*-un-lft-identity95.5%
*-commutative95.5%
times-frac95.4%
associate-/l*99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-lft-identity99.7%
associate-*r/95.5%
*-commutative95.5%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in x around inf 58.2%
if 4.6e-221 < y < 2.9999999999999999e187Initial program 75.2%
*-commutative75.2%
associate-*l*75.2%
times-frac93.5%
+-commutative93.5%
+-commutative93.5%
associate-+r+93.5%
+-commutative93.5%
associate-+l+93.5%
Applied egg-rr93.5%
Taylor expanded in y around inf 67.5%
if 2.9999999999999999e187 < y Initial program 64.1%
*-commutative64.1%
associate-*l*64.1%
times-frac79.2%
+-commutative79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
Applied egg-rr79.2%
clear-num79.2%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 91.8%
+-commutative91.8%
Simplified91.8%
Final simplification64.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.25e-186) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (* (/ (+ x y) y) (+ x (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.25e-186) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (((x + y) / y) * (x + (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 (y <= 1.25d-186) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.25e-186) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.25e-186: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (((x + y) / y) * (x + (y + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.25e-186) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * Float64(x + Float64(y + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.25e-186)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (((x + y) / y) * (x + (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[y, 1.25e-186], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{-186}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot \left(x + \left(y + 1\right)\right)}\\
\end{array}
\end{array}
if y < 1.25e-186Initial program 66.8%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
Taylor expanded in y around 0 57.8%
associate-/r*58.6%
+-commutative58.6%
Simplified58.6%
if 1.25e-186 < y Initial program 72.4%
*-commutative72.4%
associate-*l*72.4%
times-frac90.0%
+-commutative90.0%
+-commutative90.0%
associate-+r+90.0%
+-commutative90.0%
associate-+l+90.0%
Applied egg-rr90.0%
clear-num89.9%
associate-/r*99.7%
+-commutative99.7%
frac-times99.6%
*-un-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-+r+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 76.3%
Final simplification65.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e-14) (/ (/ y (+ x 1.0)) (+ x y)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e-14) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (y + 1.0)) / 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 <= (-2d-14)) then
tmp = (y / (x + 1.0d0)) / (x + y)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2e-14) {
tmp = (y / (x + 1.0)) / (x + y);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2e-14: tmp = (y / (x + 1.0)) / (x + y) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2e-14) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2e-14)
tmp = (y / (x + 1.0)) / (x + y);
else
tmp = (x / (y + 1.0)) / 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, -2e-14], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -2e-14Initial program 57.9%
*-commutative57.9%
associate-*l*57.9%
times-frac82.9%
+-commutative82.9%
+-commutative82.9%
associate-+r+82.9%
+-commutative82.9%
associate-+l+82.9%
Applied egg-rr82.9%
*-commutative82.9%
clear-num83.0%
frac-times81.5%
*-un-lft-identity81.5%
+-commutative81.5%
associate-+r+81.5%
+-commutative81.5%
Applied egg-rr81.5%
*-un-lft-identity81.5%
*-commutative81.5%
times-frac82.9%
associate-/l*98.8%
+-commutative98.8%
Applied egg-rr98.8%
associate-*l/98.7%
*-lft-identity98.7%
associate-*r/82.9%
*-commutative82.9%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in y around 0 80.5%
if -2e-14 < x Initial program 72.8%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
Simplified59.0%
*-un-lft-identity59.0%
times-frac58.0%
Applied egg-rr58.0%
associate-*l/58.2%
*-lft-identity58.2%
Simplified58.2%
Final simplification63.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.25e-186) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.25e-186) {
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 (y <= 1.25d-186) 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 (y <= 1.25e-186) {
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 y <= 1.25e-186: 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 (y <= 1.25e-186) 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 (y <= 1.25e-186)
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[y, 1.25e-186], 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}\;y \leq 1.25 \cdot 10^{-186}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.25e-186Initial program 66.8%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
Taylor expanded in y around 0 57.8%
if 1.25e-186 < y Initial program 72.4%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 57.5%
+-commutative57.5%
Simplified57.5%
Final simplification57.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.25e-186) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.25e-186) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / 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 (y <= 1.25d-186) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.25e-186) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.25e-186: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.25e-186) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.25e-186)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + 1.0)) / 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[y, 1.25e-186], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{-186}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.25e-186Initial program 66.8%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
Taylor expanded in y around 0 57.8%
if 1.25e-186 < y Initial program 72.4%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 57.5%
+-commutative57.5%
Simplified57.5%
*-un-lft-identity57.5%
times-frac59.9%
Applied egg-rr59.9%
associate-*l/59.9%
*-lft-identity59.9%
Simplified59.9%
Final simplification58.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8.5e-14) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.5e-14) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / 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 <= (-8.5d-14)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -8.5e-14) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8.5e-14: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8.5e-14) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -8.5e-14)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + 1.0)) / 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, -8.5e-14], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -8.50000000000000038e-14Initial program 57.9%
associate-/l*73.5%
associate-+l+73.5%
Simplified73.5%
Taylor expanded in y around 0 73.3%
associate-/r*80.0%
+-commutative80.0%
Simplified80.0%
if -8.50000000000000038e-14 < x Initial program 72.8%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
Simplified59.0%
*-un-lft-identity59.0%
times-frac58.0%
Applied egg-rr58.0%
associate-*l/58.2%
*-lft-identity58.2%
Simplified58.2%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
return x / (y * (y + 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 * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * (y + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * (y + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * Float64(y + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Initial program 69.1%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in x around 0 48.7%
+-commutative48.7%
Simplified48.7%
Final simplification48.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 (/ y x)))
assert(x < y);
double code(double x, double y) {
return 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 = 1.0d0 / (y / x)
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / (y / x);
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / (y / x)
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / Float64(y / x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / (y / x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 69.1%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in x around 0 48.7%
+-commutative48.7%
Simplified48.7%
*-un-lft-identity48.7%
times-frac48.6%
Applied egg-rr48.6%
Taylor expanded in y around 0 29.3%
associate-*l/29.4%
*-un-lft-identity29.4%
clear-num30.1%
Applied egg-rr30.1%
Final simplification30.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 69.1%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in x around 0 48.7%
+-commutative48.7%
Simplified48.7%
Taylor expanded in y around 0 29.4%
Final simplification29.4%
(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 2024112
(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))))