
(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 (+ y 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) * ((y / (x + (y + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}
\end{array}
Initial program 67.9%
times-frac89.0%
+-commutative89.0%
+-commutative89.0%
associate-/r/85.8%
+-commutative85.8%
associate-/r/85.8%
associate-*l/83.0%
*-commutative83.0%
distribute-rgt1-in63.3%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
cube-unmult83.0%
+-commutative83.0%
Simplified83.0%
associate-/l*67.9%
fma-udef54.2%
cube-mult54.2%
distribute-rgt1-in67.9%
*-commutative67.9%
times-frac89.0%
associate-*l/82.7%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Final simplification99.9%
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))) (t_1 (/ y (+ x (+ y 1.0)))))
(if (<= y 5.6e-230)
(/ t_1 (+ x (* y 2.0)))
(if (<= y 7.2e-164)
(* y (/ t_0 (* (+ x y) (+ y 1.0))))
(if (<= y 2.4e+161)
(* t_1 (/ x (* (+ x y) (+ x y))))
(* t_0 (/ 1.0 (+ x y))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double t_1 = y / (x + (y + 1.0));
double tmp;
if (y <= 5.6e-230) {
tmp = t_1 / (x + (y * 2.0));
} else if (y <= 7.2e-164) {
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
} else if (y <= 2.4e+161) {
tmp = t_1 * (x / ((x + y) * (x + y)));
} else {
tmp = t_0 * (1.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) :: t_1
real(8) :: tmp
t_0 = x / (x + y)
t_1 = y / (x + (y + 1.0d0))
if (y <= 5.6d-230) then
tmp = t_1 / (x + (y * 2.0d0))
else if (y <= 7.2d-164) then
tmp = y * (t_0 / ((x + y) * (y + 1.0d0)))
else if (y <= 2.4d+161) then
tmp = t_1 * (x / ((x + y) * (x + y)))
else
tmp = t_0 * (1.0d0 / (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 t_1 = y / (x + (y + 1.0));
double tmp;
if (y <= 5.6e-230) {
tmp = t_1 / (x + (y * 2.0));
} else if (y <= 7.2e-164) {
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
} else if (y <= 2.4e+161) {
tmp = t_1 * (x / ((x + y) * (x + y)));
} else {
tmp = t_0 * (1.0 / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) t_1 = y / (x + (y + 1.0)) tmp = 0 if y <= 5.6e-230: tmp = t_1 / (x + (y * 2.0)) elif y <= 7.2e-164: tmp = y * (t_0 / ((x + y) * (y + 1.0))) elif y <= 2.4e+161: tmp = t_1 * (x / ((x + y) * (x + y))) else: tmp = t_0 * (1.0 / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) t_1 = Float64(y / Float64(x + Float64(y + 1.0))) tmp = 0.0 if (y <= 5.6e-230) tmp = Float64(t_1 / Float64(x + Float64(y * 2.0))); elseif (y <= 7.2e-164) tmp = Float64(y * Float64(t_0 / Float64(Float64(x + y) * Float64(y + 1.0)))); elseif (y <= 2.4e+161) tmp = Float64(t_1 * Float64(x / Float64(Float64(x + y) * Float64(x + y)))); else tmp = Float64(t_0 * Float64(1.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);
t_1 = y / (x + (y + 1.0));
tmp = 0.0;
if (y <= 5.6e-230)
tmp = t_1 / (x + (y * 2.0));
elseif (y <= 7.2e-164)
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
elseif (y <= 2.4e+161)
tmp = t_1 * (x / ((x + y) * (x + y)));
else
tmp = t_0 * (1.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]}, Block[{t$95$1 = N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.6e-230], N[(t$95$1 / N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e-164], N[(y * N[(t$95$0 / N[(N[(x + y), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e+161], N[(t$95$1 * N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
t_1 := \frac{y}{x + \left(y + 1\right)}\\
\mathbf{if}\;y \leq 5.6 \cdot 10^{-230}:\\
\;\;\;\;\frac{t_1}{x + y \cdot 2}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-164}:\\
\;\;\;\;y \cdot \frac{t_0}{\left(x + y\right) \cdot \left(y + 1\right)}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+161}:\\
\;\;\;\;t_1 \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + y}\\
\end{array}
\end{array}
if y < 5.6000000000000002e-230Initial program 65.9%
times-frac87.8%
+-commutative87.8%
+-commutative87.8%
associate-/r/86.8%
+-commutative86.8%
associate-/r/86.8%
associate-*l/83.9%
*-commutative83.9%
distribute-rgt1-in55.7%
fma-def83.9%
+-commutative83.9%
+-commutative83.9%
cube-unmult83.9%
+-commutative83.9%
Simplified83.9%
associate-/l*65.9%
fma-udef46.3%
cube-mult46.3%
distribute-rgt1-in65.9%
*-commutative65.9%
times-frac87.8%
associate-*l/82.3%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
clear-num99.8%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 58.3%
*-commutative58.3%
Simplified58.3%
if 5.6000000000000002e-230 < y < 7.19999999999999988e-164Initial program 58.0%
times-frac70.1%
/-rgt-identity70.1%
/-rgt-identity70.1%
associate-+l+70.1%
Simplified70.1%
Taylor expanded in x around 0 63.7%
+-commutative63.7%
Simplified63.7%
associate-/r*93.3%
clear-num93.3%
frac-times93.3%
*-commutative93.3%
*-un-lft-identity93.3%
Applied egg-rr93.3%
associate-*r/93.6%
associate-/r/93.3%
Simplified93.3%
if 7.19999999999999988e-164 < y < 2.3999999999999999e161Initial program 72.5%
times-frac96.3%
/-rgt-identity96.3%
/-rgt-identity96.3%
associate-+l+96.3%
Simplified96.3%
if 2.3999999999999999e161 < y Initial program 68.4%
times-frac82.9%
+-commutative82.9%
+-commutative82.9%
associate-/r/82.9%
+-commutative82.9%
associate-/r/82.9%
associate-*l/82.9%
*-commutative82.9%
distribute-rgt1-in79.6%
fma-def82.9%
+-commutative82.9%
+-commutative82.9%
cube-unmult82.9%
+-commutative82.9%
Simplified82.9%
associate-/l*68.4%
fma-udef68.4%
cube-mult68.4%
distribute-rgt1-in68.4%
*-commutative68.4%
times-frac82.9%
associate-*l/82.9%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 88.2%
Final simplification76.0%
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) (+ x y)))))
(if (<= x -1.35e+157)
(/ (/ y (+ x (+ y 1.0))) (+ x (* y 2.0)))
(if (<= x -12.2)
(* t_0 (/ y x))
(if (<= x -2.85e-149)
(* t_0 (/ y (+ y 1.0)))
(* (/ x (+ x y)) (/ 1.0 (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / ((x + y) * (x + y));
double tmp;
if (x <= -1.35e+157) {
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
} else if (x <= -12.2) {
tmp = t_0 * (y / x);
} else if (x <= -2.85e-149) {
tmp = t_0 * (y / (y + 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) :: t_0
real(8) :: tmp
t_0 = x / ((x + y) * (x + y))
if (x <= (-1.35d+157)) then
tmp = (y / (x + (y + 1.0d0))) / (x + (y * 2.0d0))
else if (x <= (-12.2d0)) then
tmp = t_0 * (y / x)
else if (x <= (-2.85d-149)) then
tmp = t_0 * (y / (y + 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 t_0 = x / ((x + y) * (x + y));
double tmp;
if (x <= -1.35e+157) {
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
} else if (x <= -12.2) {
tmp = t_0 * (y / x);
} else if (x <= -2.85e-149) {
tmp = t_0 * (y / (y + 1.0));
} else {
tmp = (x / (x + y)) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / ((x + y) * (x + y)) tmp = 0 if x <= -1.35e+157: tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0)) elif x <= -12.2: tmp = t_0 * (y / x) elif x <= -2.85e-149: tmp = t_0 * (y / (y + 1.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(x / Float64(Float64(x + y) * Float64(x + y))) tmp = 0.0 if (x <= -1.35e+157) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + Float64(y * 2.0))); elseif (x <= -12.2) tmp = Float64(t_0 * Float64(y / x)); elseif (x <= -2.85e-149) tmp = Float64(t_0 * Float64(y / Float64(y + 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)
t_0 = x / ((x + y) * (x + y));
tmp = 0.0;
if (x <= -1.35e+157)
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
elseif (x <= -12.2)
tmp = t_0 * (y / x);
elseif (x <= -2.85e-149)
tmp = t_0 * (y / (y + 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_] := Block[{t$95$0 = N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+157], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -12.2], N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.85e-149], N[(t$95$0 * N[(y / N[(y + 1.0), $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}
t_0 := \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+157}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y \cdot 2}\\
\mathbf{elif}\;x \leq -12.2:\\
\;\;\;\;t_0 \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -2.85 \cdot 10^{-149}:\\
\;\;\;\;t_0 \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -1.35e157Initial program 62.2%
times-frac89.0%
+-commutative89.0%
+-commutative89.0%
associate-/r/89.0%
+-commutative89.0%
associate-/r/89.0%
associate-*l/89.0%
*-commutative89.0%
distribute-rgt1-in2.8%
fma-def89.0%
+-commutative89.0%
+-commutative89.0%
cube-unmult89.0%
+-commutative89.0%
Simplified89.0%
associate-/l*62.2%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in62.2%
*-commutative62.2%
times-frac89.0%
associate-*l/89.0%
times-frac100.0%
associate-+r+100.0%
Applied egg-rr100.0%
clear-num100.0%
frac-times99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 89.2%
*-commutative89.2%
Simplified89.2%
if -1.35e157 < x < -12.199999999999999Initial program 60.5%
times-frac90.8%
/-rgt-identity90.8%
/-rgt-identity90.8%
associate-+l+90.8%
Simplified90.8%
Taylor expanded in x around inf 80.4%
if -12.199999999999999 < x < -2.8499999999999999e-149Initial program 95.5%
times-frac99.7%
/-rgt-identity99.7%
/-rgt-identity99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in x around 0 99.1%
+-commutative99.1%
Simplified99.1%
if -2.8499999999999999e-149 < x Initial program 66.8%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
associate-/r/84.2%
+-commutative84.2%
associate-/r/84.3%
associate-*l/82.1%
*-commutative82.1%
distribute-rgt1-in75.1%
fma-def82.1%
+-commutative82.1%
+-commutative82.1%
cube-unmult82.1%
+-commutative82.1%
Simplified82.1%
associate-/l*66.8%
fma-udef61.2%
cube-mult61.1%
distribute-rgt1-in66.8%
*-commutative66.8%
times-frac87.0%
associate-*l/77.4%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
Simplified59.0%
Final simplification70.0%
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 (<= x -1.28e+157)
(/ (/ y (+ x (+ y 1.0))) (+ x (* y 2.0)))
(if (<= x -750.0)
(* (/ x (* (+ x y) (+ x y))) (/ y x))
(if (<= x -4.3e-221)
(* y (/ t_0 (* (+ x y) (+ y 1.0))))
(* t_0 (/ 1.0 (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -1.28e+157) {
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
} else if (x <= -750.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -4.3e-221) {
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
} else {
tmp = t_0 * (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 = x / (x + y)
if (x <= (-1.28d+157)) then
tmp = (y / (x + (y + 1.0d0))) / (x + (y * 2.0d0))
else if (x <= (-750.0d0)) then
tmp = (x / ((x + y) * (x + y))) * (y / x)
else if (x <= (-4.3d-221)) then
tmp = y * (t_0 / ((x + y) * (y + 1.0d0)))
else
tmp = t_0 * (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 = x / (x + y);
double tmp;
if (x <= -1.28e+157) {
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
} else if (x <= -750.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -4.3e-221) {
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
} else {
tmp = t_0 * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -1.28e+157: tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0)) elif x <= -750.0: tmp = (x / ((x + y) * (x + y))) * (y / x) elif x <= -4.3e-221: tmp = y * (t_0 / ((x + y) * (y + 1.0))) else: tmp = t_0 * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -1.28e+157) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + Float64(y * 2.0))); elseif (x <= -750.0) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x)); elseif (x <= -4.3e-221) tmp = Float64(y * Float64(t_0 / Float64(Float64(x + y) * Float64(y + 1.0)))); else tmp = Float64(t_0 * 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 = x / (x + y);
tmp = 0.0;
if (x <= -1.28e+157)
tmp = (y / (x + (y + 1.0))) / (x + (y * 2.0));
elseif (x <= -750.0)
tmp = (x / ((x + y) * (x + y))) * (y / x);
elseif (x <= -4.3e-221)
tmp = y * (t_0 / ((x + y) * (y + 1.0)));
else
tmp = t_0 * (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[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.28e+157], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -750.0], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.3e-221], N[(y * N[(t$95$0 / N[(N[(x + y), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -1.28 \cdot 10^{+157}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y \cdot 2}\\
\mathbf{elif}\;x \leq -750:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -4.3 \cdot 10^{-221}:\\
\;\;\;\;y \cdot \frac{t_0}{\left(x + y\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -1.28000000000000001e157Initial program 62.2%
times-frac89.0%
+-commutative89.0%
+-commutative89.0%
associate-/r/89.0%
+-commutative89.0%
associate-/r/89.0%
associate-*l/89.0%
*-commutative89.0%
distribute-rgt1-in2.8%
fma-def89.0%
+-commutative89.0%
+-commutative89.0%
cube-unmult89.0%
+-commutative89.0%
Simplified89.0%
associate-/l*62.2%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in62.2%
*-commutative62.2%
times-frac89.0%
associate-*l/89.0%
times-frac100.0%
associate-+r+100.0%
Applied egg-rr100.0%
clear-num100.0%
frac-times99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 89.2%
*-commutative89.2%
Simplified89.2%
if -1.28000000000000001e157 < x < -750Initial program 60.5%
times-frac90.8%
/-rgt-identity90.8%
/-rgt-identity90.8%
associate-+l+90.8%
Simplified90.8%
Taylor expanded in x around inf 80.4%
if -750 < x < -4.2999999999999998e-221Initial program 96.5%
times-frac99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around 0 99.2%
+-commutative99.2%
Simplified99.2%
associate-/r*99.1%
clear-num99.0%
frac-times99.1%
*-commutative99.1%
*-un-lft-identity99.1%
Applied egg-rr99.1%
associate-*r/99.2%
associate-/r/97.9%
Simplified97.9%
if -4.2999999999999998e-221 < x Initial program 65.3%
times-frac86.4%
+-commutative86.4%
+-commutative86.4%
associate-/r/83.5%
+-commutative83.5%
associate-/r/83.5%
associate-*l/81.3%
*-commutative81.3%
distribute-rgt1-in74.6%
fma-def81.3%
+-commutative81.3%
+-commutative81.3%
cube-unmult81.3%
+-commutative81.3%
Simplified81.3%
associate-/l*65.3%
fma-udef60.0%
cube-mult60.0%
distribute-rgt1-in65.3%
*-commutative65.3%
times-frac86.4%
associate-*l/76.4%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 57.1%
+-commutative57.1%
Simplified57.1%
Final simplification69.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 (+ y 1.0))) (+ x (* y 2.0)))))
(if (<= x -1.28e+157)
t_0
(if (<= x -720000.0)
(* (/ x (* (+ x y) (+ x y))) (/ y x))
(if (<= x -2.4e-54) t_0 (* (/ 1.0 y) (/ x (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / (x + (y + 1.0))) / (x + (y * 2.0));
double tmp;
if (x <= -1.28e+157) {
tmp = t_0;
} else if (x <= -720000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -2.4e-54) {
tmp = t_0;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y / (x + (y + 1.0d0))) / (x + (y * 2.0d0))
if (x <= (-1.28d+157)) then
tmp = t_0
else if (x <= (-720000.0d0)) then
tmp = (x / ((x + y) * (x + y))) * (y / x)
else if (x <= (-2.4d-54)) then
tmp = t_0
else
tmp = (1.0d0 / y) * (x / (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 + (y + 1.0))) / (x + (y * 2.0));
double tmp;
if (x <= -1.28e+157) {
tmp = t_0;
} else if (x <= -720000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -2.4e-54) {
tmp = t_0;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / (x + (y + 1.0))) / (x + (y * 2.0)) tmp = 0 if x <= -1.28e+157: tmp = t_0 elif x <= -720000.0: tmp = (x / ((x + y) * (x + y))) * (y / x) elif x <= -2.4e-54: tmp = t_0 else: tmp = (1.0 / y) * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + Float64(y * 2.0))) tmp = 0.0 if (x <= -1.28e+157) tmp = t_0; elseif (x <= -720000.0) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x)); elseif (x <= -2.4e-54) tmp = t_0; else tmp = Float64(Float64(1.0 / y) * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y / (x + (y + 1.0))) / (x + (y * 2.0));
tmp = 0.0;
if (x <= -1.28e+157)
tmp = t_0;
elseif (x <= -720000.0)
tmp = (x / ((x + y) * (x + y))) * (y / x);
elseif (x <= -2.4e-54)
tmp = t_0;
else
tmp = (1.0 / y) * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.28e+157], t$95$0, If[LessEqual[x, -720000.0], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.4e-54], t$95$0, N[(N[(1.0 / y), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x + y \cdot 2}\\
\mathbf{if}\;x \leq -1.28 \cdot 10^{+157}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -720000:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-54}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if x < -1.28000000000000001e157 or -7.2e5 < x < -2.40000000000000013e-54Initial program 69.3%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
associate-/r/90.5%
+-commutative90.5%
associate-/r/90.5%
associate-*l/90.5%
*-commutative90.5%
distribute-rgt1-in18.3%
fma-def90.5%
+-commutative90.5%
+-commutative90.5%
cube-unmult90.5%
+-commutative90.5%
Simplified90.5%
associate-/l*69.3%
fma-udef16.6%
cube-mult16.6%
distribute-rgt1-in69.3%
*-commutative69.3%
times-frac91.1%
associate-*l/91.1%
times-frac100.0%
associate-+r+100.0%
Applied egg-rr100.0%
clear-num100.0%
frac-times99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 86.9%
*-commutative86.9%
Simplified86.9%
if -1.28000000000000001e157 < x < -7.2e5Initial program 57.2%
times-frac90.0%
/-rgt-identity90.0%
/-rgt-identity90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in x around inf 82.4%
if -2.40000000000000013e-54 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
*-un-lft-identity58.8%
times-frac59.6%
Applied egg-rr59.6%
Final simplification67.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ y (+ x (+ y 1.0))) x)))
(if (<= x -2.4e+142)
t_0
(if (<= x -5000000.0)
(* (/ x (* (+ x y) (+ x y))) (/ y x))
(if (<= x -1.6e-51) t_0 (* (/ 1.0 y) (/ x (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / (x + (y + 1.0))) / x;
double tmp;
if (x <= -2.4e+142) {
tmp = t_0;
} else if (x <= -5000000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -1.6e-51) {
tmp = t_0;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y / (x + (y + 1.0d0))) / x
if (x <= (-2.4d+142)) then
tmp = t_0
else if (x <= (-5000000.0d0)) then
tmp = (x / ((x + y) * (x + y))) * (y / x)
else if (x <= (-1.6d-51)) then
tmp = t_0
else
tmp = (1.0d0 / y) * (x / (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 + (y + 1.0))) / x;
double tmp;
if (x <= -2.4e+142) {
tmp = t_0;
} else if (x <= -5000000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -1.6e-51) {
tmp = t_0;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / (x + (y + 1.0))) / x tmp = 0 if x <= -2.4e+142: tmp = t_0 elif x <= -5000000.0: tmp = (x / ((x + y) * (x + y))) * (y / x) elif x <= -1.6e-51: tmp = t_0 else: tmp = (1.0 / y) * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x) tmp = 0.0 if (x <= -2.4e+142) tmp = t_0; elseif (x <= -5000000.0) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x)); elseif (x <= -1.6e-51) tmp = t_0; else tmp = Float64(Float64(1.0 / y) * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y / (x + (y + 1.0))) / x;
tmp = 0.0;
if (x <= -2.4e+142)
tmp = t_0;
elseif (x <= -5000000.0)
tmp = (x / ((x + y) * (x + y))) * (y / x);
elseif (x <= -1.6e-51)
tmp = t_0;
else
tmp = (1.0 / y) * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -2.4e+142], t$95$0, If[LessEqual[x, -5000000.0], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e-51], t$95$0, N[(N[(1.0 / y), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+142}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -5000000:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-51}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if x < -2.3999999999999999e142 or -5e6 < x < -1.6e-51Initial program 70.5%
times-frac92.0%
/-rgt-identity92.0%
/-rgt-identity92.0%
associate-+l+92.0%
Simplified92.0%
Taylor expanded in x around inf 87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
Applied egg-rr87.9%
if -2.3999999999999999e142 < x < -5e6Initial program 53.3%
times-frac88.5%
/-rgt-identity88.5%
/-rgt-identity88.5%
associate-+l+88.5%
Simplified88.5%
Taylor expanded in x around inf 79.6%
if -1.6e-51 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
*-un-lft-identity58.8%
times-frac59.6%
Applied egg-rr59.6%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.28e+157)
(* (/ x (+ x y)) (/ (/ y x) (+ x y)))
(if (<= x -6000000.0)
(* (/ x (* (+ x y) (+ x y))) (/ y x))
(if (<= x -1.45e-50)
(/ (/ y (+ x (+ y 1.0))) x)
(* (/ 1.0 y) (/ x (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.28e+157) {
tmp = (x / (x + y)) * ((y / x) / (x + y));
} else if (x <= -6000000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -1.45e-50) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.28d+157)) then
tmp = (x / (x + y)) * ((y / x) / (x + y))
else if (x <= (-6000000.0d0)) then
tmp = (x / ((x + y) * (x + y))) * (y / x)
else if (x <= (-1.45d-50)) then
tmp = (y / (x + (y + 1.0d0))) / x
else
tmp = (1.0d0 / y) * (x / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.28e+157) {
tmp = (x / (x + y)) * ((y / x) / (x + y));
} else if (x <= -6000000.0) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -1.45e-50) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.28e+157: tmp = (x / (x + y)) * ((y / x) / (x + y)) elif x <= -6000000.0: tmp = (x / ((x + y) * (x + y))) * (y / x) elif x <= -1.45e-50: tmp = (y / (x + (y + 1.0))) / x else: tmp = (1.0 / y) * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.28e+157) tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / x) / Float64(x + y))); elseif (x <= -6000000.0) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x)); elseif (x <= -1.45e-50) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x); else tmp = Float64(Float64(1.0 / y) * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.28e+157)
tmp = (x / (x + y)) * ((y / x) / (x + y));
elseif (x <= -6000000.0)
tmp = (x / ((x + y) * (x + y))) * (y / x);
elseif (x <= -1.45e-50)
tmp = (y / (x + (y + 1.0))) / x;
else
tmp = (1.0 / y) * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.28e+157], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6000000.0], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.45e-50], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.28 \cdot 10^{+157}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{x + y}\\
\mathbf{elif}\;x \leq -6000000:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if x < -1.28000000000000001e157Initial program 62.2%
times-frac89.0%
+-commutative89.0%
+-commutative89.0%
associate-/r/89.0%
+-commutative89.0%
associate-/r/89.0%
associate-*l/89.0%
*-commutative89.0%
distribute-rgt1-in2.8%
fma-def89.0%
+-commutative89.0%
+-commutative89.0%
cube-unmult89.0%
+-commutative89.0%
Simplified89.0%
associate-/l*62.2%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in62.2%
*-commutative62.2%
times-frac89.0%
associate-*l/89.0%
times-frac100.0%
associate-+r+100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 89.2%
if -1.28000000000000001e157 < x < -6e6Initial program 57.2%
times-frac90.0%
/-rgt-identity90.0%
/-rgt-identity90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in x around inf 82.4%
if -6e6 < x < -1.45000000000000004e-50Initial program 99.6%
times-frac99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around inf 75.5%
associate-*l/75.7%
*-un-lft-identity75.7%
Applied egg-rr75.7%
if -1.45000000000000004e-50 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
*-un-lft-identity58.8%
times-frac59.6%
Applied egg-rr59.6%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ (/ y x) x) (if (<= x -5.2e-50) (/ y x) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -5.2e-50) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) / x
else if (x <= (-5.2d-50)) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -5.2e-50) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) / x elif x <= -5.2e-50: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.2e-50) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) / x;
elseif (x <= -5.2e-50)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.2e-50], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 61.3%
times-frac90.0%
/-rgt-identity90.0%
/-rgt-identity90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in x around inf 75.6%
associate-*l/75.6%
*-un-lft-identity75.6%
Applied egg-rr75.6%
Taylor expanded in x around inf 73.1%
if -1 < x < -5.2000000000000003e-50Initial program 99.4%
times-frac99.7%
/-rgt-identity99.7%
/-rgt-identity99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in x around 0 96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in y around 0 57.8%
if -5.2000000000000003e-50 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
Final simplification62.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2e+59) (/ (/ y x) x) (if (<= x -5.2e-50) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+59) {
tmp = (y / x) / x;
} else if (x <= -5.2e-50) {
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 <= (-2d+59)) then
tmp = (y / x) / x
else if (x <= (-5.2d-50)) 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 <= -2e+59) {
tmp = (y / x) / x;
} else if (x <= -5.2e-50) {
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 <= -2e+59: tmp = (y / x) / x elif x <= -5.2e-50: 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 <= -2e+59) tmp = Float64(Float64(y / x) / x); elseif (x <= -5.2e-50) 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 <= -2e+59)
tmp = (y / x) / x;
elseif (x <= -5.2e-50)
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, -2e+59], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -5.2e-50], 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 -2 \cdot 10^{+59}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.99999999999999994e59Initial program 60.1%
times-frac89.5%
/-rgt-identity89.5%
/-rgt-identity89.5%
associate-+l+89.5%
Simplified89.5%
Taylor expanded in x around inf 80.2%
associate-*l/80.3%
*-un-lft-identity80.3%
Applied egg-rr80.3%
Taylor expanded in x around inf 79.9%
if -1.99999999999999994e59 < x < -5.2000000000000003e-50Initial program 76.8%
times-frac94.5%
/-rgt-identity94.5%
/-rgt-identity94.5%
associate-+l+94.5%
Simplified94.5%
Taylor expanded in y around 0 53.7%
if -5.2000000000000003e-50 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
Final simplification63.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1e+65) (/ (/ y x) x) (if (<= x -1.8e-50) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1e+65) {
tmp = (y / x) / x;
} else if (x <= -1.8e-50) {
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 <= (-1d+65)) then
tmp = (y / x) / x
else if (x <= (-1.8d-50)) 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 <= -1e+65) {
tmp = (y / x) / x;
} else if (x <= -1.8e-50) {
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 <= -1e+65: tmp = (y / x) / x elif x <= -1.8e-50: 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 <= -1e+65) tmp = Float64(Float64(y / x) / x); elseif (x <= -1.8e-50) 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 <= -1e+65)
tmp = (y / x) / x;
elseif (x <= -1.8e-50)
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, -1e+65], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -1.8e-50], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+65}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -9.9999999999999999e64Initial program 60.1%
times-frac89.5%
/-rgt-identity89.5%
/-rgt-identity89.5%
associate-+l+89.5%
Simplified89.5%
Taylor expanded in x around inf 80.2%
associate-*l/80.3%
*-un-lft-identity80.3%
Applied egg-rr80.3%
Taylor expanded in x around inf 79.9%
if -9.9999999999999999e64 < x < -1.7999999999999999e-50Initial program 76.8%
times-frac94.5%
/-rgt-identity94.5%
/-rgt-identity94.5%
associate-+l+94.5%
Simplified94.5%
Taylor expanded in y around 0 53.7%
if -1.7999999999999999e-50 < x Initial program 69.7%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
associate-/r/85.9%
+-commutative85.9%
associate-/r/85.9%
associate-*l/84.0%
*-commutative84.0%
distribute-rgt1-in76.1%
fma-def84.0%
+-commutative84.0%
+-commutative84.0%
cube-unmult84.0%
+-commutative84.0%
Simplified84.0%
associate-/l*69.8%
fma-udef63.0%
cube-mult63.0%
distribute-rgt1-in69.7%
*-commutative69.7%
times-frac88.4%
associate-*l/79.2%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-/l/95.5%
Applied egg-rr95.5%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
associate-/r*59.6%
Simplified59.6%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8.5e-52) (/ (/ y (+ x 1.0)) x) (* (/ 1.0 y) (/ x (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.5e-52) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-8.5d-52)) then
tmp = (y / (x + 1.0d0)) / x
else
tmp = (1.0d0 / y) * (x / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -8.5e-52) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8.5e-52: tmp = (y / (x + 1.0)) / x else: tmp = (1.0 / y) * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8.5e-52) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(1.0 / y) * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -8.5e-52)
tmp = (y / (x + 1.0)) / x;
else
tmp = (1.0 / y) * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -8.5e-52], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if x < -8.50000000000000006e-52Initial program 63.7%
times-frac90.6%
/-rgt-identity90.6%
/-rgt-identity90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around inf 74.6%
associate-*l/74.7%
*-un-lft-identity74.7%
Applied egg-rr74.7%
Taylor expanded in y around 0 74.2%
+-commutative74.2%
Simplified74.2%
if -8.50000000000000006e-52 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
*-un-lft-identity58.8%
times-frac59.6%
Applied egg-rr59.6%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.2e-50) (/ (/ y (+ x (+ y 1.0))) x) (* (/ 1.0 y) (/ x (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.2e-50) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.2d-50)) then
tmp = (y / (x + (y + 1.0d0))) / x
else
tmp = (1.0d0 / y) * (x / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -5.2e-50) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (1.0 / y) * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.2e-50: tmp = (y / (x + (y + 1.0))) / x else: tmp = (1.0 / y) * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.2e-50) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x); else tmp = Float64(Float64(1.0 / y) * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5.2e-50)
tmp = (y / (x + (y + 1.0))) / x;
else
tmp = (1.0 / y) * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -5.2e-50], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if x < -5.2000000000000003e-50Initial program 63.7%
times-frac90.6%
/-rgt-identity90.6%
/-rgt-identity90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around inf 74.6%
associate-*l/74.7%
*-un-lft-identity74.7%
Applied egg-rr74.7%
if -5.2000000000000003e-50 < x Initial program 69.7%
times-frac88.4%
/-rgt-identity88.4%
/-rgt-identity88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
Simplified58.8%
*-un-lft-identity58.8%
times-frac59.6%
Applied egg-rr59.6%
Final simplification64.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.1e-50) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e-50) {
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.1d-50)) 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.1e-50) {
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.1e-50: 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.1e-50) 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 <= -3.1e-50)
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, -3.1e-50], 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 -3.1 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3.1000000000000002e-50Initial program 63.7%
times-frac90.6%
/-rgt-identity90.6%
/-rgt-identity90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in y around 0 74.2%
associate-/r*74.1%
+-commutative74.1%
Simplified74.1%
if -3.1000000000000002e-50 < x Initial program 69.7%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
associate-/r/85.9%
+-commutative85.9%
associate-/r/85.9%
associate-*l/84.0%
*-commutative84.0%
distribute-rgt1-in76.1%
fma-def84.0%
+-commutative84.0%
+-commutative84.0%
cube-unmult84.0%
+-commutative84.0%
Simplified84.0%
associate-/l*69.8%
fma-udef63.0%
cube-mult63.0%
distribute-rgt1-in69.7%
*-commutative69.7%
times-frac88.4%
associate-*l/79.2%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-/l/95.5%
Applied egg-rr95.5%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
associate-/r*59.6%
Simplified59.6%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.35e-51) (/ (/ y (+ x 1.0)) x) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.35e-51) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.35d-51)) then
tmp = (y / (x + 1.0d0)) / x
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.35e-51) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.35e-51: tmp = (y / (x + 1.0)) / x else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.35e-51) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.35e-51)
tmp = (y / (x + 1.0)) / x;
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.35e-51], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $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.35 \cdot 10^{-51}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.3499999999999999e-51Initial program 63.7%
times-frac90.6%
/-rgt-identity90.6%
/-rgt-identity90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around inf 74.6%
associate-*l/74.7%
*-un-lft-identity74.7%
Applied egg-rr74.7%
Taylor expanded in y around 0 74.2%
+-commutative74.2%
Simplified74.2%
if -1.3499999999999999e-51 < x Initial program 69.7%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
associate-/r/85.9%
+-commutative85.9%
associate-/r/85.9%
associate-*l/84.0%
*-commutative84.0%
distribute-rgt1-in76.1%
fma-def84.0%
+-commutative84.0%
+-commutative84.0%
cube-unmult84.0%
+-commutative84.0%
Simplified84.0%
associate-/l*69.8%
fma-udef63.0%
cube-mult63.0%
distribute-rgt1-in69.7%
*-commutative69.7%
times-frac88.4%
associate-*l/79.2%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-/l/95.5%
Applied egg-rr95.5%
Taylor expanded in x around 0 58.8%
+-commutative58.8%
associate-/r*59.6%
Simplified59.6%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ (/ y x) x) (if (<= x -3.8e-212) (/ y x) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -3.8e-212) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) / x
else if (x <= (-3.8d-212)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -3.8e-212) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) / x elif x <= -3.8e-212: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) / x); elseif (x <= -3.8e-212) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) / x;
elseif (x <= -3.8e-212)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -3.8e-212], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-212}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 61.3%
times-frac90.0%
/-rgt-identity90.0%
/-rgt-identity90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in x around inf 75.6%
associate-*l/75.6%
*-un-lft-identity75.6%
Applied egg-rr75.6%
Taylor expanded in x around inf 73.1%
if -1 < x < -3.80000000000000022e-212Initial program 96.5%
times-frac99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around 0 99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 30.0%
if -3.80000000000000022e-212 < x Initial program 65.3%
times-frac86.4%
/-rgt-identity86.4%
/-rgt-identity86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in x around 0 55.5%
+-commutative55.5%
Simplified55.5%
Taylor expanded in y around 0 39.7%
Final simplification48.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.2e-18) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.2e-18) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.2d-18)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.2e-18) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.2e-18: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.2e-18) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.2e-18)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7.2e-18], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -7.20000000000000021e-18Initial program 62.3%
times-frac90.2%
/-rgt-identity90.2%
/-rgt-identity90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in x around inf 74.9%
Taylor expanded in y around inf 5.6%
if -7.20000000000000021e-18 < x Initial program 70.2%
times-frac88.6%
/-rgt-identity88.6%
/-rgt-identity88.6%
associate-+l+88.6%
Simplified88.6%
Taylor expanded in x around 0 58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in y around 0 41.3%
Final simplification30.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.8e-212) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.8e-212) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.8d-212)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.8e-212) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.8e-212: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.8e-212) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.8e-212)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.8e-212], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-212}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.80000000000000022e-212Initial program 71.8%
times-frac92.8%
/-rgt-identity92.8%
/-rgt-identity92.8%
associate-+l+92.8%
Simplified92.8%
Taylor expanded in x around 0 76.3%
+-commutative76.3%
Simplified76.3%
Taylor expanded in y around 0 28.2%
if -3.80000000000000022e-212 < x Initial program 65.3%
times-frac86.4%
/-rgt-identity86.4%
/-rgt-identity86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in x around 0 55.5%
+-commutative55.5%
Simplified55.5%
Taylor expanded in y around 0 39.7%
Final simplification35.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 67.9%
times-frac89.0%
/-rgt-identity89.0%
/-rgt-identity89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around inf 52.6%
Taylor expanded in y around inf 4.3%
Final simplification4.3%
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 67.9%
times-frac89.0%
+-commutative89.0%
+-commutative89.0%
associate-/r/85.8%
+-commutative85.8%
associate-/r/85.8%
associate-*l/83.0%
*-commutative83.0%
distribute-rgt1-in63.3%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
cube-unmult83.0%
+-commutative83.0%
Simplified83.0%
associate-/l*67.9%
fma-udef54.2%
cube-mult54.2%
distribute-rgt1-in67.9%
*-commutative67.9%
times-frac89.0%
associate-*l/82.7%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 50.1%
+-commutative50.1%
Simplified50.1%
Taylor expanded in y around 0 3.4%
Final simplification3.4%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2023301
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))