
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ y (+ y x)) (/ 1.0 (+ (+ x 1.0) (* y (+ (+ 2.0 (/ 1.0 x)) (/ y x)))))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * (1.0 / ((x + 1.0) + (y * ((2.0 + (1.0 / x)) + (y / x)))));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * (1.0d0 / ((x + 1.0d0) + (y * ((2.0d0 + (1.0d0 / x)) + (y / x)))))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * (1.0 / ((x + 1.0) + (y * ((2.0 + (1.0 / x)) + (y / x)))));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * (1.0 / ((x + 1.0) + (y * ((2.0 + (1.0 / x)) + (y / x)))))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(2.0 + Float64(1.0 / x)) + Float64(y / x)))))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * ((2.0 + (1.0 / x)) + (y / x)))));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(2.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \frac{1}{\left(x + 1\right) + y \cdot \left(\left(2 + \frac{1}{x}\right) + \frac{y}{x}\right)}
\end{array}
Initial program 64.3%
+-commutative64.3%
+-commutative64.3%
+-commutative64.3%
*-commutative64.3%
distribute-rgt1-in48.9%
fma-define64.3%
+-commutative64.3%
+-commutative64.3%
cube-unmult64.3%
+-commutative64.3%
Simplified64.3%
*-commutative64.3%
fma-define48.9%
cube-mult48.9%
distribute-rgt1-in64.3%
*-commutative64.3%
associate-*l*64.3%
times-frac91.3%
associate-+r+91.3%
Applied egg-rr91.3%
clear-num91.0%
inv-pow91.0%
+-commutative91.0%
Applied egg-rr91.0%
unpow-191.0%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in y around 0 99.0%
associate-+r+99.0%
+-commutative99.0%
associate-+r+99.0%
Simplified99.0%
Final simplification99.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y x))) (t_1 (+ x (+ y 1.0))))
(if (<= y -4.2e-278)
(* (/ y (+ y x)) (/ 1.0 (+ (+ x 1.0) (* y 2.0))))
(if (<= y 4.2e-160)
(* y (/ t_0 (* (+ y x) (+ y 1.0))))
(if (<= y 9e+73)
(* x (/ y (* t_1 (* (+ y x) (+ y x)))))
(/ t_0 t_1))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = x + (y + 1.0);
double tmp;
if (y <= -4.2e-278) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (y <= 4.2e-160) {
tmp = y * (t_0 / ((y + x) * (y + 1.0)));
} else if (y <= 9e+73) {
tmp = x * (y / (t_1 * ((y + x) * (y + x))));
} else {
tmp = t_0 / t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y + x)
t_1 = x + (y + 1.0d0)
if (y <= (-4.2d-278)) then
tmp = (y / (y + x)) * (1.0d0 / ((x + 1.0d0) + (y * 2.0d0)))
else if (y <= 4.2d-160) then
tmp = y * (t_0 / ((y + x) * (y + 1.0d0)))
else if (y <= 9d+73) then
tmp = x * (y / (t_1 * ((y + x) * (y + x))))
else
tmp = t_0 / t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = x + (y + 1.0);
double tmp;
if (y <= -4.2e-278) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (y <= 4.2e-160) {
tmp = y * (t_0 / ((y + x) * (y + 1.0)));
} else if (y <= 9e+73) {
tmp = x * (y / (t_1 * ((y + x) * (y + x))));
} else {
tmp = t_0 / t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y + x) t_1 = x + (y + 1.0) tmp = 0 if y <= -4.2e-278: tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0))) elif y <= 4.2e-160: tmp = y * (t_0 / ((y + x) * (y + 1.0))) elif y <= 9e+73: tmp = x * (y / (t_1 * ((y + x) * (y + x)))) else: tmp = t_0 / t_1 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y + x)) t_1 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= -4.2e-278) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(Float64(x + 1.0) + Float64(y * 2.0)))); elseif (y <= 4.2e-160) tmp = Float64(y * Float64(t_0 / Float64(Float64(y + x) * Float64(y + 1.0)))); elseif (y <= 9e+73) tmp = Float64(x * Float64(y / Float64(t_1 * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(t_0 / t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y + x);
t_1 = x + (y + 1.0);
tmp = 0.0;
if (y <= -4.2e-278)
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
elseif (y <= 4.2e-160)
tmp = y * (t_0 / ((y + x) * (y + 1.0)));
elseif (y <= 9e+73)
tmp = x * (y / (t_1 * ((y + x) * (y + x))));
else
tmp = t_0 / t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e-278], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e-160], N[(y * N[(t$95$0 / N[(N[(y + x), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+73], N[(x * N[(y / N[(t$95$1 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
t_1 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{-278}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-160}:\\
\;\;\;\;y \cdot \frac{t\_0}{\left(y + x\right) \cdot \left(y + 1\right)}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \frac{y}{t\_1 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_1}\\
\end{array}
\end{array}
if y < -4.20000000000000027e-278Initial program 59.6%
+-commutative59.6%
+-commutative59.6%
+-commutative59.6%
*-commutative59.6%
distribute-rgt1-in39.0%
fma-define59.7%
+-commutative59.7%
+-commutative59.7%
cube-unmult59.7%
+-commutative59.7%
Simplified59.7%
*-commutative59.7%
fma-define39.0%
cube-mult39.0%
distribute-rgt1-in59.6%
*-commutative59.6%
associate-*l*59.7%
times-frac88.9%
associate-+r+88.9%
Applied egg-rr88.9%
clear-num88.8%
inv-pow88.8%
+-commutative88.8%
Applied egg-rr88.8%
unpow-188.8%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in y around 0 98.6%
associate-+r+98.6%
+-commutative98.6%
associate-+r+98.6%
Simplified98.6%
Taylor expanded in x around inf 44.3%
*-commutative44.3%
Simplified44.3%
if -4.20000000000000027e-278 < y < 4.2000000000000001e-160Initial program 58.7%
+-commutative58.7%
+-commutative58.7%
+-commutative58.7%
*-commutative58.7%
distribute-rgt1-in42.5%
fma-define58.7%
+-commutative58.7%
+-commutative58.7%
cube-unmult58.8%
+-commutative58.8%
Simplified58.8%
*-commutative58.8%
fma-define42.5%
cube-mult42.5%
distribute-rgt1-in58.7%
*-commutative58.7%
associate-*l*58.7%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
associate-*r/99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/59.8%
associate-*r/100.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 87.6%
+-commutative87.6%
Simplified87.6%
if 4.2000000000000001e-160 < y < 8.99999999999999969e73Initial program 89.0%
associate-/l*94.9%
associate-+l+94.9%
Simplified94.9%
if 8.99999999999999969e73 < y Initial program 50.0%
+-commutative50.0%
+-commutative50.0%
+-commutative50.0%
*-commutative50.0%
distribute-rgt1-in50.0%
fma-define50.0%
+-commutative50.0%
+-commutative50.0%
cube-unmult50.0%
+-commutative50.0%
Simplified50.0%
*-commutative50.0%
fma-define50.0%
cube-mult50.0%
distribute-rgt1-in50.0%
*-commutative50.0%
associate-*l*50.0%
times-frac77.6%
associate-+r+77.6%
Applied egg-rr77.6%
Taylor expanded in y around inf 77.6%
*-un-lft-identity77.6%
associate-/r*80.3%
+-commutative80.3%
Applied egg-rr80.3%
Final simplification68.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))) (t_1 (/ x (+ y x))))
(if (<= x -1.06e+163)
(* (/ y (+ y x)) (/ 1.0 (+ (+ x 1.0) (* y 2.0))))
(if (<= x -5.8e-12)
(* y (/ 1.0 (* (+ y x) t_0)))
(if (<= x 1e-150) (* y (/ t_1 (* (+ y x) (+ y 1.0)))) (/ t_1 t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = x / (y + x);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (x <= -5.8e-12) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= 1e-150) {
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
} else {
tmp = t_1 / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + (y + 1.0d0)
t_1 = x / (y + x)
if (x <= (-1.06d+163)) then
tmp = (y / (y + x)) * (1.0d0 / ((x + 1.0d0) + (y * 2.0d0)))
else if (x <= (-5.8d-12)) then
tmp = y * (1.0d0 / ((y + x) * t_0))
else if (x <= 1d-150) then
tmp = y * (t_1 / ((y + x) * (y + 1.0d0)))
else
tmp = t_1 / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = x / (y + x);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (x <= -5.8e-12) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= 1e-150) {
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
} else {
tmp = t_1 / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) t_1 = x / (y + x) tmp = 0 if x <= -1.06e+163: tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0))) elif x <= -5.8e-12: tmp = y * (1.0 / ((y + x) * t_0)) elif x <= 1e-150: tmp = y * (t_1 / ((y + x) * (y + 1.0))) else: tmp = t_1 / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) t_1 = Float64(x / Float64(y + x)) tmp = 0.0 if (x <= -1.06e+163) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(Float64(x + 1.0) + Float64(y * 2.0)))); elseif (x <= -5.8e-12) tmp = Float64(y * Float64(1.0 / Float64(Float64(y + x) * t_0))); elseif (x <= 1e-150) tmp = Float64(y * Float64(t_1 / Float64(Float64(y + x) * Float64(y + 1.0)))); else tmp = Float64(t_1 / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
t_1 = x / (y + x);
tmp = 0.0;
if (x <= -1.06e+163)
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
elseif (x <= -5.8e-12)
tmp = y * (1.0 / ((y + x) * t_0));
elseif (x <= 1e-150)
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
else
tmp = t_1 / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.06e+163], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.8e-12], N[(y * N[(1.0 / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-150], N[(y * N[(t$95$1 / N[(N[(y + x), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
t_1 := \frac{x}{y + x}\\
\mathbf{if}\;x \leq -1.06 \cdot 10^{+163}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-12}:\\
\;\;\;\;y \cdot \frac{1}{\left(y + x\right) \cdot t\_0}\\
\mathbf{elif}\;x \leq 10^{-150}:\\
\;\;\;\;y \cdot \frac{t\_1}{\left(y + x\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_0}\\
\end{array}
\end{array}
if x < -1.06e163Initial program 46.5%
+-commutative46.5%
+-commutative46.5%
+-commutative46.5%
*-commutative46.5%
distribute-rgt1-in0.0%
fma-define46.5%
+-commutative46.5%
+-commutative46.5%
cube-unmult46.5%
+-commutative46.5%
Simplified46.5%
*-commutative46.5%
fma-define0.0%
cube-mult0.0%
distribute-rgt1-in46.5%
*-commutative46.5%
associate-*l*46.5%
times-frac78.0%
associate-+r+78.0%
Applied egg-rr78.0%
clear-num78.0%
inv-pow78.0%
+-commutative78.0%
Applied egg-rr78.0%
unpow-178.0%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in y around 0 96.8%
associate-+r+96.8%
+-commutative96.8%
associate-+r+96.8%
Simplified96.8%
Taylor expanded in x around inf 80.1%
*-commutative80.1%
Simplified80.1%
if -1.06e163 < x < -5.8000000000000003e-12Initial program 77.6%
+-commutative77.6%
+-commutative77.6%
+-commutative77.6%
*-commutative77.6%
distribute-rgt1-in69.8%
fma-define77.7%
+-commutative77.7%
+-commutative77.7%
cube-unmult77.6%
+-commutative77.6%
Simplified77.6%
*-commutative77.6%
fma-define69.7%
cube-mult69.8%
distribute-rgt1-in77.6%
*-commutative77.6%
associate-*l*77.7%
times-frac95.2%
associate-+r+95.2%
Applied egg-rr95.2%
associate-*r/95.3%
+-commutative95.3%
+-commutative95.3%
Applied egg-rr95.3%
associate-*l/92.6%
associate-*r/95.3%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in x around inf 76.2%
if -5.8000000000000003e-12 < x < 1.00000000000000001e-150Initial program 59.0%
+-commutative59.0%
+-commutative59.0%
+-commutative59.0%
*-commutative59.0%
distribute-rgt1-in46.8%
fma-define59.0%
+-commutative59.0%
+-commutative59.0%
cube-unmult59.1%
+-commutative59.1%
Simplified59.1%
*-commutative59.1%
fma-define46.9%
cube-mult46.8%
distribute-rgt1-in59.0%
*-commutative59.0%
associate-*l*59.0%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
associate-*r/99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/59.9%
associate-*r/99.9%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in x around 0 96.9%
+-commutative96.9%
Simplified96.9%
if 1.00000000000000001e-150 < x Initial program 70.6%
+-commutative70.6%
+-commutative70.6%
+-commutative70.6%
*-commutative70.6%
distribute-rgt1-in62.2%
fma-define70.6%
+-commutative70.6%
+-commutative70.6%
cube-unmult70.6%
+-commutative70.6%
Simplified70.6%
*-commutative70.6%
fma-define62.2%
cube-mult62.2%
distribute-rgt1-in70.6%
*-commutative70.6%
associate-*l*70.5%
times-frac87.8%
associate-+r+87.8%
Applied egg-rr87.8%
Taylor expanded in y around inf 51.3%
*-un-lft-identity51.3%
associate-/r*38.2%
+-commutative38.2%
Applied egg-rr38.2%
Final simplification69.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))) (t_1 (/ x (+ y x))))
(if (<= x -1.06e+163)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -7.1e-12)
(* y (/ 1.0 (* (+ y x) t_0)))
(if (<= x 1e-150) (* y (/ t_1 (* (+ y x) (+ y 1.0)))) (/ t_1 t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = x / (y + x);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -7.1e-12) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= 1e-150) {
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
} else {
tmp = t_1 / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + (y + 1.0d0)
t_1 = x / (y + x)
if (x <= (-1.06d+163)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-7.1d-12)) then
tmp = y * (1.0d0 / ((y + x) * t_0))
else if (x <= 1d-150) then
tmp = y * (t_1 / ((y + x) * (y + 1.0d0)))
else
tmp = t_1 / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = x / (y + x);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -7.1e-12) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= 1e-150) {
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
} else {
tmp = t_1 / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) t_1 = x / (y + x) tmp = 0 if x <= -1.06e+163: tmp = (y / (y + x)) * (1.0 / x) elif x <= -7.1e-12: tmp = y * (1.0 / ((y + x) * t_0)) elif x <= 1e-150: tmp = y * (t_1 / ((y + x) * (y + 1.0))) else: tmp = t_1 / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) t_1 = Float64(x / Float64(y + x)) tmp = 0.0 if (x <= -1.06e+163) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -7.1e-12) tmp = Float64(y * Float64(1.0 / Float64(Float64(y + x) * t_0))); elseif (x <= 1e-150) tmp = Float64(y * Float64(t_1 / Float64(Float64(y + x) * Float64(y + 1.0)))); else tmp = Float64(t_1 / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
t_1 = x / (y + x);
tmp = 0.0;
if (x <= -1.06e+163)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -7.1e-12)
tmp = y * (1.0 / ((y + x) * t_0));
elseif (x <= 1e-150)
tmp = y * (t_1 / ((y + x) * (y + 1.0)));
else
tmp = t_1 / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.06e+163], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.1e-12], N[(y * N[(1.0 / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-150], N[(y * N[(t$95$1 / N[(N[(y + x), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
t_1 := \frac{x}{y + x}\\
\mathbf{if}\;x \leq -1.06 \cdot 10^{+163}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -7.1 \cdot 10^{-12}:\\
\;\;\;\;y \cdot \frac{1}{\left(y + x\right) \cdot t\_0}\\
\mathbf{elif}\;x \leq 10^{-150}:\\
\;\;\;\;y \cdot \frac{t\_1}{\left(y + x\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_0}\\
\end{array}
\end{array}
if x < -1.06e163Initial program 46.5%
+-commutative46.5%
+-commutative46.5%
+-commutative46.5%
*-commutative46.5%
distribute-rgt1-in0.0%
fma-define46.5%
+-commutative46.5%
+-commutative46.5%
cube-unmult46.5%
+-commutative46.5%
Simplified46.5%
*-commutative46.5%
fma-define0.0%
cube-mult0.0%
distribute-rgt1-in46.5%
*-commutative46.5%
associate-*l*46.5%
times-frac78.0%
associate-+r+78.0%
Applied egg-rr78.0%
Taylor expanded in x around inf 79.2%
if -1.06e163 < x < -7.1e-12Initial program 77.6%
+-commutative77.6%
+-commutative77.6%
+-commutative77.6%
*-commutative77.6%
distribute-rgt1-in69.8%
fma-define77.7%
+-commutative77.7%
+-commutative77.7%
cube-unmult77.6%
+-commutative77.6%
Simplified77.6%
*-commutative77.6%
fma-define69.7%
cube-mult69.8%
distribute-rgt1-in77.6%
*-commutative77.6%
associate-*l*77.7%
times-frac95.2%
associate-+r+95.2%
Applied egg-rr95.2%
associate-*r/95.3%
+-commutative95.3%
+-commutative95.3%
Applied egg-rr95.3%
associate-*l/92.6%
associate-*r/95.3%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in x around inf 76.2%
if -7.1e-12 < x < 1.00000000000000001e-150Initial program 59.0%
+-commutative59.0%
+-commutative59.0%
+-commutative59.0%
*-commutative59.0%
distribute-rgt1-in46.8%
fma-define59.0%
+-commutative59.0%
+-commutative59.0%
cube-unmult59.1%
+-commutative59.1%
Simplified59.1%
*-commutative59.1%
fma-define46.9%
cube-mult46.8%
distribute-rgt1-in59.0%
*-commutative59.0%
associate-*l*59.0%
times-frac99.9%
associate-+r+99.9%
Applied egg-rr99.9%
associate-*r/99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/59.9%
associate-*r/99.9%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in x around 0 96.9%
+-commutative96.9%
Simplified96.9%
if 1.00000000000000001e-150 < x Initial program 70.6%
+-commutative70.6%
+-commutative70.6%
+-commutative70.6%
*-commutative70.6%
distribute-rgt1-in62.2%
fma-define70.6%
+-commutative70.6%
+-commutative70.6%
cube-unmult70.6%
+-commutative70.6%
Simplified70.6%
*-commutative70.6%
fma-define62.2%
cube-mult62.2%
distribute-rgt1-in70.6%
*-commutative70.6%
associate-*l*70.5%
times-frac87.8%
associate-+r+87.8%
Applied egg-rr87.8%
Taylor expanded in y around inf 51.3%
*-un-lft-identity51.3%
associate-/r*38.2%
+-commutative38.2%
Applied egg-rr38.2%
Final simplification68.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= x -1.06e+163)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -9.5e-22)
(* y (/ 1.0 (* (+ y x) t_0)))
(if (<= x -1.05e-160)
(* x (/ y (* (+ y 1.0) (* (+ y x) (+ y x)))))
(/ (/ x (+ y x)) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -9.5e-22) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= -1.05e-160) {
tmp = x * (y / ((y + 1.0) * ((y + x) * (y + x))));
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (x <= (-1.06d+163)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-9.5d-22)) then
tmp = y * (1.0d0 / ((y + x) * t_0))
else if (x <= (-1.05d-160)) then
tmp = x * (y / ((y + 1.0d0) * ((y + x) * (y + x))))
else
tmp = (x / (y + x)) / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -9.5e-22) {
tmp = y * (1.0 / ((y + x) * t_0));
} else if (x <= -1.05e-160) {
tmp = x * (y / ((y + 1.0) * ((y + x) * (y + x))));
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if x <= -1.06e+163: tmp = (y / (y + x)) * (1.0 / x) elif x <= -9.5e-22: tmp = y * (1.0 / ((y + x) * t_0)) elif x <= -1.05e-160: tmp = x * (y / ((y + 1.0) * ((y + x) * (y + x)))) else: tmp = (x / (y + x)) / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (x <= -1.06e+163) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -9.5e-22) tmp = Float64(y * Float64(1.0 / Float64(Float64(y + x) * t_0))); elseif (x <= -1.05e-160) tmp = Float64(x * Float64(y / Float64(Float64(y + 1.0) * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / Float64(y + x)) / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (x <= -1.06e+163)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -9.5e-22)
tmp = y * (1.0 / ((y + x) * t_0));
elseif (x <= -1.05e-160)
tmp = x * (y / ((y + 1.0) * ((y + x) * (y + x))));
else
tmp = (x / (y + x)) / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.06e+163], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e-22], N[(y * N[(1.0 / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.05e-160], N[(x * N[(y / N[(N[(y + 1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;x \leq -1.06 \cdot 10^{+163}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-22}:\\
\;\;\;\;y \cdot \frac{1}{\left(y + x\right) \cdot t\_0}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-160}:\\
\;\;\;\;x \cdot \frac{y}{\left(y + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if x < -1.06e163Initial program 46.5%
+-commutative46.5%
+-commutative46.5%
+-commutative46.5%
*-commutative46.5%
distribute-rgt1-in0.0%
fma-define46.5%
+-commutative46.5%
+-commutative46.5%
cube-unmult46.5%
+-commutative46.5%
Simplified46.5%
*-commutative46.5%
fma-define0.0%
cube-mult0.0%
distribute-rgt1-in46.5%
*-commutative46.5%
associate-*l*46.5%
times-frac78.0%
associate-+r+78.0%
Applied egg-rr78.0%
Taylor expanded in x around inf 79.2%
if -1.06e163 < x < -9.4999999999999994e-22Initial program 79.2%
+-commutative79.2%
+-commutative79.2%
+-commutative79.2%
*-commutative79.2%
distribute-rgt1-in69.5%
fma-define79.3%
+-commutative79.3%
+-commutative79.3%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
*-commutative79.2%
fma-define69.4%
cube-mult69.5%
distribute-rgt1-in79.2%
*-commutative79.2%
associate-*l*79.3%
times-frac95.5%
associate-+r+95.5%
Applied egg-rr95.5%
associate-*r/95.7%
+-commutative95.7%
+-commutative95.7%
Applied egg-rr95.7%
associate-*l/93.2%
associate-*r/95.7%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in x around inf 75.7%
if -9.4999999999999994e-22 < x < -1.05e-160Initial program 90.9%
associate-/l*99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
+-commutative95.7%
Simplified99.6%
if -1.05e-160 < x Initial program 60.9%
+-commutative60.9%
+-commutative60.9%
+-commutative60.9%
*-commutative60.9%
distribute-rgt1-in51.8%
fma-define60.9%
+-commutative60.9%
+-commutative60.9%
cube-unmult61.0%
+-commutative61.0%
Simplified61.0%
*-commutative61.0%
fma-define51.8%
cube-mult51.8%
distribute-rgt1-in60.9%
*-commutative60.9%
associate-*l*60.9%
times-frac92.3%
associate-+r+92.3%
Applied egg-rr92.3%
Taylor expanded in y around inf 63.9%
*-un-lft-identity63.9%
associate-/r*55.6%
+-commutative55.6%
Applied egg-rr55.6%
Final simplification66.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))) (t_1 (/ y (+ y x))))
(if (<= x -3.8e+163)
(* t_1 (/ 1.0 (+ (+ x 1.0) (* y 2.0))))
(if (<= x 1e-150) (* t_1 (/ x (* (+ y x) t_0))) (/ (/ x (+ y x)) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = y / (y + x);
double tmp;
if (x <= -3.8e+163) {
tmp = t_1 * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (x <= 1e-150) {
tmp = t_1 * (x / ((y + x) * t_0));
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + (y + 1.0d0)
t_1 = y / (y + x)
if (x <= (-3.8d+163)) then
tmp = t_1 * (1.0d0 / ((x + 1.0d0) + (y * 2.0d0)))
else if (x <= 1d-150) then
tmp = t_1 * (x / ((y + x) * t_0))
else
tmp = (x / (y + x)) / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double t_1 = y / (y + x);
double tmp;
if (x <= -3.8e+163) {
tmp = t_1 * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (x <= 1e-150) {
tmp = t_1 * (x / ((y + x) * t_0));
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) t_1 = y / (y + x) tmp = 0 if x <= -3.8e+163: tmp = t_1 * (1.0 / ((x + 1.0) + (y * 2.0))) elif x <= 1e-150: tmp = t_1 * (x / ((y + x) * t_0)) else: tmp = (x / (y + x)) / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) t_1 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -3.8e+163) tmp = Float64(t_1 * Float64(1.0 / Float64(Float64(x + 1.0) + Float64(y * 2.0)))); elseif (x <= 1e-150) tmp = Float64(t_1 * Float64(x / Float64(Float64(y + x) * t_0))); else tmp = Float64(Float64(x / Float64(y + x)) / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
t_1 = y / (y + x);
tmp = 0.0;
if (x <= -3.8e+163)
tmp = t_1 * (1.0 / ((x + 1.0) + (y * 2.0)));
elseif (x <= 1e-150)
tmp = t_1 * (x / ((y + x) * t_0));
else
tmp = (x / (y + x)) / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.8e+163], N[(t$95$1 * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-150], N[(t$95$1 * N[(x / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
t_1 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+163}:\\
\;\;\;\;t\_1 \cdot \frac{1}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;x \leq 10^{-150}:\\
\;\;\;\;t\_1 \cdot \frac{x}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if x < -3.80000000000000008e163Initial program 46.5%
+-commutative46.5%
+-commutative46.5%
+-commutative46.5%
*-commutative46.5%
distribute-rgt1-in0.0%
fma-define46.5%
+-commutative46.5%
+-commutative46.5%
cube-unmult46.5%
+-commutative46.5%
Simplified46.5%
*-commutative46.5%
fma-define0.0%
cube-mult0.0%
distribute-rgt1-in46.5%
*-commutative46.5%
associate-*l*46.5%
times-frac78.0%
associate-+r+78.0%
Applied egg-rr78.0%
clear-num78.0%
inv-pow78.0%
+-commutative78.0%
Applied egg-rr78.0%
unpow-178.0%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in y around 0 96.8%
associate-+r+96.8%
+-commutative96.8%
associate-+r+96.8%
Simplified96.8%
Taylor expanded in x around inf 80.1%
*-commutative80.1%
Simplified80.1%
if -3.80000000000000008e163 < x < 1.00000000000000001e-150Initial program 64.9%
+-commutative64.9%
+-commutative64.9%
+-commutative64.9%
*-commutative64.9%
distribute-rgt1-in54.1%
fma-define64.9%
+-commutative64.9%
+-commutative64.9%
cube-unmult64.9%
+-commutative64.9%
Simplified64.9%
*-commutative64.9%
fma-define54.1%
cube-mult54.1%
distribute-rgt1-in64.9%
*-commutative64.9%
associate-*l*64.9%
times-frac98.4%
associate-+r+98.4%
Applied egg-rr98.4%
if 1.00000000000000001e-150 < x Initial program 70.6%
+-commutative70.6%
+-commutative70.6%
+-commutative70.6%
*-commutative70.6%
distribute-rgt1-in62.2%
fma-define70.6%
+-commutative70.6%
+-commutative70.6%
cube-unmult70.6%
+-commutative70.6%
Simplified70.6%
*-commutative70.6%
fma-define62.2%
cube-mult62.2%
distribute-rgt1-in70.6%
*-commutative70.6%
associate-*l*70.5%
times-frac87.8%
associate-+r+87.8%
Applied egg-rr87.8%
Taylor expanded in y around inf 51.3%
*-un-lft-identity51.3%
associate-/r*38.2%
+-commutative38.2%
Applied egg-rr38.2%
Final simplification72.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y x))) (t_1 (+ x (+ y 1.0))))
(if (<= y -5e-279)
(* (/ y (+ y x)) (/ 1.0 (+ (+ x 1.0) (* y 2.0))))
(if (<= y 1.02e+63) (* y (/ t_0 (* (+ y x) t_1))) (/ t_0 t_1)))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = x + (y + 1.0);
double tmp;
if (y <= -5e-279) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (y <= 1.02e+63) {
tmp = y * (t_0 / ((y + x) * t_1));
} else {
tmp = t_0 / t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y + x)
t_1 = x + (y + 1.0d0)
if (y <= (-5d-279)) then
tmp = (y / (y + x)) * (1.0d0 / ((x + 1.0d0) + (y * 2.0d0)))
else if (y <= 1.02d+63) then
tmp = y * (t_0 / ((y + x) * t_1))
else
tmp = t_0 / t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = x + (y + 1.0);
double tmp;
if (y <= -5e-279) {
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
} else if (y <= 1.02e+63) {
tmp = y * (t_0 / ((y + x) * t_1));
} else {
tmp = t_0 / t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y + x) t_1 = x + (y + 1.0) tmp = 0 if y <= -5e-279: tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0))) elif y <= 1.02e+63: tmp = y * (t_0 / ((y + x) * t_1)) else: tmp = t_0 / t_1 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y + x)) t_1 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= -5e-279) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(Float64(x + 1.0) + Float64(y * 2.0)))); elseif (y <= 1.02e+63) tmp = Float64(y * Float64(t_0 / Float64(Float64(y + x) * t_1))); else tmp = Float64(t_0 / t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y + x);
t_1 = x + (y + 1.0);
tmp = 0.0;
if (y <= -5e-279)
tmp = (y / (y + x)) * (1.0 / ((x + 1.0) + (y * 2.0)));
elseif (y <= 1.02e+63)
tmp = y * (t_0 / ((y + x) * t_1));
else
tmp = t_0 / t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e-279], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+63], N[(y * N[(t$95$0 / N[(N[(y + x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
t_1 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{-279}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+63}:\\
\;\;\;\;y \cdot \frac{t\_0}{\left(y + x\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{t\_1}\\
\end{array}
\end{array}
if y < -4.99999999999999969e-279Initial program 59.6%
+-commutative59.6%
+-commutative59.6%
+-commutative59.6%
*-commutative59.6%
distribute-rgt1-in39.0%
fma-define59.7%
+-commutative59.7%
+-commutative59.7%
cube-unmult59.7%
+-commutative59.7%
Simplified59.7%
*-commutative59.7%
fma-define39.0%
cube-mult39.0%
distribute-rgt1-in59.6%
*-commutative59.6%
associate-*l*59.7%
times-frac88.9%
associate-+r+88.9%
Applied egg-rr88.9%
clear-num88.8%
inv-pow88.8%
+-commutative88.8%
Applied egg-rr88.8%
unpow-188.8%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in y around 0 98.6%
associate-+r+98.6%
+-commutative98.6%
associate-+r+98.6%
Simplified98.6%
Taylor expanded in x around inf 44.3%
*-commutative44.3%
Simplified44.3%
if -4.99999999999999969e-279 < y < 1.02e63Initial program 75.5%
+-commutative75.5%
+-commutative75.5%
+-commutative75.5%
*-commutative75.5%
distribute-rgt1-in60.0%
fma-define75.5%
+-commutative75.5%
+-commutative75.5%
cube-unmult75.5%
+-commutative75.5%
Simplified75.5%
*-commutative75.5%
fma-define60.0%
cube-mult60.0%
distribute-rgt1-in75.5%
*-commutative75.5%
associate-*l*75.4%
times-frac99.8%
associate-+r+99.8%
Applied egg-rr99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/77.1%
associate-*r/99.9%
associate-/l*99.2%
Simplified99.2%
if 1.02e63 < y Initial program 51.2%
+-commutative51.2%
+-commutative51.2%
+-commutative51.2%
*-commutative51.2%
distribute-rgt1-in51.2%
fma-define51.2%
+-commutative51.2%
+-commutative51.2%
cube-unmult51.2%
+-commutative51.2%
Simplified51.2%
*-commutative51.2%
fma-define51.2%
cube-mult51.2%
distribute-rgt1-in51.2%
*-commutative51.2%
associate-*l*51.2%
times-frac78.2%
associate-+r+78.2%
Applied egg-rr78.2%
Taylor expanded in y around inf 78.2%
*-un-lft-identity78.2%
associate-/r*80.7%
+-commutative80.7%
Applied egg-rr80.7%
Final simplification71.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= y 1.85e-159)
(* (/ y (+ y x)) (/ 1.0 (+ x 1.0)))
(if (<= y 2.1e-27)
(* x (/ y (* (+ x 1.0) (* (+ y x) (+ y x)))))
(if (<= y 9e+73) (/ x (* (+ y x) t_0)) (/ (/ x (+ y x)) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 1.85e-159) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else if (y <= 2.1e-27) {
tmp = x * (y / ((x + 1.0) * ((y + x) * (y + x))));
} else if (y <= 9e+73) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (y <= 1.85d-159) then
tmp = (y / (y + x)) * (1.0d0 / (x + 1.0d0))
else if (y <= 2.1d-27) then
tmp = x * (y / ((x + 1.0d0) * ((y + x) * (y + x))))
else if (y <= 9d+73) then
tmp = x / ((y + x) * t_0)
else
tmp = (x / (y + x)) / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 1.85e-159) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else if (y <= 2.1e-27) {
tmp = x * (y / ((x + 1.0) * ((y + x) * (y + x))));
} else if (y <= 9e+73) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 1.85e-159: tmp = (y / (y + x)) * (1.0 / (x + 1.0)) elif y <= 2.1e-27: tmp = x * (y / ((x + 1.0) * ((y + x) * (y + x)))) elif y <= 9e+73: tmp = x / ((y + x) * t_0) else: tmp = (x / (y + x)) / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 1.85e-159) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(x + 1.0))); elseif (y <= 2.1e-27) tmp = Float64(x * Float64(y / Float64(Float64(x + 1.0) * Float64(Float64(y + x) * Float64(y + x))))); elseif (y <= 9e+73) tmp = Float64(x / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / Float64(y + x)) / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (y <= 1.85e-159)
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
elseif (y <= 2.1e-27)
tmp = x * (y / ((x + 1.0) * ((y + x) * (y + x))));
elseif (y <= 9e+73)
tmp = x / ((y + x) * t_0);
else
tmp = (x / (y + x)) / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.85e-159], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e-27], N[(x * N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+73], N[(x / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 1.85 \cdot 10^{-159}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-27}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+73}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if y < 1.8499999999999999e-159Initial program 59.7%
+-commutative59.7%
+-commutative59.7%
+-commutative59.7%
*-commutative59.7%
distribute-rgt1-in40.3%
fma-define59.7%
+-commutative59.7%
+-commutative59.7%
cube-unmult59.7%
+-commutative59.7%
Simplified59.7%
*-commutative59.7%
fma-define40.3%
cube-mult40.3%
distribute-rgt1-in59.7%
*-commutative59.7%
associate-*l*59.7%
times-frac91.9%
associate-+r+91.9%
Applied egg-rr91.9%
Taylor expanded in y around 0 54.5%
+-commutative54.5%
Simplified54.5%
if 1.8499999999999999e-159 < y < 2.10000000000000015e-27Initial program 84.3%
associate-/l*96.3%
associate-+l+96.3%
Simplified96.3%
Taylor expanded in y around 0 96.3%
+-commutative96.3%
Simplified96.3%
if 2.10000000000000015e-27 < y < 8.99999999999999969e73Initial program 95.3%
+-commutative95.3%
+-commutative95.3%
+-commutative95.3%
*-commutative95.3%
distribute-rgt1-in77.2%
fma-define95.3%
+-commutative95.3%
+-commutative95.3%
cube-unmult95.4%
+-commutative95.4%
Simplified95.4%
*-commutative95.4%
fma-define77.2%
cube-mult77.2%
distribute-rgt1-in95.3%
*-commutative95.3%
associate-*l*95.3%
times-frac99.7%
associate-+r+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 82.4%
if 8.99999999999999969e73 < y Initial program 50.0%
+-commutative50.0%
+-commutative50.0%
+-commutative50.0%
*-commutative50.0%
distribute-rgt1-in50.0%
fma-define50.0%
+-commutative50.0%
+-commutative50.0%
cube-unmult50.0%
+-commutative50.0%
Simplified50.0%
*-commutative50.0%
fma-define50.0%
cube-mult50.0%
distribute-rgt1-in50.0%
*-commutative50.0%
associate-*l*50.0%
times-frac77.6%
associate-+r+77.6%
Applied egg-rr77.6%
Taylor expanded in y around inf 77.6%
*-un-lft-identity77.6%
associate-/r*80.3%
+-commutative80.3%
Applied egg-rr80.3%
Final simplification66.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= y 2.9e-185)
(* (/ y (+ y x)) (/ 1.0 (+ x 1.0)))
(if (<= y 9e+73) (/ x (* (+ y x) t_0)) (/ (/ x (+ y x)) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 2.9e-185) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else if (y <= 9e+73) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (y <= 2.9d-185) then
tmp = (y / (y + x)) * (1.0d0 / (x + 1.0d0))
else if (y <= 9d+73) then
tmp = x / ((y + x) * t_0)
else
tmp = (x / (y + x)) / t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 2.9e-185) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else if (y <= 9e+73) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 2.9e-185: tmp = (y / (y + x)) * (1.0 / (x + 1.0)) elif y <= 9e+73: tmp = x / ((y + x) * t_0) else: tmp = (x / (y + x)) / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 2.9e-185) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(x + 1.0))); elseif (y <= 9e+73) tmp = Float64(x / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / Float64(y + x)) / t_0); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (y <= 2.9e-185)
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
elseif (y <= 9e+73)
tmp = x / ((y + x) * t_0);
else
tmp = (x / (y + x)) / t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.9e-185], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+73], N[(x / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 2.9 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+73}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if y < 2.89999999999999995e-185Initial program 59.0%
+-commutative59.0%
+-commutative59.0%
+-commutative59.0%
*-commutative59.0%
distribute-rgt1-in39.6%
fma-define59.0%
+-commutative59.0%
+-commutative59.0%
cube-unmult59.0%
+-commutative59.0%
Simplified59.0%
*-commutative59.0%
fma-define39.6%
cube-mult39.6%
distribute-rgt1-in59.0%
*-commutative59.0%
associate-*l*59.0%
times-frac91.4%
associate-+r+91.4%
Applied egg-rr91.4%
Taylor expanded in y around 0 53.4%
+-commutative53.4%
Simplified53.4%
if 2.89999999999999995e-185 < y < 8.99999999999999969e73Initial program 85.9%
+-commutative85.9%
+-commutative85.9%
+-commutative85.9%
*-commutative85.9%
distribute-rgt1-in70.3%
fma-define85.9%
+-commutative85.9%
+-commutative85.9%
cube-unmult85.9%
+-commutative85.9%
Simplified85.9%
*-commutative85.9%
fma-define70.3%
cube-mult70.3%
distribute-rgt1-in85.9%
*-commutative85.9%
associate-*l*85.9%
times-frac99.8%
associate-+r+99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 70.9%
if 8.99999999999999969e73 < y Initial program 50.0%
+-commutative50.0%
+-commutative50.0%
+-commutative50.0%
*-commutative50.0%
distribute-rgt1-in50.0%
fma-define50.0%
+-commutative50.0%
+-commutative50.0%
cube-unmult50.0%
+-commutative50.0%
Simplified50.0%
*-commutative50.0%
fma-define50.0%
cube-mult50.0%
distribute-rgt1-in50.0%
*-commutative50.0%
associate-*l*50.0%
times-frac77.6%
associate-+r+77.6%
Applied egg-rr77.6%
Taylor expanded in y around inf 77.6%
*-un-lft-identity77.6%
associate-/r*80.3%
+-commutative80.3%
Applied egg-rr80.3%
Final simplification62.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* y (/ 1.0 (+ y x))) (* (+ y x) (/ (+ x (+ y 1.0)) x))))
assert(x < y);
double code(double x, double y) {
return (y * (1.0 / (y + x))) / ((y + x) * ((x + (y + 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 = (y * (1.0d0 / (y + x))) / ((y + x) * ((x + (y + 1.0d0)) / x))
end function
assert x < y;
public static double code(double x, double y) {
return (y * (1.0 / (y + x))) / ((y + x) * ((x + (y + 1.0)) / x));
}
[x, y] = sort([x, y]) def code(x, y): return (y * (1.0 / (y + x))) / ((y + x) * ((x + (y + 1.0)) / x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y * Float64(1.0 / Float64(y + x))) / Float64(Float64(y + x) * Float64(Float64(x + Float64(y + 1.0)) / x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y * (1.0 / (y + x))) / ((y + x) * ((x + (y + 1.0)) / x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y \cdot \frac{1}{y + x}}{\left(y + x\right) \cdot \frac{x + \left(y + 1\right)}{x}}
\end{array}
Initial program 64.3%
+-commutative64.3%
+-commutative64.3%
+-commutative64.3%
*-commutative64.3%
distribute-rgt1-in48.9%
fma-define64.3%
+-commutative64.3%
+-commutative64.3%
cube-unmult64.3%
+-commutative64.3%
Simplified64.3%
*-commutative64.3%
fma-define48.9%
cube-mult48.9%
distribute-rgt1-in64.3%
*-commutative64.3%
associate-*l*64.3%
times-frac91.3%
associate-+r+91.3%
Applied egg-rr91.3%
clear-num91.0%
inv-pow91.0%
+-commutative91.0%
Applied egg-rr91.0%
unpow-191.0%
associate-/l*98.9%
Simplified98.9%
*-commutative98.9%
associate-/r*99.7%
+-commutative99.7%
frac-times99.0%
+-commutative99.0%
*-commutative99.0%
+-commutative99.0%
Applied egg-rr99.0%
Final simplification99.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.06e+163) (* (/ y (+ y x)) (/ 1.0 x)) (if (<= x -1.3e-65) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -1.3e-65) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.06d+163)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-1.3d-65)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.06e+163) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -1.3e-65) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.06e+163: tmp = (y / (y + x)) * (1.0 / x) elif x <= -1.3e-65: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.06e+163) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -1.3e-65) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.06e+163)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -1.3e-65)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.06e+163], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-65], 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.06 \cdot 10^{+163}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-65}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.06e163Initial program 46.5%
+-commutative46.5%
+-commutative46.5%
+-commutative46.5%
*-commutative46.5%
distribute-rgt1-in0.0%
fma-define46.5%
+-commutative46.5%
+-commutative46.5%
cube-unmult46.5%
+-commutative46.5%
Simplified46.5%
*-commutative46.5%
fma-define0.0%
cube-mult0.0%
distribute-rgt1-in46.5%
*-commutative46.5%
associate-*l*46.5%
times-frac78.0%
associate-+r+78.0%
Applied egg-rr78.0%
Taylor expanded in x around inf 79.2%
if -1.06e163 < x < -1.30000000000000005e-65Initial program 81.1%
associate-/l*82.1%
associate-+l+82.1%
Simplified82.1%
Taylor expanded in y around 0 57.2%
+-commutative57.2%
Simplified57.2%
if -1.30000000000000005e-65 < x Initial program 63.9%
associate-/l*78.5%
associate-+l+78.5%
Simplified78.5%
Taylor expanded in x around 0 56.7%
associate-/r*58.2%
+-commutative58.2%
Simplified58.2%
Final simplification61.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ y (+ y x)) (* (+ y x) (/ (+ x (+ y 1.0)) x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) / ((y + x) * ((x + (y + 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 = (y / (y + x)) / ((y + x) * ((x + (y + 1.0d0)) / x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) / ((y + x) * ((x + (y + 1.0)) / x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) / ((y + x) * ((x + (y + 1.0)) / x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) / Float64(Float64(y + x) * Float64(Float64(x + Float64(y + 1.0)) / x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) / ((y + x) * ((x + (y + 1.0)) / x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{\left(y + x\right) \cdot \frac{x + \left(y + 1\right)}{x}}
\end{array}
Initial program 64.3%
+-commutative64.3%
+-commutative64.3%
+-commutative64.3%
*-commutative64.3%
distribute-rgt1-in48.9%
fma-define64.3%
+-commutative64.3%
+-commutative64.3%
cube-unmult64.3%
+-commutative64.3%
Simplified64.3%
*-commutative64.3%
fma-define48.9%
cube-mult48.9%
distribute-rgt1-in64.3%
*-commutative64.3%
associate-*l*64.3%
times-frac91.3%
associate-+r+91.3%
Applied egg-rr91.3%
clear-num91.0%
inv-pow91.0%
+-commutative91.0%
Applied egg-rr91.0%
unpow-191.0%
associate-/l*98.9%
Simplified98.9%
un-div-inv99.0%
+-commutative99.0%
Applied egg-rr99.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -6.5e-64) (* (/ y (+ y x)) (/ 1.0 (+ x 1.0))) (/ (/ x (+ y x)) (+ x (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.5e-64) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else {
tmp = (x / (y + x)) / (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 <= (-6.5d-64)) then
tmp = (y / (y + x)) * (1.0d0 / (x + 1.0d0))
else
tmp = (x / (y + x)) / (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 <= -6.5e-64) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else {
tmp = (x / (y + x)) / (x + (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.5e-64: tmp = (y / (y + x)) * (1.0 / (x + 1.0)) else: tmp = (x / (y + x)) / (x + (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -6.5e-64) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + x)) / 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 <= -6.5e-64)
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
else
tmp = (x / (y + x)) / (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, -6.5e-64], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $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 -6.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{x + \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -6.5000000000000004e-64Initial program 65.0%
+-commutative65.0%
+-commutative65.0%
+-commutative65.0%
*-commutative65.0%
distribute-rgt1-in37.5%
fma-define65.0%
+-commutative65.0%
+-commutative65.0%
cube-unmult65.0%
+-commutative65.0%
Simplified65.0%
*-commutative65.0%
fma-define37.4%
cube-mult37.5%
distribute-rgt1-in65.0%
*-commutative65.0%
associate-*l*65.0%
times-frac87.6%
associate-+r+87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 66.5%
+-commutative66.5%
Simplified66.5%
if -6.5000000000000004e-64 < x Initial program 63.9%
+-commutative63.9%
+-commutative63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt1-in54.5%
fma-define63.9%
+-commutative63.9%
+-commutative63.9%
cube-unmult63.9%
+-commutative63.9%
Simplified63.9%
*-commutative63.9%
fma-define54.6%
cube-mult54.5%
distribute-rgt1-in63.9%
*-commutative63.9%
associate-*l*63.9%
times-frac93.1%
associate-+r+93.1%
Applied egg-rr93.1%
Taylor expanded in y around inf 66.3%
*-un-lft-identity66.3%
associate-/r*58.9%
+-commutative58.9%
Applied egg-rr58.9%
Final simplification61.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.2e-68) (* (/ y (+ y x)) (/ 1.0 (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.2e-68) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.2d-68)) then
tmp = (y / (y + x)) * (1.0d0 / (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4.2e-68) {
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.2e-68: tmp = (y / (y + x)) * (1.0 / (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.2e-68) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4.2e-68)
tmp = (y / (y + x)) * (1.0 / (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4.2e-68], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / 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 -4.2 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.20000000000000016e-68Initial program 65.0%
+-commutative65.0%
+-commutative65.0%
+-commutative65.0%
*-commutative65.0%
distribute-rgt1-in37.5%
fma-define65.0%
+-commutative65.0%
+-commutative65.0%
cube-unmult65.0%
+-commutative65.0%
Simplified65.0%
*-commutative65.0%
fma-define37.4%
cube-mult37.5%
distribute-rgt1-in65.0%
*-commutative65.0%
associate-*l*65.0%
times-frac87.6%
associate-+r+87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 66.5%
+-commutative66.5%
Simplified66.5%
if -4.20000000000000016e-68 < x Initial program 63.9%
associate-/l*78.5%
associate-+l+78.5%
Simplified78.5%
Taylor expanded in x around 0 56.7%
associate-/r*58.2%
+-commutative58.2%
Simplified58.2%
Final simplification60.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (or (<= y -8e-39) (not (<= y 0.76))) (/ x (* y y)) (- (/ x y) x)))
assert(x < y);
double code(double x, double y) {
double tmp;
if ((y <= -8e-39) || !(y <= 0.76)) {
tmp = x / (y * y);
} else {
tmp = (x / y) - x;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-8d-39)) .or. (.not. (y <= 0.76d0))) then
tmp = x / (y * y)
else
tmp = (x / y) - x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if ((y <= -8e-39) || !(y <= 0.76)) {
tmp = x / (y * y);
} else {
tmp = (x / y) - x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if (y <= -8e-39) or not (y <= 0.76): tmp = x / (y * y) else: tmp = (x / y) - x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if ((y <= -8e-39) || !(y <= 0.76)) tmp = Float64(x / Float64(y * y)); else tmp = Float64(Float64(x / y) - x); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if ((y <= -8e-39) || ~((y <= 0.76)))
tmp = x / (y * y);
else
tmp = (x / y) - x;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[Or[LessEqual[y, -8e-39], N[Not[LessEqual[y, 0.76]], $MachinePrecision]], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-39} \lor \neg \left(y \leq 0.76\right):\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - x\\
\end{array}
\end{array}
if y < -7.99999999999999943e-39 or 0.76000000000000001 < y Initial program 59.5%
associate-/l*76.5%
associate-+l+76.5%
Simplified76.5%
Taylor expanded in x around 0 66.8%
Taylor expanded in y around inf 64.6%
if -7.99999999999999943e-39 < y < 0.76000000000000001Initial program 69.2%
associate-/l*81.7%
associate-+l+81.7%
Simplified81.7%
Taylor expanded in x around 0 30.4%
associate-/r*30.4%
+-commutative30.4%
Simplified30.4%
Taylor expanded in y around 0 29.8%
associate-*r*29.8%
neg-mul-129.8%
Simplified29.8%
Taylor expanded in y around inf 29.8%
+-commutative29.8%
mul-1-neg29.8%
unsub-neg29.8%
Simplified29.8%
Final simplification47.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.8e-63) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.8e-63) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.8d-63)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4.8e-63) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.8e-63: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.8e-63) 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 <= -4.8e-63)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4.8e-63], 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 -4.8 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.8000000000000001e-63Initial program 65.0%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in y around 0 66.8%
+-commutative66.8%
Simplified66.8%
if -4.8000000000000001e-63 < x Initial program 63.9%
associate-/l*78.5%
associate-+l+78.5%
Simplified78.5%
Taylor expanded in x around 0 56.7%
associate-/r*58.2%
+-commutative58.2%
Simplified58.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.3e-63) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.3e-63) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.3d-63)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4.3e-63) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.3e-63: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.3e-63) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4.3e-63)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4.3e-63], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -4.2999999999999999e-63Initial program 65.0%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in y around 0 66.8%
+-commutative66.8%
Simplified66.8%
if -4.2999999999999999e-63 < x Initial program 63.9%
associate-/l*78.5%
associate-+l+78.5%
Simplified78.5%
Taylor expanded in x around 0 56.7%
Final simplification60.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -6.5e+23) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.5e+23) {
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 <= (-6.5d+23)) 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 <= -6.5e+23) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.5e+23: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -6.5e+23) 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 <= -6.5e+23)
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, -6.5e+23], 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 -6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -6.4999999999999996e23Initial program 57.5%
+-commutative57.5%
+-commutative57.5%
+-commutative57.5%
*-commutative57.5%
distribute-rgt1-in27.4%
fma-define57.5%
+-commutative57.5%
+-commutative57.5%
cube-unmult57.4%
+-commutative57.4%
Simplified57.4%
*-commutative57.4%
fma-define27.3%
cube-mult27.4%
distribute-rgt1-in57.5%
*-commutative57.5%
associate-*l*57.5%
times-frac85.7%
associate-+r+85.7%
Applied egg-rr85.7%
Taylor expanded in y around inf 61.5%
Taylor expanded in x around inf 6.7%
if -6.4999999999999996e23 < x Initial program 66.7%
associate-/l*80.0%
associate-+l+80.0%
Simplified80.0%
Taylor expanded in x around 0 57.1%
Taylor expanded in y around 0 32.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
return x / (y * (y + 1.0));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * (y + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * (y + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * Float64(y + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Initial program 64.3%
associate-/l*79.1%
associate-+l+79.1%
Simplified79.1%
Taylor expanded in x around 0 48.9%
Final simplification48.9%
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.3%
+-commutative64.3%
+-commutative64.3%
+-commutative64.3%
*-commutative64.3%
distribute-rgt1-in48.9%
fma-define64.3%
+-commutative64.3%
+-commutative64.3%
cube-unmult64.3%
+-commutative64.3%
Simplified64.3%
*-commutative64.3%
fma-define48.9%
cube-mult48.9%
distribute-rgt1-in64.3%
*-commutative64.3%
associate-*l*64.3%
times-frac91.3%
associate-+r+91.3%
Applied egg-rr91.3%
Taylor expanded in y around inf 64.7%
Taylor expanded in x around inf 4.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 0.5)
assert(x < y);
double code(double x, double y) {
return 0.5;
}
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 = 0.5d0
end function
assert x < y;
public static double code(double x, double y) {
return 0.5;
}
[x, y] = sort([x, y]) def code(x, y): return 0.5
x, y = sort([x, y]) function code(x, y) return 0.5 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 0.5;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 0.5
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
0.5
\end{array}
Initial program 64.3%
Taylor expanded in x around 0 52.8%
Taylor expanded in x around 0 33.0%
associate-*r*33.0%
+-commutative33.0%
unpow233.0%
distribute-rgt-in33.0%
Simplified33.0%
Taylor expanded in y around 0 3.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 2024139
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))