
(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 19 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) (/ (+ y (+ x 1.0)) y))) (+ x y)))
assert(x < y);
double code(double x, double y) {
return (x / ((x + y) * ((y + (x + 1.0)) / y))) / (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 / ((x + y) * ((y + (x + 1.0d0)) / y))) / (x + y)
end function
assert x < y;
public static double code(double x, double y) {
return (x / ((x + y) * ((y + (x + 1.0)) / y))) / (x + y);
}
[x, y] = sort([x, y]) def code(x, y): return (x / ((x + y) * ((y + (x + 1.0)) / y))) / (x + y)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(Float64(x + y) * Float64(Float64(y + Float64(x + 1.0)) / y))) / Float64(x + y)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / ((x + y) * ((y + (x + 1.0)) / y))) / (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[(x + y), $MachinePrecision] * N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{\left(x + y\right) \cdot \frac{y + \left(x + 1\right)}{y}}}{x + y}
\end{array}
Initial program 64.4%
associate-*l*64.4%
times-frac91.8%
+-commutative91.8%
+-commutative91.8%
associate-+r+91.8%
+-commutative91.8%
associate-+l+91.8%
Applied egg-rr91.8%
clear-num91.5%
inv-pow91.5%
+-commutative91.5%
Applied egg-rr91.5%
unpow-191.5%
associate-/l*99.4%
Simplified99.4%
associate-*l/99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Final simplification99.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.3e-5)
(/ (/ x (* (+ x y) (/ (+ x 1.0) y))) (+ x y))
(if (<= y 2.12e+92)
(* x (/ y (* (* (+ x y) (+ x y)) (+ x (+ y 1.0)))))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.3e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 2.12e+92) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = (x / (x + y)) / (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 (y <= 1.3d-5) then
tmp = (x / ((x + y) * ((x + 1.0d0) / y))) / (x + y)
else if (y <= 2.12d+92) then
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0d0))))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.3e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 2.12e+92) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.3e-5: tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y) elif y <= 2.12e+92: tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0)))) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.3e-5) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(Float64(x + 1.0) / y))) / Float64(x + y)); elseif (y <= 2.12e+92) tmp = Float64(x * Float64(y / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.3e-5)
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
elseif (y <= 2.12e+92)
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
else
tmp = (x / (x + y)) / (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[y, 1.3e-5], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.12e+92], N[(x * N[(y / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{x}{\left(x + y\right) \cdot \frac{x + 1}{y}}}{x + y}\\
\mathbf{elif}\;y \leq 2.12 \cdot 10^{+92}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.29999999999999992e-5Initial program 66.3%
associate-*l*66.3%
times-frac93.7%
+-commutative93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
Applied egg-rr93.7%
clear-num93.4%
inv-pow93.4%
+-commutative93.4%
Applied egg-rr93.4%
unpow-193.4%
associate-/l*99.4%
Simplified99.4%
associate-*l/99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 85.7%
+-commutative85.7%
Simplified85.7%
if 1.29999999999999992e-5 < y < 2.11999999999999999e92Initial program 77.3%
associate-/l*86.7%
associate-+l+86.7%
Simplified86.7%
if 2.11999999999999999e92 < y Initial program 52.8%
associate-*l*52.8%
times-frac85.3%
+-commutative85.3%
+-commutative85.3%
associate-+r+85.3%
+-commutative85.3%
associate-+l+85.3%
Applied egg-rr85.3%
clear-num85.3%
inv-pow85.3%
+-commutative85.3%
Applied egg-rr85.3%
unpow-185.3%
associate-/l*99.2%
Simplified99.2%
associate-*l/99.3%
un-div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 84.9%
Final simplification85.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.3e-5)
(/ (/ x (* (+ x y) (/ (+ x 1.0) y))) (+ x y))
(if (<= y 1.6e+154)
(* x (/ (/ y (* (+ x y) (+ y (+ x 1.0)))) (+ x y)))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.3e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 1.6e+154) {
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
} else {
tmp = (x / (x + y)) / (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 (y <= 1.3d-5) then
tmp = (x / ((x + y) * ((x + 1.0d0) / y))) / (x + y)
else if (y <= 1.6d+154) then
tmp = x * ((y / ((x + y) * (y + (x + 1.0d0)))) / (x + y))
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.3e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 1.6e+154) {
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.3e-5: tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y) elif y <= 1.6e+154: tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y)) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.3e-5) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(Float64(x + 1.0) / y))) / Float64(x + y)); elseif (y <= 1.6e+154) tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))) / Float64(x + y))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.3e-5)
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
elseif (y <= 1.6e+154)
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
else
tmp = (x / (x + y)) / (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[y, 1.3e-5], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+154], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{x}{\left(x + y\right) \cdot \frac{x + 1}{y}}}{x + y}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.29999999999999992e-5Initial program 66.3%
associate-*l*66.3%
times-frac93.7%
+-commutative93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
Applied egg-rr93.7%
clear-num93.4%
inv-pow93.4%
+-commutative93.4%
Applied egg-rr93.4%
unpow-193.4%
associate-/l*99.4%
Simplified99.4%
associate-*l/99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 85.7%
+-commutative85.7%
Simplified85.7%
if 1.29999999999999992e-5 < y < 1.6e154Initial program 57.1%
associate-/l*67.9%
associate-+l+67.9%
Simplified67.9%
*-un-lft-identity67.9%
associate-+r+67.9%
associate-*l*67.9%
times-frac92.3%
+-commutative92.3%
+-commutative92.3%
associate-+r+92.3%
+-commutative92.3%
associate-+l+92.3%
Applied egg-rr92.3%
associate-*l/92.4%
*-lft-identity92.4%
+-commutative92.4%
Simplified92.4%
if 1.6e154 < y Initial program 62.3%
associate-*l*62.3%
times-frac81.6%
+-commutative81.6%
+-commutative81.6%
associate-+r+81.6%
+-commutative81.6%
associate-+l+81.6%
Applied egg-rr81.6%
clear-num81.6%
inv-pow81.6%
+-commutative81.6%
Applied egg-rr81.6%
unpow-181.6%
associate-/l*99.2%
Simplified99.2%
associate-*l/99.1%
un-div-inv99.1%
Applied egg-rr99.1%
Taylor expanded in y around inf 92.2%
Final simplification87.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= y -1.05e+142)
(/ (/ x (* (+ x y) (/ (+ x 1.0) y))) (+ x y))
(if (<= y 1.35e+154)
(* t_0 (/ y (* (+ x y) (+ y (+ x 1.0)))))
(/ t_0 (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= -1.05e+142) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 1.35e+154) {
tmp = t_0 * (y / ((x + y) * (y + (x + 1.0))));
} else {
tmp = t_0 / (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) :: t_0
real(8) :: tmp
t_0 = x / (x + y)
if (y <= (-1.05d+142)) then
tmp = (x / ((x + y) * ((x + 1.0d0) / y))) / (x + y)
else if (y <= 1.35d+154) then
tmp = t_0 * (y / ((x + y) * (y + (x + 1.0d0))))
else
tmp = t_0 / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= -1.05e+142) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 1.35e+154) {
tmp = t_0 * (y / ((x + y) * (y + (x + 1.0))));
} else {
tmp = t_0 / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= -1.05e+142: tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y) elif y <= 1.35e+154: tmp = t_0 * (y / ((x + y) * (y + (x + 1.0)))) else: tmp = t_0 / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (y <= -1.05e+142) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(Float64(x + 1.0) / y))) / Float64(x + y)); elseif (y <= 1.35e+154) tmp = Float64(t_0 * Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0))))); else tmp = Float64(t_0 / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
tmp = 0.0;
if (y <= -1.05e+142)
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
elseif (y <= 1.35e+154)
tmp = t_0 * (y / ((x + y) * (y + (x + 1.0))));
else
tmp = t_0 / (x + 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[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e+142], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(t$95$0 * N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{+142}:\\
\;\;\;\;\frac{\frac{x}{\left(x + y\right) \cdot \frac{x + 1}{y}}}{x + y}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x + y}\\
\end{array}
\end{array}
if y < -1.05e142Initial program 56.4%
associate-*l*56.4%
times-frac70.6%
+-commutative70.6%
+-commutative70.6%
associate-+r+70.6%
+-commutative70.6%
associate-+l+70.6%
Applied egg-rr70.6%
clear-num70.6%
inv-pow70.6%
+-commutative70.6%
Applied egg-rr70.6%
unpow-170.6%
associate-/l*99.5%
Simplified99.5%
associate-*l/99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 51.7%
+-commutative51.7%
Simplified51.7%
if -1.05e142 < y < 1.35000000000000003e154Initial program 66.2%
associate-*l*66.2%
times-frac97.4%
+-commutative97.4%
+-commutative97.4%
associate-+r+97.4%
+-commutative97.4%
associate-+l+97.4%
Applied egg-rr97.4%
if 1.35000000000000003e154 < y Initial program 62.3%
associate-*l*62.3%
times-frac81.6%
+-commutative81.6%
+-commutative81.6%
associate-+r+81.6%
+-commutative81.6%
associate-+l+81.6%
Applied egg-rr81.6%
clear-num81.6%
inv-pow81.6%
+-commutative81.6%
Applied egg-rr81.6%
unpow-181.6%
associate-/l*99.2%
Simplified99.2%
associate-*l/99.1%
un-div-inv99.1%
Applied egg-rr99.1%
Taylor expanded in y around inf 92.2%
Final simplification90.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.9e-5)
(/ (/ x (* (+ x y) (/ (+ x 1.0) y))) (+ x y))
(if (<= y 2.3e+136)
(* (/ y (* (+ x y) (+ y (+ x 1.0)))) (/ x y))
(/ (/ x (+ x y)) (+ x y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 2.3e+136) {
tmp = (y / ((x + y) * (y + (x + 1.0)))) * (x / y);
} else {
tmp = (x / (x + y)) / (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 (y <= 1.9d-5) then
tmp = (x / ((x + y) * ((x + 1.0d0) / y))) / (x + y)
else if (y <= 2.3d+136) then
tmp = (y / ((x + y) * (y + (x + 1.0d0)))) * (x / y)
else
tmp = (x / (x + y)) / (x + y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.9e-5) {
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
} else if (y <= 2.3e+136) {
tmp = (y / ((x + y) * (y + (x + 1.0)))) * (x / y);
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.9e-5: tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y) elif y <= 2.3e+136: tmp = (y / ((x + y) * (y + (x + 1.0)))) * (x / y) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.9e-5) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(Float64(x + 1.0) / y))) / Float64(x + y)); elseif (y <= 2.3e+136) tmp = Float64(Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))) * Float64(x / y)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.9e-5)
tmp = (x / ((x + y) * ((x + 1.0) / y))) / (x + y);
elseif (y <= 2.3e+136)
tmp = (y / ((x + y) * (y + (x + 1.0)))) * (x / y);
else
tmp = (x / (x + y)) / (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[y, 1.9e-5], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+136], N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{x}{\left(x + y\right) \cdot \frac{x + 1}{y}}}{x + y}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+136}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.9000000000000001e-5Initial program 66.3%
associate-*l*66.3%
times-frac93.7%
+-commutative93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
Applied egg-rr93.7%
clear-num93.4%
inv-pow93.4%
+-commutative93.4%
Applied egg-rr93.4%
unpow-193.4%
associate-/l*99.4%
Simplified99.4%
associate-*l/99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 85.7%
+-commutative85.7%
Simplified85.7%
if 1.9000000000000001e-5 < y < 2.3e136Initial program 58.3%
associate-*l*58.3%
times-frac91.2%
+-commutative91.2%
+-commutative91.2%
associate-+r+91.2%
+-commutative91.2%
associate-+l+91.2%
Applied egg-rr91.2%
Taylor expanded in x around 0 82.4%
if 2.3e136 < y Initial program 60.8%
associate-*l*60.8%
times-frac83.7%
+-commutative83.7%
+-commutative83.7%
associate-+r+83.7%
+-commutative83.7%
associate-+l+83.7%
Applied egg-rr83.7%
clear-num83.7%
inv-pow83.7%
+-commutative83.7%
Applied egg-rr83.7%
unpow-183.7%
associate-/l*99.2%
Simplified99.2%
associate-*l/99.2%
un-div-inv99.2%
Applied egg-rr99.2%
Taylor expanded in y around inf 92.1%
Final simplification86.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -9.5e+29)
(/ (/ y x) (+ x y))
(if (or (<= x -1.55e-58) (not (<= x -2.6e-152)))
(/ (/ x y) (+ y 1.0))
(/ y (* x (+ y (+ x 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e+29) {
tmp = (y / x) / (x + y);
} else if ((x <= -1.55e-58) || !(x <= -2.6e-152)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (y + (x + 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 <= (-9.5d+29)) then
tmp = (y / x) / (x + y)
else if ((x <= (-1.55d-58)) .or. (.not. (x <= (-2.6d-152)))) then
tmp = (x / y) / (y + 1.0d0)
else
tmp = y / (x * (y + (x + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e+29) {
tmp = (y / x) / (x + y);
} else if ((x <= -1.55e-58) || !(x <= -2.6e-152)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (y + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e+29: tmp = (y / x) / (x + y) elif (x <= -1.55e-58) or not (x <= -2.6e-152): tmp = (x / y) / (y + 1.0) else: tmp = y / (x * (y + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e+29) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif ((x <= -1.55e-58) || !(x <= -2.6e-152)) tmp = Float64(Float64(x / y) / Float64(y + 1.0)); else tmp = Float64(y / Float64(x * Float64(y + Float64(x + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e+29)
tmp = (y / x) / (x + y);
elseif ((x <= -1.55e-58) || ~((x <= -2.6e-152)))
tmp = (x / y) / (y + 1.0);
else
tmp = y / (x * (y + (x + 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, -9.5e+29], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.55e-58], N[Not[LessEqual[x, -2.6e-152]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-58} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if x < -9.5000000000000003e29Initial program 59.6%
associate-*l*59.6%
times-frac82.4%
+-commutative82.4%
+-commutative82.4%
associate-+r+82.4%
+-commutative82.4%
associate-+l+82.4%
Applied egg-rr82.4%
clear-num82.4%
inv-pow82.4%
+-commutative82.4%
Applied egg-rr82.4%
unpow-182.4%
associate-/l*99.5%
Simplified99.5%
associate-*l/99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.9%
if -9.5000000000000003e29 < x < -1.55e-58 or -2.60000000000000013e-152 < x Initial program 64.3%
associate-*l*64.3%
times-frac93.8%
+-commutative93.8%
+-commutative93.8%
associate-+r+93.8%
+-commutative93.8%
associate-+l+93.8%
Applied egg-rr93.8%
Taylor expanded in x around 0 59.8%
associate-/r*61.2%
+-commutative61.2%
Simplified61.2%
if -1.55e-58 < x < -2.60000000000000013e-152Initial program 78.0%
associate-/l*99.7%
associate-+l+99.7%
Simplified99.7%
associate-*r/78.0%
associate-+r+78.0%
associate-/r*78.0%
clear-num78.0%
associate-+r+78.0%
+-commutative78.0%
associate-+l+78.0%
*-commutative78.0%
associate-/l*99.8%
pow299.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 47.1%
+-commutative47.1%
clear-num47.2%
*-un-lft-identity47.2%
Applied egg-rr47.2%
*-lft-identity47.2%
associate-/l/47.3%
*-commutative47.3%
+-commutative47.3%
+-commutative47.3%
+-commutative47.3%
Simplified47.3%
Final simplification64.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (or (<= x -3.6e+30) (and (not (<= x -1.75e-57)) (<= x -2.6e-152))) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if ((x <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152))) {
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 <= (-3.6d+30)) .or. (.not. (x <= (-1.75d-57))) .and. (x <= (-2.6d-152))) 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 <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152))) {
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 <= -3.6e+30) or (not (x <= -1.75e-57) and (x <= -2.6e-152)): 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 <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152))) 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 <= -3.6e+30) || (~((x <= -1.75e-57)) && (x <= -2.6e-152)))
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[Or[LessEqual[x, -3.6e+30], And[N[Not[LessEqual[x, -1.75e-57]], $MachinePrecision], LessEqual[x, -2.6e-152]]], 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 -3.6 \cdot 10^{+30} \lor \neg \left(x \leq -1.75 \cdot 10^{-57}\right) \land x \leq -2.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3.6000000000000002e30 or -1.74999999999999996e-57 < x < -2.60000000000000013e-152Initial program 64.7%
associate-/l*74.8%
associate-+l+74.8%
Simplified74.8%
Taylor expanded in y around 0 64.3%
if -3.6000000000000002e30 < x < -1.74999999999999996e-57 or -2.60000000000000013e-152 < x Initial program 64.3%
associate-*l*64.3%
times-frac93.8%
+-commutative93.8%
+-commutative93.8%
associate-+r+93.8%
+-commutative93.8%
associate-+l+93.8%
Applied egg-rr93.8%
Taylor expanded in x around 0 59.8%
associate-/r*61.2%
+-commutative61.2%
Simplified61.2%
Final simplification62.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.35e+30)
(/ (/ y x) (+ x y))
(if (or (<= x -8.2e-59) (not (<= x -2.6e-152)))
(/ (/ x y) (+ y 1.0))
(/ y (* x (+ x 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.35e+30) {
tmp = (y / x) / (x + y);
} else if ((x <= -8.2e-59) || !(x <= -2.6e-152)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (x + 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.35d+30)) then
tmp = (y / x) / (x + y)
else if ((x <= (-8.2d-59)) .or. (.not. (x <= (-2.6d-152)))) then
tmp = (x / y) / (y + 1.0d0)
else
tmp = y / (x * (x + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.35e+30) {
tmp = (y / x) / (x + y);
} else if ((x <= -8.2e-59) || !(x <= -2.6e-152)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.35e+30: tmp = (y / x) / (x + y) elif (x <= -8.2e-59) or not (x <= -2.6e-152): tmp = (x / y) / (y + 1.0) else: tmp = y / (x * (x + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.35e+30) tmp = Float64(Float64(y / x) / Float64(x + y)); elseif ((x <= -8.2e-59) || !(x <= -2.6e-152)) tmp = Float64(Float64(x / y) / Float64(y + 1.0)); else tmp = Float64(y / Float64(x * Float64(x + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.35e+30)
tmp = (y / x) / (x + y);
elseif ((x <= -8.2e-59) || ~((x <= -2.6e-152)))
tmp = (x / y) / (y + 1.0);
else
tmp = y / (x * (x + 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.35e+30], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -8.2e-59], N[Not[LessEqual[x, -2.6e-152]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+30}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-59} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -1.3499999999999999e30Initial program 59.6%
associate-*l*59.6%
times-frac82.4%
+-commutative82.4%
+-commutative82.4%
associate-+r+82.4%
+-commutative82.4%
associate-+l+82.4%
Applied egg-rr82.4%
clear-num82.4%
inv-pow82.4%
+-commutative82.4%
Applied egg-rr82.4%
unpow-182.4%
associate-/l*99.5%
Simplified99.5%
associate-*l/99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.9%
if -1.3499999999999999e30 < x < -8.1999999999999991e-59 or -2.60000000000000013e-152 < x Initial program 64.3%
associate-*l*64.3%
times-frac93.8%
+-commutative93.8%
+-commutative93.8%
associate-+r+93.8%
+-commutative93.8%
associate-+l+93.8%
Applied egg-rr93.8%
Taylor expanded in x around 0 59.8%
associate-/r*61.2%
+-commutative61.2%
Simplified61.2%
if -8.1999999999999991e-59 < x < -2.60000000000000013e-152Initial program 78.0%
associate-/l*99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in y around 0 47.0%
Final simplification64.0%
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 -3.7e+102)
(/ 1.0 (/ t_0 (/ y x)))
(if (<= x -3.95e-224)
(/ y (* (+ x y) t_0))
(* (/ x (+ x y)) (/ 1.0 (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -3.7e+102) {
tmp = 1.0 / (t_0 / (y / x));
} else if (x <= -3.95e-224) {
tmp = y / ((x + y) * t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-3.7d+102)) then
tmp = 1.0d0 / (t_0 / (y / x))
else if (x <= (-3.95d-224)) then
tmp = y / ((x + y) * t_0)
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 t_0 = y + (x + 1.0);
double tmp;
if (x <= -3.7e+102) {
tmp = 1.0 / (t_0 / (y / x));
} else if (x <= -3.95e-224) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / (x + y)) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -3.7e+102: tmp = 1.0 / (t_0 / (y / x)) elif x <= -3.95e-224: tmp = y / ((x + y) * t_0) else: tmp = (x / (x + y)) * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -3.7e+102) tmp = Float64(1.0 / Float64(t_0 / Float64(y / x))); elseif (x <= -3.95e-224) tmp = Float64(y / Float64(Float64(x + y) * t_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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -3.7e+102)
tmp = 1.0 / (t_0 / (y / x));
elseif (x <= -3.95e-224)
tmp = y / ((x + y) * t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+102], N[(1.0 / N[(t$95$0 / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.95e-224], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+102}:\\
\;\;\;\;\frac{1}{\frac{t\_0}{\frac{y}{x}}}\\
\mathbf{elif}\;x \leq -3.95 \cdot 10^{-224}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -3.70000000000000023e102Initial program 60.2%
associate-/l*66.0%
associate-+l+66.0%
Simplified66.0%
associate-*r/60.2%
associate-+r+60.2%
associate-/r*73.5%
clear-num73.5%
associate-+r+73.5%
+-commutative73.5%
associate-+l+73.5%
*-commutative73.5%
associate-/l*81.2%
pow281.2%
+-commutative81.2%
Applied egg-rr81.2%
Taylor expanded in y around 0 84.7%
if -3.70000000000000023e102 < x < -3.9499999999999999e-224Initial program 72.5%
associate-*l*72.5%
times-frac97.9%
+-commutative97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l+97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 65.2%
if -3.9499999999999999e-224 < x Initial program 63.0%
associate-*l*63.0%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 59.5%
+-commutative59.5%
Simplified59.5%
Final simplification65.4%
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 -3.7e+102)
(/ 1.0 (/ t_0 (* y (/ 1.0 x))))
(if (<= x -3.95e-224)
(/ y (* (+ x y) t_0))
(* (/ x (+ x y)) (/ 1.0 (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -3.7e+102) {
tmp = 1.0 / (t_0 / (y * (1.0 / x)));
} else if (x <= -3.95e-224) {
tmp = y / ((x + y) * t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-3.7d+102)) then
tmp = 1.0d0 / (t_0 / (y * (1.0d0 / x)))
else if (x <= (-3.95d-224)) then
tmp = y / ((x + y) * t_0)
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 t_0 = y + (x + 1.0);
double tmp;
if (x <= -3.7e+102) {
tmp = 1.0 / (t_0 / (y * (1.0 / x)));
} else if (x <= -3.95e-224) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / (x + y)) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -3.7e+102: tmp = 1.0 / (t_0 / (y * (1.0 / x))) elif x <= -3.95e-224: tmp = y / ((x + y) * t_0) else: tmp = (x / (x + y)) * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -3.7e+102) tmp = Float64(1.0 / Float64(t_0 / Float64(y * Float64(1.0 / x)))); elseif (x <= -3.95e-224) tmp = Float64(y / Float64(Float64(x + y) * t_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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -3.7e+102)
tmp = 1.0 / (t_0 / (y * (1.0 / x)));
elseif (x <= -3.95e-224)
tmp = y / ((x + y) * t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+102], N[(1.0 / N[(t$95$0 / N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.95e-224], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+102}:\\
\;\;\;\;\frac{1}{\frac{t\_0}{y \cdot \frac{1}{x}}}\\
\mathbf{elif}\;x \leq -3.95 \cdot 10^{-224}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -3.70000000000000023e102Initial program 60.2%
associate-/l*66.0%
associate-+l+66.0%
Simplified66.0%
associate-*r/60.2%
associate-+r+60.2%
associate-/r*73.5%
clear-num73.5%
associate-+r+73.5%
+-commutative73.5%
associate-+l+73.5%
*-commutative73.5%
associate-/l*81.2%
pow281.2%
+-commutative81.2%
Applied egg-rr81.2%
Taylor expanded in x around inf 84.7%
if -3.70000000000000023e102 < x < -3.9499999999999999e-224Initial program 72.5%
associate-*l*72.5%
times-frac97.9%
+-commutative97.9%
+-commutative97.9%
associate-+r+97.9%
+-commutative97.9%
associate-+l+97.9%
Applied egg-rr97.9%
Taylor expanded in x around inf 65.2%
if -3.9499999999999999e-224 < x Initial program 63.0%
associate-*l*63.0%
times-frac93.1%
+-commutative93.1%
+-commutative93.1%
associate-+r+93.1%
+-commutative93.1%
associate-+l+93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 59.5%
+-commutative59.5%
Simplified59.5%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4e-157) (/ y x) (if (<= y 1.0) (* x (/ 1.0 y)) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4e-157) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x * (1.0 / 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 (y <= 4d-157) then
tmp = y / x
else if (y <= 1.0d0) then
tmp = x * (1.0d0 / 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 (y <= 4e-157) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x * (1.0 / y);
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4e-157: tmp = y / x elif y <= 1.0: tmp = x * (1.0 / y) else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4e-157) tmp = Float64(y / x); elseif (y <= 1.0) tmp = Float64(x * Float64(1.0 / y)); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4e-157)
tmp = y / x;
elseif (y <= 1.0)
tmp = x * (1.0 / 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[y, 4e-157], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.0], N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x \cdot \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 3.99999999999999977e-157Initial program 60.9%
associate-/l*72.2%
associate-+l+72.2%
Simplified72.2%
Taylor expanded in y around 0 54.5%
Taylor expanded in x around 0 41.6%
if 3.99999999999999977e-157 < y < 1Initial program 86.3%
associate-/l*94.9%
associate-+l+94.9%
Simplified94.9%
Taylor expanded in x around 0 38.7%
+-commutative38.7%
Simplified38.7%
*-un-lft-identity38.7%
times-frac38.4%
Applied egg-rr38.4%
Taylor expanded in y around 0 37.4%
if 1 < y Initial program 59.7%
associate-*l*59.7%
times-frac86.9%
+-commutative86.9%
+-commutative86.9%
associate-+r+86.9%
+-commutative86.9%
associate-+l+86.9%
Applied egg-rr86.9%
Taylor expanded in y around inf 73.7%
Taylor expanded in x around 0 73.3%
Final simplification50.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.8e-157) (/ y x) (if (<= y 2.35e+66) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.8e-157) {
tmp = y / x;
} else if (y <= 2.35e+66) {
tmp = x / (y * (y + 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.8d-157) then
tmp = y / x
else if (y <= 2.35d+66) then
tmp = x / (y * (y + 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.8e-157) {
tmp = y / x;
} else if (y <= 2.35e+66) {
tmp = x / (y * (y + 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.8e-157: tmp = y / x elif y <= 2.35e+66: tmp = x / (y * (y + 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.8e-157) tmp = Float64(y / x); elseif (y <= 2.35e+66) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) * Float64(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.8e-157)
tmp = y / x;
elseif (y <= 2.35e+66)
tmp = x / (y * (y + 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.8e-157], N[(y / x), $MachinePrecision], If[LessEqual[y, 2.35e+66], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{+66}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 1.8e-157Initial program 60.9%
associate-/l*72.2%
associate-+l+72.2%
Simplified72.2%
Taylor expanded in y around 0 54.5%
Taylor expanded in x around 0 41.6%
if 1.8e-157 < y < 2.3500000000000001e66Initial program 84.2%
associate-/l*93.4%
associate-+l+93.4%
Simplified93.4%
Taylor expanded in x around 0 43.6%
+-commutative43.6%
Simplified43.6%
if 2.3500000000000001e66 < y Initial program 52.7%
associate-*l*52.7%
times-frac85.8%
+-commutative85.8%
+-commutative85.8%
associate-+r+85.8%
+-commutative85.8%
associate-+l+85.8%
Applied egg-rr85.8%
Taylor expanded in y around inf 81.8%
Taylor expanded in x around 0 81.4%
Final simplification50.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.6e-152) (/ y (* x (+ x 1.0))) (if (<= x 7e-10) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.6e-152) {
tmp = y / (x * (x + 1.0));
} else if (x <= 7e-10) {
tmp = x / (y * (y + 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 <= (-2.6d-152)) then
tmp = y / (x * (x + 1.0d0))
else if (x <= 7d-10) then
tmp = x / (y * (y + 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 <= -2.6e-152) {
tmp = y / (x * (x + 1.0));
} else if (x <= 7e-10) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.6e-152: tmp = y / (x * (x + 1.0)) elif x <= 7e-10: tmp = x / (y * (y + 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 <= -2.6e-152) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif (x <= 7e-10) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.6e-152)
tmp = y / (x * (x + 1.0));
elseif (x <= 7e-10)
tmp = x / (y * (y + 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, -2.6e-152], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-10], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if x < -2.60000000000000013e-152Initial program 65.4%
associate-/l*75.4%
associate-+l+75.4%
Simplified75.4%
Taylor expanded in y around 0 59.4%
if -2.60000000000000013e-152 < x < 6.99999999999999961e-10Initial program 66.8%
associate-/l*81.2%
associate-+l+81.2%
Simplified81.2%
Taylor expanded in x around 0 78.6%
+-commutative78.6%
Simplified78.6%
if 6.99999999999999961e-10 < x Initial program 59.6%
associate-*l*59.6%
times-frac84.0%
+-commutative84.0%
+-commutative84.0%
associate-+r+84.0%
+-commutative84.0%
associate-+l+84.0%
Applied egg-rr84.0%
Taylor expanded in y around inf 34.0%
Taylor expanded in x around 0 33.3%
Final simplification59.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.6e-152) (/ 1.0 (/ (+ y (+ x 1.0)) (/ y x))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.6e-152) {
tmp = 1.0 / ((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 <= (-2.6d-152)) then
tmp = 1.0d0 / ((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 <= -2.6e-152) {
tmp = 1.0 / ((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 <= -2.6e-152: tmp = 1.0 / ((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 <= -2.6e-152) tmp = Float64(1.0 / 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 <= -2.6e-152)
tmp = 1.0 / ((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, -2.6e-152], N[(1.0 / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y / x), $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 -2.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{1}{\frac{y + \left(x + 1\right)}{\frac{y}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.60000000000000013e-152Initial program 65.4%
associate-/l*75.4%
associate-+l+75.4%
Simplified75.4%
associate-*r/65.4%
associate-+r+65.4%
associate-/r*76.3%
clear-num75.6%
associate-+r+75.6%
+-commutative75.6%
associate-+l+75.6%
*-commutative75.6%
associate-/l*88.1%
pow288.1%
+-commutative88.1%
Applied egg-rr88.1%
Taylor expanded in y around 0 64.5%
if -2.60000000000000013e-152 < x Initial program 63.8%
associate-*l*63.9%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 58.6%
associate-/r*60.1%
+-commutative60.1%
Simplified60.1%
Final simplification61.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.8e-152) (/ (/ 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.8e-152) {
tmp = (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.8d-152)) then
tmp = (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.8e-152) {
tmp = (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.8e-152: tmp = (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.8e-152) tmp = Float64(Float64(y / Float64(x + 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.8e-152)
tmp = (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.8e-152], N[(N[(y / N[(x + y), $MachinePrecision]), $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.8 \cdot 10^{-152}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.8e-152Initial program 65.4%
associate-*l*65.4%
times-frac88.8%
+-commutative88.8%
+-commutative88.8%
associate-+r+88.8%
+-commutative88.8%
associate-+l+88.8%
Applied egg-rr88.8%
clear-num88.8%
associate-/r*99.7%
frac-times99.2%
*-un-lft-identity99.2%
+-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 64.6%
+-commutative64.6%
Simplified64.6%
if -1.8e-152 < x Initial program 63.8%
associate-*l*63.9%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 58.6%
associate-/r*60.1%
+-commutative60.1%
Simplified60.1%
Final simplification61.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.6e-152) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.6e-152) {
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 <= (-2.6d-152)) 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 <= -2.6e-152) {
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 <= -2.6e-152: 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 <= -2.6e-152) 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 <= -2.6e-152)
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, -2.6e-152], 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 -2.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.60000000000000013e-152Initial program 65.4%
associate-/l*75.4%
associate-+l+75.4%
Simplified75.4%
Taylor expanded in y around 0 59.4%
associate-/r*64.2%
+-commutative64.2%
Simplified64.2%
if -2.60000000000000013e-152 < x Initial program 63.8%
associate-*l*63.9%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 58.6%
associate-/r*60.1%
+-commutative60.1%
Simplified60.1%
Final simplification61.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.2e-197) (/ y x) (* x (/ 1.0 y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.2e-197) {
tmp = y / x;
} else {
tmp = x * (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 <= (-3.2d-197)) then
tmp = y / x
else
tmp = x * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.2e-197) {
tmp = y / x;
} else {
tmp = x * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.2e-197: tmp = y / x else: tmp = x * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.2e-197) tmp = Float64(y / x); else tmp = Float64(x * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.2e-197)
tmp = y / x;
else
tmp = x * (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, -3.2e-197], N[(y / x), $MachinePrecision], N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-197}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{y}\\
\end{array}
\end{array}
if x < -3.1999999999999997e-197Initial program 66.2%
associate-/l*75.6%
associate-+l+75.6%
Simplified75.6%
Taylor expanded in y around 0 57.4%
Taylor expanded in x around 0 32.1%
if -3.1999999999999997e-197 < x Initial program 63.3%
associate-/l*76.9%
associate-+l+76.9%
Simplified76.9%
Taylor expanded in x around 0 58.0%
+-commutative58.0%
Simplified58.0%
*-un-lft-identity58.0%
times-frac59.4%
Applied egg-rr59.4%
Taylor expanded in y around 0 38.9%
Final simplification36.3%
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 64.4%
associate-/l*76.4%
associate-+l+76.4%
Simplified76.4%
associate-*r/64.4%
associate-+r+64.4%
associate-/r*71.5%
clear-num71.1%
associate-+r+71.1%
+-commutative71.1%
associate-+l+71.1%
*-commutative71.1%
associate-/l*84.6%
pow284.6%
+-commutative84.6%
Applied egg-rr84.6%
Taylor expanded in y around 0 49.1%
Taylor expanded in y around inf 4.2%
Final simplification4.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ y x))
assert(x < y);
double code(double x, double y) {
return 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 / x
end function
assert x < y;
public static double code(double x, double y) {
return y / x;
}
[x, y] = sort([x, y]) def code(x, y): return y / x
x, y = sort([x, y]) function code(x, y) return Float64(y / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = y / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(y / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x}
\end{array}
Initial program 64.4%
associate-/l*76.4%
associate-+l+76.4%
Simplified76.4%
Taylor expanded in y around 0 45.8%
Taylor expanded in x around 0 28.1%
Final simplification28.1%
(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 2024082
(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))))