
(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 17 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)) (/ (/ x (+ y x)) (+ y (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * ((x / (y + x)) / (y + (x + 1.0)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * ((x / (y + x)) / (y + (x + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * ((x / (y + x)) / (y + (x + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * ((x / (y + x)) / (y + (x + 1.0)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + x)) / Float64(y + Float64(x + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * ((x / (y + x)) / (y + (x + 1.0)));
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[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \frac{\frac{x}{y + x}}{y + \left(x + 1\right)}
\end{array}
Initial program 68.8%
*-commutative68.8%
associate-*l*68.8%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
div-inv93.3%
distribute-rgt-in88.8%
+-commutative88.8%
distribute-rgt-in93.3%
+-commutative93.3%
Applied egg-rr93.3%
associate-*r/93.4%
*-rgt-identity93.4%
associate-/r*99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ x (+ y x)) (+ y (+ x 1.0)))))
(if (<= x -8.8e+73)
(* t_0 (/ y x))
(if (<= x -4.4e-163)
(* x (/ y (* (+ x (+ y 1.0)) (* (+ y x) (+ y x)))))
t_0))))assert(x < y);
double code(double x, double y) {
double t_0 = (x / (y + x)) / (y + (x + 1.0));
double tmp;
if (x <= -8.8e+73) {
tmp = t_0 * (y / x);
} else if (x <= -4.4e-163) {
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
} else {
tmp = 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 + x)) / (y + (x + 1.0d0))
if (x <= (-8.8d+73)) then
tmp = t_0 * (y / x)
else if (x <= (-4.4d-163)) then
tmp = x * (y / ((x + (y + 1.0d0)) * ((y + x) * (y + x))))
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (x / (y + x)) / (y + (x + 1.0));
double tmp;
if (x <= -8.8e+73) {
tmp = t_0 * (y / x);
} else if (x <= -4.4e-163) {
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x / (y + x)) / (y + (x + 1.0)) tmp = 0 if x <= -8.8e+73: tmp = t_0 * (y / x) elif x <= -4.4e-163: tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x)))) else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x / Float64(y + x)) / Float64(y + Float64(x + 1.0))) tmp = 0.0 if (x <= -8.8e+73) tmp = Float64(t_0 * Float64(y / x)); elseif (x <= -4.4e-163) tmp = Float64(x * Float64(y / Float64(Float64(x + Float64(y + 1.0)) * Float64(Float64(y + x) * Float64(y + x))))); else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x / (y + x)) / (y + (x + 1.0));
tmp = 0.0;
if (x <= -8.8e+73)
tmp = t_0 * (y / x);
elseif (x <= -4.4e-163)
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
else
tmp = 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[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.8e+73], N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.4e-163], N[(x * N[(y / N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y + x}}{y + \left(x + 1\right)}\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{+73}:\\
\;\;\;\;t\_0 \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-163}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.8e73Initial program 40.6%
*-commutative40.6%
associate-*l*40.6%
times-frac81.2%
+-commutative81.2%
+-commutative81.2%
associate-+r+81.2%
+-commutative81.2%
associate-+l+81.2%
Applied egg-rr81.2%
div-inv81.2%
distribute-rgt-in69.6%
+-commutative69.6%
distribute-rgt-in81.2%
+-commutative81.2%
Applied egg-rr81.2%
associate-*r/81.2%
*-rgt-identity81.2%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 89.0%
if -8.8e73 < x < -4.40000000000000022e-163Initial program 89.3%
associate-/l*96.7%
associate-+l+96.7%
Simplified96.7%
if -4.40000000000000022e-163 < x Initial program 69.1%
*-commutative69.1%
associate-*l*69.1%
times-frac95.0%
+-commutative95.0%
+-commutative95.0%
associate-+r+95.0%
+-commutative95.0%
associate-+l+95.0%
Applied egg-rr95.0%
div-inv94.8%
distribute-rgt-in92.1%
+-commutative92.1%
distribute-rgt-in94.8%
+-commutative94.8%
Applied egg-rr94.8%
associate-*r/95.0%
*-rgt-identity95.0%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around inf 54.9%
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 1.0))))
(if (<= x -5e+164)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -5.05e-138)
(* (/ x (* (+ y x) t_0)) (/ y x))
(/ (/ x (+ y x)) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.05e-138) {
tmp = (x / ((y + x) * t_0)) * (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 = y + (x + 1.0d0)
if (x <= (-5d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-5.05d-138)) then
tmp = (x / ((y + x) * t_0)) * (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 = y + (x + 1.0);
double tmp;
if (x <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.05e-138) {
tmp = (x / ((y + x) * t_0)) * (y / x);
} else {
tmp = (x / (y + x)) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -5e+164: tmp = (y / (y + x)) * (1.0 / x) elif x <= -5.05e-138: tmp = (x / ((y + x) * t_0)) * (y / x) else: tmp = (x / (y + x)) / t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -5e+164) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -5.05e-138) tmp = Float64(Float64(x / Float64(Float64(y + x) * t_0)) * 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 = y + (x + 1.0);
tmp = 0.0;
if (x <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -5.05e-138)
tmp = (x / ((y + x) * t_0)) * (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[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(N[(x / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(y / x), $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 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot t\_0} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -5.0499999999999997e-138Initial program 77.2%
*-commutative77.2%
associate-*l*77.2%
times-frac98.4%
+-commutative98.4%
+-commutative98.4%
associate-+r+98.4%
+-commutative98.4%
associate-+l+98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 72.2%
if -5.0499999999999997e-138 < x Initial program 70.2%
*-commutative70.2%
associate-*l*70.2%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
div-inv95.0%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/95.2%
*-rgt-identity95.2%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around inf 56.5%
Final simplification64.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -5e+164)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -2500000000.0)
(/ y (* x (+ y x)))
(if (<= x -1.1e-138) (/ y (* x (+ x 1.0))) (/ (/ x (+ y x)) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -2500000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -1.1e-138) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (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 <= (-5d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-2500000000.0d0)) then
tmp = y / (x * (y + x))
else if (x <= (-1.1d-138)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (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 <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -2500000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -1.1e-138) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + x)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5e+164: tmp = (y / (y + x)) * (1.0 / x) elif x <= -2500000000.0: tmp = y / (x * (y + x)) elif x <= -1.1e-138: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + x)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5e+164) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -2500000000.0) tmp = Float64(y / Float64(x * Float64(y + x))); elseif (x <= -1.1e-138) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 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 <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -2500000000.0)
tmp = y / (x * (y + x));
elseif (x <= -1.1e-138)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (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, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.1e-138], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -2500000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -2.5e9Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
times-frac96.7%
+-commutative96.7%
+-commutative96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
Applied egg-rr96.7%
Taylor expanded in x around inf 42.9%
frac-times68.6%
*-rgt-identity68.6%
Applied egg-rr68.6%
if -2.5e9 < x < -1.0999999999999999e-138Initial program 93.9%
associate-/l*97.5%
associate-+l+97.5%
Simplified97.5%
Taylor expanded in y around 0 53.1%
if -1.0999999999999999e-138 < x Initial program 70.2%
*-commutative70.2%
associate-*l*70.2%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
div-inv95.0%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/95.2%
*-rgt-identity95.2%
associate-/r*99.9%
Simplified99.9%
clear-num99.8%
+-commutative99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 55.9%
+-commutative55.9%
Simplified55.9%
Final simplification60.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.8e+18)
(* (/ y x) (/ 1.0 x))
(if (or (<= x -1.6e-9) (not (<= x -5.05e-138)))
(/ x (* y (+ y 1.0)))
(/ y x))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.8e+18) {
tmp = (y / x) * (1.0 / x);
} else if ((x <= -1.6e-9) || !(x <= -5.05e-138)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = 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 (x <= (-1.8d+18)) then
tmp = (y / x) * (1.0d0 / x)
else if ((x <= (-1.6d-9)) .or. (.not. (x <= (-5.05d-138)))) then
tmp = x / (y * (y + 1.0d0))
else
tmp = y / x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.8e+18) {
tmp = (y / x) * (1.0 / x);
} else if ((x <= -1.6e-9) || !(x <= -5.05e-138)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.8e+18: tmp = (y / x) * (1.0 / x) elif (x <= -1.6e-9) or not (x <= -5.05e-138): tmp = x / (y * (y + 1.0)) else: tmp = y / x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.8e+18) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif ((x <= -1.6e-9) || !(x <= -5.05e-138)) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(y / x); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.8e+18)
tmp = (y / x) * (1.0 / x);
elseif ((x <= -1.6e-9) || ~((x <= -5.05e-138)))
tmp = x / (y * (y + 1.0));
else
tmp = 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[LessEqual[x, -1.8e+18], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.6e-9], N[Not[LessEqual[x, -5.05e-138]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / x), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-9} \lor \neg \left(x \leq -5.05 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x}\\
\end{array}
\end{array}
if x < -1.8e18Initial program 48.3%
*-commutative48.3%
associate-*l*48.3%
times-frac84.1%
+-commutative84.1%
+-commutative84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+l+84.1%
Applied egg-rr84.1%
Taylor expanded in x around inf 66.7%
Taylor expanded in y around 0 65.9%
if -1.8e18 < x < -1.60000000000000006e-9 or -5.0499999999999997e-138 < x Initial program 71.4%
associate-/l*83.8%
associate-+l+83.8%
Simplified83.8%
Taylor expanded in x around 0 53.7%
+-commutative53.7%
Simplified53.7%
if -1.60000000000000006e-9 < x < -5.0499999999999997e-138Initial program 94.9%
associate-/l*99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in y around 0 53.6%
associate-/r*53.6%
+-commutative53.6%
Simplified53.6%
Taylor expanded in x around 0 53.2%
Final simplification56.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -5e+164)
(* (/ y x) (/ 1.0 x))
(if (<= x -1550000000.0)
(/ y (* x (+ y x)))
(if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -1550000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= (-5d+164)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-1550000000.0d0)) then
tmp = y / (x * (y + x))
else if (x <= (-5.05d-138)) 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 <= -5e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -1550000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= -5e+164: tmp = (y / x) * (1.0 / x) elif x <= -1550000000.0: tmp = y / (x * (y + x)) elif x <= -5.05e-138: 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 <= -5e+164) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -1550000000.0) tmp = Float64(y / Float64(x * Float64(y + x))); elseif (x <= -5.05e-138) 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 <= -5e+164)
tmp = (y / x) * (1.0 / x);
elseif (x <= -1550000000.0)
tmp = y / (x * (y + x));
elseif (x <= -5.05e-138)
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, -5e+164], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1550000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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 -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -1550000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\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.9999999999999995e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
Taylor expanded in y around 0 86.7%
if -4.9999999999999995e164 < x < -1.55e9Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
times-frac96.7%
+-commutative96.7%
+-commutative96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
Applied egg-rr96.7%
Taylor expanded in x around inf 42.9%
frac-times68.6%
*-rgt-identity68.6%
Applied egg-rr68.6%
if -1.55e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/l*97.5%
associate-+l+97.5%
Simplified97.5%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Final simplification59.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -8e+164)
(* (/ y x) (/ 1.0 x))
(if (<= x -2500000000.0)
(/ y (* x (+ y x)))
(if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2500000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= (-8d+164)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-2500000000.0d0)) then
tmp = y / (x * (y + x))
else if (x <= (-5.05d-138)) 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 <= -8e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2500000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= -8e+164: tmp = (y / x) * (1.0 / x) elif x <= -2500000000.0: tmp = y / (x * (y + x)) elif x <= -5.05e-138: 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 <= -8e+164) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -2500000000.0) tmp = Float64(y / Float64(x * Float64(y + x))); elseif (x <= -5.05e-138) 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 <= -8e+164)
tmp = (y / x) * (1.0 / x);
elseif (x <= -2500000000.0)
tmp = y / (x * (y + x));
elseif (x <= -5.05e-138)
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, -8e+164], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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 -8 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -2500000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -8e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
Taylor expanded in y around 0 86.7%
if -8e164 < x < -2.5e9Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
times-frac96.7%
+-commutative96.7%
+-commutative96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
Applied egg-rr96.7%
Taylor expanded in x around inf 42.9%
frac-times68.6%
*-rgt-identity68.6%
Applied egg-rr68.6%
if -2.5e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/l*97.5%
associate-+l+97.5%
Simplified97.5%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
*-commutative70.2%
associate-*l*70.2%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
div-inv95.0%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/95.2%
*-rgt-identity95.2%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 53.5%
associate-/r*55.7%
+-commutative55.7%
Simplified55.7%
Final simplification60.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -5e+164)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -950000000.0)
(/ y (* x (+ y x)))
(if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -950000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= (-5d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-950000000.0d0)) then
tmp = y / (x * (y + x))
else if (x <= (-5.05d-138)) 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 <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -950000000.0) {
tmp = y / (x * (y + x));
} else if (x <= -5.05e-138) {
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 <= -5e+164: tmp = (y / (y + x)) * (1.0 / x) elif x <= -950000000.0: tmp = y / (x * (y + x)) elif x <= -5.05e-138: 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 <= -5e+164) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -950000000.0) tmp = Float64(y / Float64(x * Float64(y + x))); elseif (x <= -5.05e-138) 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 <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -950000000.0)
tmp = y / (x * (y + x));
elseif (x <= -5.05e-138)
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, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -950000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -950000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -9.5e8Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
times-frac96.7%
+-commutative96.7%
+-commutative96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
Applied egg-rr96.7%
Taylor expanded in x around inf 42.9%
frac-times68.6%
*-rgt-identity68.6%
Applied egg-rr68.6%
if -9.5e8 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/l*97.5%
associate-+l+97.5%
Simplified97.5%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
*-commutative70.2%
associate-*l*70.2%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
div-inv95.0%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/95.2%
*-rgt-identity95.2%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 53.5%
associate-/r*55.7%
+-commutative55.7%
Simplified55.7%
Final simplification60.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.4e+123) (* (/ (/ x (+ y x)) (+ y (+ x 1.0))) (/ y x)) (* x (/ (/ y (* (+ y x) (+ x (+ y 1.0)))) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.4e+123) {
tmp = ((x / (y + x)) / (y + (x + 1.0))) * (y / x);
} else {
tmp = x * ((y / ((y + x) * (x + (y + 1.0)))) / (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 (x <= (-2.4d+123)) then
tmp = ((x / (y + x)) / (y + (x + 1.0d0))) * (y / x)
else
tmp = x * ((y / ((y + x) * (x + (y + 1.0d0)))) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.4e+123) {
tmp = ((x / (y + x)) / (y + (x + 1.0))) * (y / x);
} else {
tmp = x * ((y / ((y + x) * (x + (y + 1.0)))) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.4e+123: tmp = ((x / (y + x)) / (y + (x + 1.0))) * (y / x) else: tmp = x * ((y / ((y + x) * (x + (y + 1.0)))) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.4e+123) tmp = Float64(Float64(Float64(x / Float64(y + x)) / Float64(y + Float64(x + 1.0))) * Float64(y / x)); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * Float64(x + Float64(y + 1.0)))) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.4e+123)
tmp = ((x / (y + x)) / (y + (x + 1.0))) * (y / x);
else
tmp = x * ((y / ((y + x) * (x + (y + 1.0)))) / (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[LessEqual[x, -2.4e+123], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+123}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + \left(x + 1\right)} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot \left(x + \left(y + 1\right)\right)}}{y + x}\\
\end{array}
\end{array}
if x < -2.39999999999999989e123Initial program 38.7%
*-commutative38.7%
associate-*l*38.7%
times-frac74.8%
+-commutative74.8%
+-commutative74.8%
associate-+r+74.8%
+-commutative74.8%
associate-+l+74.8%
Applied egg-rr74.8%
div-inv74.8%
distribute-rgt-in62.3%
+-commutative62.3%
distribute-rgt-in74.8%
+-commutative74.8%
Applied egg-rr74.8%
associate-*r/74.8%
*-rgt-identity74.8%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 88.2%
if -2.39999999999999989e123 < x Initial program 73.1%
*-commutative73.1%
associate-*l*73.1%
times-frac96.0%
+-commutative96.0%
+-commutative96.0%
associate-+r+96.0%
+-commutative96.0%
associate-+l+96.0%
Applied egg-rr96.0%
div-inv95.9%
distribute-rgt-in92.6%
+-commutative92.6%
distribute-rgt-in95.9%
+-commutative95.9%
Applied egg-rr95.9%
associate-*r/96.0%
*-rgt-identity96.0%
associate-/r*99.8%
Simplified99.8%
clear-num99.7%
+-commutative99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
div-inv99.5%
div-inv99.4%
associate-*l*93.3%
+-commutative93.3%
associate-/r*93.3%
clear-num93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
associate-*l/93.5%
*-lft-identity93.5%
associate-/l/93.5%
Simplified93.5%
Final simplification92.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 1.8e+155)
(* (/ y (+ y x)) (/ x (* (+ y x) t_0)))
(/ (/ x (+ y x)) t_0))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.8e+155) {
tmp = (y / (y + x)) * (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 = y + (x + 1.0d0)
if (y <= 1.8d+155) then
tmp = (y / (y + x)) * (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 = y + (x + 1.0);
double tmp;
if (y <= 1.8e+155) {
tmp = (y / (y + x)) * (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 = y + (x + 1.0) tmp = 0 if y <= 1.8e+155: tmp = (y / (y + x)) * (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(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 1.8e+155) tmp = Float64(Float64(y / Float64(y + x)) * 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 = y + (x + 1.0);
tmp = 0.0;
if (y <= 1.8e+155)
tmp = (y / (y + x)) * (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[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.8e+155], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * 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 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;\frac{y}{y + x} \cdot \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.80000000000000004e155Initial program 69.1%
*-commutative69.1%
associate-*l*69.1%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
if 1.80000000000000004e155 < y Initial program 67.1%
*-commutative67.1%
associate-*l*67.1%
times-frac82.3%
+-commutative82.3%
+-commutative82.3%
associate-+r+82.3%
+-commutative82.3%
associate-+l+82.3%
Applied egg-rr82.3%
div-inv82.3%
distribute-rgt-in73.1%
+-commutative73.1%
distribute-rgt-in82.3%
+-commutative82.3%
Applied egg-rr82.3%
associate-*r/82.3%
*-rgt-identity82.3%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around inf 96.9%
Final simplification95.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1e-175) (/ (/ y x) (+ x 1.0)) (if (<= y 2.5e+154) (/ x (* (+ y x) (+ y (+ x 1.0)))) (/ (/ x (+ y x)) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1e-175) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.5e+154) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1d-175) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 2.5d+154) then
tmp = x / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / (y + x)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1e-175) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.5e+154) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1e-175: tmp = (y / x) / (x + 1.0) elif y <= 2.5e+154: tmp = x / ((y + x) * (y + (x + 1.0))) else: tmp = (x / (y + x)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1e-175) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 2.5e+154) tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(y + x)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1e-175)
tmp = (y / x) / (x + 1.0);
elseif (y <= 2.5e+154)
tmp = x / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / (y + x)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1e-175], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+154], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{-175}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y}\\
\end{array}
\end{array}
if y < 1e-175Initial program 69.3%
associate-/l*86.5%
associate-+l+86.5%
Simplified86.5%
Taylor expanded in y around 0 58.7%
associate-/r*60.2%
+-commutative60.2%
Simplified60.2%
if 1e-175 < y < 2.50000000000000002e154Initial program 70.5%
*-commutative70.5%
associate-*l*70.5%
times-frac94.7%
+-commutative94.7%
+-commutative94.7%
associate-+r+94.7%
+-commutative94.7%
associate-+l+94.7%
Applied egg-rr94.7%
Taylor expanded in y around inf 66.7%
if 2.50000000000000002e154 < y Initial program 63.6%
*-commutative63.6%
associate-*l*63.6%
times-frac78.3%
+-commutative78.3%
+-commutative78.3%
associate-+r+78.3%
+-commutative78.3%
associate-+l+78.3%
Applied egg-rr78.3%
div-inv78.3%
distribute-rgt-in69.3%
+-commutative69.3%
distribute-rgt-in78.3%
+-commutative78.3%
Applied egg-rr78.3%
associate-*r/78.3%
*-rgt-identity78.3%
associate-/r*99.9%
Simplified99.9%
clear-num99.9%
+-commutative99.9%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 92.1%
Final simplification66.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 9.5e-176)
(/ (/ y x) (+ x 1.0))
(if (<= y 7.2e+155) (/ x (* (+ y x) t_0)) (/ (/ x (+ y x)) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 9.5e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7.2e+155) {
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 = y + (x + 1.0d0)
if (y <= 9.5d-176) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 7.2d+155) 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 = y + (x + 1.0);
double tmp;
if (y <= 9.5e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7.2e+155) {
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 = y + (x + 1.0) tmp = 0 if y <= 9.5e-176: tmp = (y / x) / (x + 1.0) elif y <= 7.2e+155: 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(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 9.5e-176) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 7.2e+155) 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 = y + (x + 1.0);
tmp = 0.0;
if (y <= 9.5e-176)
tmp = (y / x) / (x + 1.0);
elseif (y <= 7.2e+155)
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[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9.5e-176], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+155], 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 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 9.5 \cdot 10^{-176}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+155}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_0}\\
\end{array}
\end{array}
if y < 9.5e-176Initial program 69.3%
associate-/l*86.5%
associate-+l+86.5%
Simplified86.5%
Taylor expanded in y around 0 58.7%
associate-/r*60.2%
+-commutative60.2%
Simplified60.2%
if 9.5e-176 < y < 7.20000000000000015e155Initial program 68.5%
*-commutative68.5%
associate-*l*68.6%
times-frac92.2%
+-commutative92.2%
+-commutative92.2%
associate-+r+92.2%
+-commutative92.2%
associate-+l+92.2%
Applied egg-rr92.2%
Taylor expanded in y around inf 65.0%
if 7.20000000000000015e155 < y Initial program 67.1%
*-commutative67.1%
associate-*l*67.1%
times-frac82.3%
+-commutative82.3%
+-commutative82.3%
associate-+r+82.3%
+-commutative82.3%
associate-+l+82.3%
Applied egg-rr82.3%
div-inv82.3%
distribute-rgt-in73.1%
+-commutative73.1%
distribute-rgt-in82.3%
+-commutative82.3%
Applied egg-rr82.3%
associate-*r/82.3%
*-rgt-identity82.3%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around inf 96.9%
Final simplification66.7%
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)) (+ y (+ x 1.0))))) (if (<= x -5.05e-138) (* t_0 (/ y x)) t_0)))
assert(x < y);
double code(double x, double y) {
double t_0 = (x / (y + x)) / (y + (x + 1.0));
double tmp;
if (x <= -5.05e-138) {
tmp = t_0 * (y / x);
} else {
tmp = 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 + x)) / (y + (x + 1.0d0))
if (x <= (-5.05d-138)) then
tmp = t_0 * (y / x)
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (x / (y + x)) / (y + (x + 1.0));
double tmp;
if (x <= -5.05e-138) {
tmp = t_0 * (y / x);
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x / (y + x)) / (y + (x + 1.0)) tmp = 0 if x <= -5.05e-138: tmp = t_0 * (y / x) else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x / Float64(y + x)) / Float64(y + Float64(x + 1.0))) tmp = 0.0 if (x <= -5.05e-138) tmp = Float64(t_0 * Float64(y / x)); else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x / (y + x)) / (y + (x + 1.0));
tmp = 0.0;
if (x <= -5.05e-138)
tmp = t_0 * (y / x);
else
tmp = 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[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.05e-138], N[(t$95$0 * N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y + x}}{y + \left(x + 1\right)}\\
\mathbf{if}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;t\_0 \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.0499999999999997e-138Initial program 66.4%
*-commutative66.4%
associate-*l*66.4%
times-frac90.3%
+-commutative90.3%
+-commutative90.3%
associate-+r+90.3%
+-commutative90.3%
associate-+l+90.3%
Applied egg-rr90.3%
div-inv90.2%
distribute-rgt-in82.8%
+-commutative82.8%
distribute-rgt-in90.2%
+-commutative90.2%
Applied egg-rr90.2%
associate-*r/90.3%
*-rgt-identity90.3%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around 0 76.7%
if -5.0499999999999997e-138 < x Initial program 70.2%
*-commutative70.2%
associate-*l*70.2%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
div-inv95.0%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/95.2%
*-rgt-identity95.2%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around inf 56.5%
Final simplification63.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5e+164) (* (/ y x) (/ 1.0 x)) (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -5.05e-138) {
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 <= (-5d+164)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-5.05d-138)) 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 <= -5e+164) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -5.05e-138) {
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 <= -5e+164: tmp = (y / x) * (1.0 / x) elif x <= -5.05e-138: 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 <= -5e+164) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -5.05e-138) 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 <= -5e+164)
tmp = (y / x) * (1.0 / x);
elseif (x <= -5.05e-138)
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, -5e+164], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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 -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\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.9999999999999995e164Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
times-frac72.2%
+-commutative72.2%
+-commutative72.2%
associate-+r+72.2%
+-commutative72.2%
associate-+l+72.2%
Applied egg-rr72.2%
Taylor expanded in x around inf 87.0%
Taylor expanded in y around 0 86.7%
if -4.9999999999999995e164 < x < -5.0499999999999997e-138Initial program 77.2%
associate-/l*90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in y around 0 47.8%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Final simplification55.8%
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) (/ 1.0 x)) (if (<= x -5.05e-138) (/ y x) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -5.05e-138) {
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) * (1.0d0 / x)
else if (x <= (-5.05d-138)) 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) * (1.0 / x);
} else if (x <= -5.05e-138) {
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) * (1.0 / x) elif x <= -5.05e-138: 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) * Float64(1.0 / x)); elseif (x <= -5.05e-138) 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) * (1.0 / x);
elseif (x <= -5.05e-138)
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] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 54.5%
*-commutative54.5%
associate-*l*54.6%
times-frac86.0%
+-commutative86.0%
+-commutative86.0%
associate-+r+86.0%
+-commutative86.0%
associate-+l+86.0%
Applied egg-rr86.0%
Taylor expanded in x around inf 61.3%
Taylor expanded in y around 0 60.6%
if -1 < x < -5.0499999999999997e-138Initial program 92.9%
associate-/l*97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in y around 0 51.8%
associate-/r*51.8%
+-commutative51.8%
Simplified51.8%
Taylor expanded in x around 0 51.5%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Taylor expanded in y around 0 35.8%
Final simplification43.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.5e-138) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.5e-138) {
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 <= (-4.5d-138)) 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 <= -4.5e-138) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.5e-138: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.5e-138) 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 <= -4.5e-138)
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, -4.5e-138], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.50000000000000008e-138Initial program 66.4%
associate-/l*84.5%
associate-+l+84.5%
Simplified84.5%
Taylor expanded in y around 0 55.4%
associate-/r*59.8%
+-commutative59.8%
Simplified59.8%
Taylor expanded in x around 0 28.8%
if -4.50000000000000008e-138 < x Initial program 70.2%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Taylor expanded in y around 0 35.8%
Final simplification33.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 68.8%
associate-/l*83.8%
associate-+l+83.8%
Simplified83.8%
Taylor expanded in x around 0 47.7%
+-commutative47.7%
Simplified47.7%
Taylor expanded in y around 0 25.6%
Final simplification25.6%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024096
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))