
(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 (+ x y)) (/ (+ x y) (/ y (+ y (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) / ((x + y) / (y / (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 / (x + y)) / ((x + y) / (y / (y + (x + 1.0d0))))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) / ((x + y) / (y / (y + (x + 1.0))));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) / ((x + y) / (y / (y + (x + 1.0))))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) / Float64(y / Float64(y + Float64(x + 1.0))))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) / ((x + y) / (y / (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[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\frac{x + y}{\frac{y}{y + \left(x + 1\right)}}}
\end{array}
Initial program 70.4%
associate-*l*70.4%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
clear-num92.7%
inv-pow92.7%
+-commutative92.7%
Applied egg-rr92.7%
unpow-192.7%
associate-/l*99.0%
Simplified99.0%
un-div-inv99.1%
+-commutative99.1%
Applied egg-rr99.1%
clear-num99.1%
div-inv99.2%
Applied egg-rr99.2%
Final simplification99.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))) (t_1 (* (+ x y) (/ t_0 y))))
(if (<= y -1.36e-117)
(/ 1.0 t_1)
(if (<= y 3.55e+112)
(* x (/ (/ y (+ x y)) (* (+ x y) t_0)))
(/ (/ x y) t_1)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (x + y) * (t_0 / y);
double tmp;
if (y <= -1.36e-117) {
tmp = 1.0 / t_1;
} else if (y <= 3.55e+112) {
tmp = x * ((y / (x + y)) / ((x + y) * t_0));
} else {
tmp = (x / y) / t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y + (x + 1.0d0)
t_1 = (x + y) * (t_0 / y)
if (y <= (-1.36d-117)) then
tmp = 1.0d0 / t_1
else if (y <= 3.55d+112) then
tmp = x * ((y / (x + y)) / ((x + y) * t_0))
else
tmp = (x / y) / t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (x + y) * (t_0 / y);
double tmp;
if (y <= -1.36e-117) {
tmp = 1.0 / t_1;
} else if (y <= 3.55e+112) {
tmp = x * ((y / (x + y)) / ((x + y) * t_0));
} else {
tmp = (x / y) / t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) t_1 = (x + y) * (t_0 / y) tmp = 0 if y <= -1.36e-117: tmp = 1.0 / t_1 elif y <= 3.55e+112: tmp = x * ((y / (x + y)) / ((x + y) * t_0)) else: tmp = (x / y) / t_1 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) t_1 = Float64(Float64(x + y) * Float64(t_0 / y)) tmp = 0.0 if (y <= -1.36e-117) tmp = Float64(1.0 / t_1); elseif (y <= 3.55e+112) tmp = Float64(x * Float64(Float64(y / Float64(x + y)) / Float64(Float64(x + y) * t_0))); else tmp = Float64(Float64(x / y) / t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
t_1 = (x + y) * (t_0 / y);
tmp = 0.0;
if (y <= -1.36e-117)
tmp = 1.0 / t_1;
elseif (y <= 3.55e+112)
tmp = x * ((y / (x + y)) / ((x + y) * t_0));
else
tmp = (x / y) / t_1;
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 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.36e-117], N[(1.0 / t$95$1), $MachinePrecision], If[LessEqual[y, 3.55e+112], N[(x * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
t_1 := \left(x + y\right) \cdot \frac{t\_0}{y}\\
\mathbf{if}\;y \leq -1.36 \cdot 10^{-117}:\\
\;\;\;\;\frac{1}{t\_1}\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{+112}:\\
\;\;\;\;x \cdot \frac{\frac{y}{x + y}}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_1}\\
\end{array}
\end{array}
if y < -1.35999999999999996e-117Initial program 79.7%
associate-*l*79.8%
times-frac95.4%
+-commutative95.4%
+-commutative95.4%
associate-+r+95.4%
+-commutative95.4%
associate-+l+95.4%
Applied egg-rr95.4%
clear-num95.4%
inv-pow95.4%
+-commutative95.4%
Applied egg-rr95.4%
unpow-195.4%
associate-/l*99.7%
Simplified99.7%
un-div-inv99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 34.4%
if -1.35999999999999996e-117 < y < 3.55e112Initial program 73.7%
associate-/l*83.9%
associate-+l+83.9%
Simplified83.9%
add-sqr-sqrt55.9%
associate-+r+55.9%
associate-*l*55.9%
times-frac64.1%
+-commutative64.1%
+-commutative64.1%
associate-+r+64.1%
+-commutative64.1%
associate-+l+64.1%
Applied egg-rr64.1%
associate-*r/64.2%
times-frac63.4%
+-commutative63.4%
Simplified63.4%
frac-times64.2%
Applied egg-rr64.2%
associate-*l/64.1%
rem-square-sqrt96.5%
Simplified96.5%
if 3.55e112 < y Initial program 40.2%
associate-*l*40.2%
times-frac71.1%
+-commutative71.1%
+-commutative71.1%
associate-+r+71.1%
+-commutative71.1%
associate-+l+71.1%
Applied egg-rr71.1%
clear-num71.1%
inv-pow71.1%
+-commutative71.1%
Applied egg-rr71.1%
unpow-171.1%
associate-/l*99.6%
Simplified99.6%
un-div-inv99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 90.4%
Final simplification74.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))) (t_1 (* (+ x y) (/ t_0 y))))
(if (<= y -1.35e-117)
(/ 1.0 t_1)
(if (<= y 6.9e+72)
(* x (/ (/ y (* (+ x y) t_0)) (+ x y)))
(/ (/ x y) t_1)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (x + y) * (t_0 / y);
double tmp;
if (y <= -1.35e-117) {
tmp = 1.0 / t_1;
} else if (y <= 6.9e+72) {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
} else {
tmp = (x / y) / t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = y + (x + 1.0d0)
t_1 = (x + y) * (t_0 / y)
if (y <= (-1.35d-117)) then
tmp = 1.0d0 / t_1
else if (y <= 6.9d+72) then
tmp = x * ((y / ((x + y) * t_0)) / (x + y))
else
tmp = (x / y) / t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (x + y) * (t_0 / y);
double tmp;
if (y <= -1.35e-117) {
tmp = 1.0 / t_1;
} else if (y <= 6.9e+72) {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
} else {
tmp = (x / y) / t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) t_1 = (x + y) * (t_0 / y) tmp = 0 if y <= -1.35e-117: tmp = 1.0 / t_1 elif y <= 6.9e+72: tmp = x * ((y / ((x + y) * t_0)) / (x + y)) else: tmp = (x / y) / t_1 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) t_1 = Float64(Float64(x + y) * Float64(t_0 / y)) tmp = 0.0 if (y <= -1.35e-117) tmp = Float64(1.0 / t_1); elseif (y <= 6.9e+72) tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + y))); else tmp = Float64(Float64(x / y) / t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
t_1 = (x + y) * (t_0 / y);
tmp = 0.0;
if (y <= -1.35e-117)
tmp = 1.0 / t_1;
elseif (y <= 6.9e+72)
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
else
tmp = (x / y) / t_1;
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 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e-117], N[(1.0 / t$95$1), $MachinePrecision], If[LessEqual[y, 6.9e+72], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
t_1 := \left(x + y\right) \cdot \frac{t\_0}{y}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{-117}:\\
\;\;\;\;\frac{1}{t\_1}\\
\mathbf{elif}\;y \leq 6.9 \cdot 10^{+72}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_1}\\
\end{array}
\end{array}
if y < -1.35000000000000001e-117Initial program 79.7%
associate-*l*79.8%
times-frac95.4%
+-commutative95.4%
+-commutative95.4%
associate-+r+95.4%
+-commutative95.4%
associate-+l+95.4%
Applied egg-rr95.4%
clear-num95.4%
inv-pow95.4%
+-commutative95.4%
Applied egg-rr95.4%
unpow-195.4%
associate-/l*99.7%
Simplified99.7%
un-div-inv99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 34.4%
if -1.35000000000000001e-117 < y < 6.90000000000000034e72Initial program 73.5%
associate-/l*84.2%
associate-+l+84.2%
Simplified84.2%
*-un-lft-identity84.2%
associate-+r+84.2%
associate-*l*84.2%
times-frac96.7%
+-commutative96.7%
+-commutative96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
Applied egg-rr96.7%
associate-*l/96.8%
*-lft-identity96.8%
+-commutative96.8%
Simplified96.8%
if 6.90000000000000034e72 < y Initial program 45.7%
associate-*l*45.7%
times-frac74.1%
+-commutative74.1%
+-commutative74.1%
associate-+r+74.1%
+-commutative74.1%
associate-+l+74.1%
Applied egg-rr74.1%
clear-num74.2%
inv-pow74.2%
+-commutative74.2%
Applied egg-rr74.2%
unpow-174.2%
associate-/l*98.5%
Simplified98.5%
un-div-inv98.6%
+-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 88.7%
Final simplification73.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 2.1e+79)
(* (/ x (+ x y)) (/ y (* (+ x y) t_0)))
(/ (/ x y) (* (+ x y) (/ t_0 y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 2.1e+79) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = (x / y) / ((x + y) * (t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 2.1d+79) then
tmp = (x / (x + y)) * (y / ((x + y) * t_0))
else
tmp = (x / y) / ((x + y) * (t_0 / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 2.1e+79) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = (x / y) / ((x + y) * (t_0 / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 2.1e+79: tmp = (x / (x + y)) * (y / ((x + y) * t_0)) else: tmp = (x / y) / ((x + y) * (t_0 / y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 2.1e+79) tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * t_0))); else tmp = Float64(Float64(x / y) / Float64(Float64(x + y) * Float64(t_0 / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 2.1e+79)
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
else
tmp = (x / y) / ((x + y) * (t_0 / 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 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.1e+79], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) \cdot \frac{t\_0}{y}}\\
\end{array}
\end{array}
if y < 2.10000000000000008e79Initial program 76.1%
associate-*l*76.1%
times-frac97.5%
+-commutative97.5%
+-commutative97.5%
associate-+r+97.5%
+-commutative97.5%
associate-+l+97.5%
Applied egg-rr97.5%
if 2.10000000000000008e79 < y Initial program 45.7%
associate-*l*45.7%
times-frac74.1%
+-commutative74.1%
+-commutative74.1%
associate-+r+74.1%
+-commutative74.1%
associate-+l+74.1%
Applied egg-rr74.1%
clear-num74.2%
inv-pow74.2%
+-commutative74.2%
Applied egg-rr74.2%
unpow-174.2%
associate-/l*98.5%
Simplified98.5%
un-div-inv98.6%
+-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 88.7%
Final simplification95.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8.2e-5) (/ y (* (+ x y) (+ y (+ x 1.0)))) (/ (/ x (+ x y)) (* (+ x y) (/ (+ y 1.0) y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.2e-5) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((x + y) * ((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.2d-5)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / ((x + y) * ((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.2e-5) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8.2e-5: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8.2e-5) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) * Float64(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.2e-5)
tmp = y / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (x + y)) / ((x + y) * ((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.2e-5], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{y}}\\
\end{array}
\end{array}
if x < -8.20000000000000009e-5Initial program 69.7%
associate-*l*69.7%
times-frac86.6%
+-commutative86.6%
+-commutative86.6%
associate-+r+86.6%
+-commutative86.6%
associate-+l+86.6%
Applied egg-rr86.6%
Taylor expanded in x around inf 80.9%
if -8.20000000000000009e-5 < x Initial program 70.7%
associate-*l*70.7%
times-frac95.3%
+-commutative95.3%
+-commutative95.3%
associate-+r+95.3%
+-commutative95.3%
associate-+l+95.3%
Applied egg-rr95.3%
clear-num94.8%
inv-pow94.8%
+-commutative94.8%
Applied egg-rr94.8%
unpow-194.8%
associate-/l*99.2%
Simplified99.2%
un-div-inv99.3%
+-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 86.1%
+-commutative86.1%
Simplified86.1%
Final simplification84.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -2.35e-189)
(/ y (* (+ x y) t_0))
(/ (/ x y) (* (+ x y) (/ t_0 y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -2.35e-189) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / y) / ((x + y) * (t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-2.35d-189)) then
tmp = y / ((x + y) * t_0)
else
tmp = (x / y) / ((x + y) * (t_0 / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -2.35e-189) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / y) / ((x + y) * (t_0 / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -2.35e-189: tmp = y / ((x + y) * t_0) else: tmp = (x / y) / ((x + y) * (t_0 / y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -2.35e-189) tmp = Float64(y / Float64(Float64(x + y) * t_0)); else tmp = Float64(Float64(x / y) / Float64(Float64(x + y) * Float64(t_0 / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -2.35e-189)
tmp = y / ((x + y) * t_0);
else
tmp = (x / y) / ((x + y) * (t_0 / 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 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.35e-189], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -2.35 \cdot 10^{-189}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) \cdot \frac{t\_0}{y}}\\
\end{array}
\end{array}
if x < -2.3499999999999998e-189Initial program 75.9%
associate-*l*75.9%
times-frac91.7%
+-commutative91.7%
+-commutative91.7%
associate-+r+91.7%
+-commutative91.7%
associate-+l+91.7%
Applied egg-rr91.7%
Taylor expanded in x around inf 72.5%
if -2.3499999999999998e-189 < x Initial program 66.7%
associate-*l*66.7%
times-frac94.2%
+-commutative94.2%
+-commutative94.2%
associate-+r+94.2%
+-commutative94.2%
associate-+l+94.2%
Applied egg-rr94.2%
clear-num93.6%
inv-pow93.6%
+-commutative93.6%
Applied egg-rr93.6%
unpow-193.6%
associate-/l*99.2%
Simplified99.2%
un-div-inv99.2%
+-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 62.9%
Final simplification66.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ x (+ x y)) (* (+ x y) (/ (+ y (+ x 1.0)) y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((y + (x + 1.0)) / 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 / (x + y)) / ((x + y) * ((y + (x + 1.0d0)) / y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((y + (x + 1.0)) / y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) / ((x + y) * ((y + (x + 1.0)) / y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(y + Float64(x + 1.0)) / y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) / ((x + y) * ((y + (x + 1.0)) / y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{y + \left(x + 1\right)}{y}}
\end{array}
Initial program 70.4%
associate-*l*70.4%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
clear-num92.7%
inv-pow92.7%
+-commutative92.7%
Applied egg-rr92.7%
unpow-192.7%
associate-/l*99.0%
Simplified99.0%
un-div-inv99.1%
+-commutative99.1%
Applied egg-rr99.1%
Final simplification99.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.35e-189) (/ y (* (+ x y) (+ y (+ x 1.0)))) (* (/ x (+ x y)) (/ 1.0 (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.35e-189) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) * (1.0 / (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 <= (-2.35d-189)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) * (1.0d0 / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.35e-189) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.35e-189: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.35e-189) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(1.0 / 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 <= -2.35e-189)
tmp = y / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (x + y)) * (1.0 / (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, -2.35e-189], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-189}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -2.3499999999999998e-189Initial program 75.9%
associate-*l*75.9%
times-frac91.7%
+-commutative91.7%
+-commutative91.7%
associate-+r+91.7%
+-commutative91.7%
associate-+l+91.7%
Applied egg-rr91.7%
Taylor expanded in x around inf 72.5%
if -2.3499999999999998e-189 < x Initial program 66.7%
associate-*l*66.7%
times-frac94.2%
+-commutative94.2%
+-commutative94.2%
associate-+r+94.2%
+-commutative94.2%
associate-+l+94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 56.1%
+-commutative56.1%
Simplified56.1%
Final simplification62.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.2e-128) (/ (/ 1.0 x) (/ (+ y (+ x 1.0)) y)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.2e-128) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} 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 <= (-5.2d-128)) then
tmp = (1.0d0 / x) / ((y + (x + 1.0d0)) / y)
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 <= -5.2e-128) {
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.2e-128: tmp = (1.0 / x) / ((y + (x + 1.0)) / y) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.2e-128) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + Float64(x + 1.0)) / y)); 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 <= -5.2e-128)
tmp = (1.0 / x) / ((y + (x + 1.0)) / y);
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, -5.2e-128], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $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 -5.2 \cdot 10^{-128}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + \left(x + 1\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -5.19999999999999961e-128Initial program 76.1%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
clear-num82.4%
associate-+r+82.4%
*-commutative82.4%
distribute-rgt1-in49.8%
cube-mult49.8%
un-div-inv49.9%
cube-mult49.9%
distribute-rgt1-in82.5%
*-commutative82.5%
associate-/l*84.6%
pow284.6%
+-commutative84.6%
Applied egg-rr84.6%
associate-/r*90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in x around inf 64.4%
if -5.19999999999999961e-128 < x Initial program 67.5%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in x around 0 55.2%
associate-/r*55.2%
+-commutative55.2%
Simplified55.2%
associate-/l/55.2%
*-commutative55.2%
div-inv55.2%
associate-/r*57.1%
Applied egg-rr57.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.5e-128) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.5e-128) {
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 <= (-4.5d-128)) 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 <= -4.5e-128) {
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 <= -4.5e-128: 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 <= -4.5e-128) 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 <= -4.5e-128)
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, -4.5e-128], 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 -4.5 \cdot 10^{-128}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.4999999999999999e-128Initial program 76.1%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in y around 0 63.0%
associate-/r*63.9%
+-commutative63.9%
Simplified63.9%
if -4.4999999999999999e-128 < x Initial program 67.5%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in x around 0 55.2%
associate-/r*55.2%
+-commutative55.2%
Simplified55.2%
associate-/l/55.2%
*-commutative55.2%
div-inv55.2%
associate-/r*57.1%
Applied egg-rr57.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.2e-128) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.2e-128) {
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 <= (-5.2d-128)) 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 <= -5.2e-128) {
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 <= -5.2e-128: 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 <= -5.2e-128) 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 <= -5.2e-128)
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, -5.2e-128], 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 -5.2 \cdot 10^{-128}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -5.19999999999999961e-128Initial program 76.1%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in y around 0 63.0%
if -5.19999999999999961e-128 < x Initial program 67.5%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in x around 0 55.2%
associate-/r*55.2%
+-commutative55.2%
Simplified55.2%
associate-/l/55.2%
*-commutative55.2%
div-inv55.2%
associate-/r*57.1%
Applied egg-rr57.1%
Final simplification59.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.1e-128) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.1e-128) {
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 <= (-4.1d-128)) 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 <= -4.1e-128) {
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 <= -4.1e-128: 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 <= -4.1e-128) 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 <= -4.1e-128)
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, -4.1e-128], 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 -4.1 \cdot 10^{-128}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -4.1e-128Initial program 76.1%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in y around 0 63.0%
if -4.1e-128 < x Initial program 67.5%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in x around 0 55.2%
+-commutative55.2%
Simplified55.2%
Final simplification57.9%
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 70.4%
associate-/l*81.6%
associate-+l+81.6%
Simplified81.6%
Taylor expanded in x around 0 46.2%
+-commutative46.2%
Simplified46.2%
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 70.4%
associate-/l*81.6%
associate-+l+81.6%
Simplified81.6%
Taylor expanded in x around 0 46.2%
+-commutative46.2%
Simplified46.2%
Taylor expanded in y around 0 25.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
return 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 = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
return 1.0;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0
x, y = sort([x, y]) function code(x, y) return 1.0 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Initial program 70.4%
associate-*l*70.4%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
Taylor expanded in y around 0 50.1%
Taylor expanded in x around 0 3.6%
(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 2024102
(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))))