
(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)) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (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)) * ((x / (y + (x + 1.0d0))) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * ((x / (y + (x + 1.0))) / (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[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 68.8%
associate-+r+68.8%
*-commutative68.8%
frac-times89.4%
associate-*l/83.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.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 (+ y (+ x 1.0))))
(if (<= x -5e+74)
(* (/ (/ x t_0) (+ y x)) (/ y x))
(if (<= x -0.0062)
(* y (/ x (* (+ y x) (* (+ y x) t_0))))
(/ (* (/ y (+ y x)) (/ x (+ y 1.0))) (+ y x))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -5e+74) {
tmp = ((x / t_0) / (y + x)) * (y / x);
} else if (x <= -0.0062) {
tmp = y * (x / ((y + x) * ((y + x) * t_0)));
} else {
tmp = ((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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-5d+74)) then
tmp = ((x / t_0) / (y + x)) * (y / x)
else if (x <= (-0.0062d0)) then
tmp = y * (x / ((y + x) * ((y + x) * t_0)))
else
tmp = ((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 t_0 = y + (x + 1.0);
double tmp;
if (x <= -5e+74) {
tmp = ((x / t_0) / (y + x)) * (y / x);
} else if (x <= -0.0062) {
tmp = y * (x / ((y + x) * ((y + x) * t_0)));
} else {
tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -5e+74: tmp = ((x / t_0) / (y + x)) * (y / x) elif x <= -0.0062: tmp = y * (x / ((y + x) * ((y + x) * t_0))) else: tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + x) 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+74) tmp = Float64(Float64(Float64(x / t_0) / Float64(y + x)) * Float64(y / x)); elseif (x <= -0.0062) tmp = Float64(y * Float64(x / Float64(Float64(y + x) * Float64(Float64(y + x) * t_0)))); else tmp = Float64(Float64(Float64(y / 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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -5e+74)
tmp = ((x / t_0) / (y + x)) * (y / x);
elseif (x <= -0.0062)
tmp = y * (x / ((y + x) * ((y + x) * t_0)));
else
tmp = ((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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5e+74], N[(N[(N[(x / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.0062], N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -5 \cdot 10^{+74}:\\
\;\;\;\;\frac{\frac{x}{t\_0}}{y + x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -0.0062:\\
\;\;\;\;y \cdot \frac{x}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -4.99999999999999963e74Initial program 40.6%
associate-+r+40.6%
*-commutative40.6%
frac-times81.3%
associate-*l/81.3%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 89.0%
if -4.99999999999999963e74 < x < -0.00619999999999999978Initial program 81.7%
times-frac95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
times-frac81.7%
associate-*l/95.2%
*-commutative95.2%
*-commutative95.2%
distribute-rgt1-in81.7%
fma-def95.4%
+-commutative95.4%
+-commutative95.4%
cube-unmult95.4%
+-commutative95.4%
Simplified95.4%
fma-udef81.8%
cube-mult81.7%
distribute-rgt1-in95.2%
associate-+r+95.2%
*-commutative95.2%
associate-*l*95.3%
+-commutative95.3%
+-commutative95.3%
+-commutative95.3%
associate-+l+95.3%
Applied egg-rr95.3%
if -0.00619999999999999978 < x Initial program 73.7%
times-frac90.6%
+-commutative90.6%
+-commutative90.6%
+-commutative90.6%
times-frac73.7%
associate-*l/85.3%
*-commutative85.3%
*-commutative85.3%
distribute-rgt1-in77.9%
fma-def85.3%
+-commutative85.3%
+-commutative85.3%
cube-unmult85.3%
+-commutative85.3%
Simplified85.3%
associate-*r/73.7%
fma-udef67.3%
cube-mult67.4%
distribute-rgt1-in73.7%
associate-+r+73.7%
*-commutative73.7%
frac-times90.6%
associate-/r*99.8%
associate-*l/99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 83.5%
+-commutative83.5%
Simplified83.5%
Final simplification85.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 -8.2e-156)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0)))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.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 <= -8.2e-156) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= (-8.2d-156)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (x / (y + (x + 1.0d0))) / (y + (x * 2.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 <= -8.2e-156) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= -8.2e-156: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= -8.2e-156) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + Float64(x * 2.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 <= -8.2e-156)
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
else
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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, -8.2e-156], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x * 2.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}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-156}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -8.2000000000000004e-156Initial program 79.1%
associate-/r*85.1%
*-commutative85.1%
+-commutative85.1%
+-commutative85.1%
associate-*l/98.2%
+-commutative98.2%
associate-*r/98.2%
remove-double-neg98.2%
+-commutative98.2%
+-commutative98.2%
remove-double-neg98.2%
+-commutative98.2%
associate-+l+98.2%
Simplified98.2%
Taylor expanded in y around 0 79.1%
+-commutative79.1%
Simplified79.1%
if -8.2000000000000004e-156 < x Initial program 69.1%
associate-+r+69.1%
*-commutative69.1%
frac-times88.6%
associate-*l/79.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
clear-num99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 55.1%
*-commutative55.1%
Simplified55.1%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -5.2e+164)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -4.3e-138)
(/ y (* (+ y x) (+ x (+ y (+ y 1.0)))))
(/ (/ x (+ y (+ x 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.2e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -4.3e-138) {
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
} else {
tmp = (x / (y + (x + 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 <= (-5.2d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-4.3d-138)) then
tmp = y / ((y + x) * (x + (y + (y + 1.0d0))))
else
tmp = (x / (y + (x + 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 <= -5.2e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -4.3e-138) {
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.2e+164: tmp = (y / (y + x)) * (1.0 / x) elif x <= -4.3e-138: tmp = y / ((y + x) * (x + (y + (y + 1.0)))) else: tmp = (x / (y + (x + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.2e+164) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -4.3e-138) tmp = Float64(y / Float64(Float64(y + x) * Float64(x + Float64(y + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 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 <= -5.2e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -4.3e-138)
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
else
tmp = (x / (y + (x + 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, -5.2e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.3e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -4.3 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + \left(y + \left(y + 1\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if x < -5.1999999999999998e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -5.1999999999999998e164 < x < -4.3e-138Initial program 77.2%
associate-+r+77.2%
*-commutative77.2%
frac-times98.1%
associate-*l/96.2%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num98.6%
frac-times94.5%
*-rgt-identity94.5%
div-inv94.5%
associate-+r+94.5%
+-commutative94.5%
clear-num94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
Applied egg-rr94.6%
Taylor expanded in x around -inf 75.3%
mul-1-neg75.3%
unsub-neg75.3%
neg-mul-175.3%
distribute-lft-in75.3%
metadata-eval75.3%
neg-mul-175.3%
+-commutative75.3%
unsub-neg75.3%
unsub-neg75.3%
Simplified75.3%
if -4.3e-138 < x Initial program 70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.0%
associate-*l/79.9%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 56.5%
Final simplification64.7%
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 -3.5e-138)
(/ y (* (+ y x) (+ x (+ y (+ y 1.0)))))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.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 <= -3.5e-138) {
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= (-3.5d-138)) then
tmp = y / ((y + x) * (x + (y + (y + 1.0d0))))
else
tmp = (x / (y + (x + 1.0d0))) / (y + (x * 2.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 <= -3.5e-138) {
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= -3.5e-138: tmp = y / ((y + x) * (x + (y + (y + 1.0)))) else: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 <= -3.5e-138) tmp = Float64(y / Float64(Float64(y + x) * Float64(x + Float64(y + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + Float64(x * 2.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 <= -3.5e-138)
tmp = y / ((y + x) * (x + (y + (y + 1.0))));
else
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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, -3.5e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x * 2.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}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + \left(y + \left(y + 1\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -3.4999999999999999e-138Initial program 77.2%
associate-+r+77.2%
*-commutative77.2%
frac-times98.1%
associate-*l/96.2%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num98.6%
frac-times94.5%
*-rgt-identity94.5%
div-inv94.5%
associate-+r+94.5%
+-commutative94.5%
clear-num94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
Applied egg-rr94.6%
Taylor expanded in x around -inf 75.3%
mul-1-neg75.3%
unsub-neg75.3%
neg-mul-175.3%
distribute-lft-in75.3%
metadata-eval75.3%
neg-mul-175.3%
+-commutative75.3%
unsub-neg75.3%
unsub-neg75.3%
Simplified75.3%
if -3.4999999999999999e-138 < x Initial program 70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.0%
associate-*l/79.9%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
clear-num99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 56.8%
*-commutative56.8%
Simplified56.8%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -6e+164)
(/ (/ y x) (+ x 1.0))
(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 <= -6e+164) {
tmp = (y / x) / (x + 1.0);
} 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 <= (-6d+164)) then
tmp = (y / x) / (x + 1.0d0)
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 <= -6e+164) {
tmp = (y / x) / (x + 1.0);
} 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 <= -6e+164: tmp = (y / x) / (x + 1.0) 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 <= -6e+164) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); 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 <= -6e+164)
tmp = (y / x) / (x + 1.0);
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, -6e+164], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $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 -6 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\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 < -6.00000000000000001e164Initial program 42.1%
associate-/r*42.1%
*-commutative42.1%
+-commutative42.1%
+-commutative42.1%
associate-*l/72.2%
+-commutative72.2%
associate-*r/72.2%
remove-double-neg72.2%
+-commutative72.2%
+-commutative72.2%
remove-double-neg72.2%
+-commutative72.2%
associate-+l+72.2%
Simplified72.2%
Taylor expanded in y around 0 72.2%
associate-/r*86.7%
+-commutative86.7%
Simplified86.7%
if -6.00000000000000001e164 < x < -2.5e9Initial program 57.6%
associate-+r+57.6%
*-commutative57.6%
frac-times96.7%
associate-*l/96.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.6%
frac-times93.6%
*-rgt-identity93.6%
div-inv93.6%
associate-+r+93.6%
+-commutative93.6%
clear-num93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
Applied egg-rr93.7%
Taylor expanded in x around inf 68.6%
if -2.5e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/r*95.7%
*-commutative95.7%
+-commutative95.7%
+-commutative95.7%
associate-*l/99.3%
+-commutative99.3%
associate-*r/99.3%
remove-double-neg99.3%
+-commutative99.3%
+-commutative99.3%
remove-double-neg99.3%
+-commutative99.3%
associate-+l+99.3%
Simplified99.3%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
associate-/r*55.7%
div-inv55.7%
Applied egg-rr55.7%
un-div-inv55.7%
Applied egg-rr55.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 -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 <= -5e+164) {
tmp = (y / (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 <= (-5d+164)) then
tmp = (y / (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 <= -5e+164) {
tmp = (y / (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 <= -5e+164: tmp = (y / (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 <= -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 <= -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 <= -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, -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, -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 -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 < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -2.5e9Initial program 57.6%
associate-+r+57.6%
*-commutative57.6%
frac-times96.7%
associate-*l/96.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.6%
frac-times93.6%
*-rgt-identity93.6%
div-inv93.6%
associate-+r+93.6%
+-commutative93.6%
clear-num93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
Applied egg-rr93.7%
Taylor expanded in x around inf 68.6%
if -2.5e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/r*95.7%
*-commutative95.7%
+-commutative95.7%
+-commutative95.7%
associate-*l/99.3%
+-commutative99.3%
associate-*r/99.3%
remove-double-neg99.3%
+-commutative99.3%
+-commutative99.3%
remove-double-neg99.3%
+-commutative99.3%
associate-+l+99.3%
Simplified99.3%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
associate-/r*55.7%
div-inv55.7%
Applied egg-rr55.7%
un-div-inv55.7%
Applied egg-rr55.7%
Final simplification60.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 1.8e+155)
(* (/ x (+ y x)) (/ y (* (+ y x) t_0)))
(/ (/ x t_0) (+ y (* x 2.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 = (x / (y + x)) * (y / ((y + x) * t_0));
} else {
tmp = (x / t_0) / (y + (x * 2.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 = (x / (y + x)) * (y / ((y + x) * t_0))
else
tmp = (x / t_0) / (y + (x * 2.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.8e+155) {
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
} else {
tmp = (x / t_0) / (y + (x * 2.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 = (x / (y + x)) * (y / ((y + x) * t_0)) else: tmp = (x / t_0) / (y + (x * 2.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(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) * t_0))); else tmp = Float64(Float64(x / t_0) / Float64(y + Float64(x * 2.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 = (x / (y + x)) * (y / ((y + x) * t_0));
else
tmp = (x / t_0) / (y + (x * 2.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[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / N[(y + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t\_0}}{y + x \cdot 2}\\
\end{array}
\end{array}
if y < 1.80000000000000004e155Initial program 69.1%
associate-+r+69.1%
associate-*l*69.1%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
if 1.80000000000000004e155 < y Initial program 67.1%
associate-+r+67.1%
*-commutative67.1%
frac-times82.3%
associate-*l/82.3%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
clear-num99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 97.5%
*-commutative97.5%
Simplified97.5%
Final simplification95.5%
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 -5.05e-138)
(/ y (* (+ y x) (+ x 1.0)))
(/ (/ x (+ y (+ x 1.0))) (+ y x)))))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 <= -5.05e-138) {
tmp = y / ((y + x) * (x + 1.0));
} else {
tmp = (x / (y + (x + 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 <= (-5d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-5.05d-138)) then
tmp = y / ((y + x) * (x + 1.0d0))
else
tmp = (x / (y + (x + 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 <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.05e-138) {
tmp = y / ((y + x) * (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
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 <= -5.05e-138: tmp = y / ((y + x) * (x + 1.0)) else: tmp = (x / (y + (x + 1.0))) / (y + x) 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 <= -5.05e-138) tmp = Float64(y / Float64(Float64(y + x) * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 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 <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -5.05e-138)
tmp = y / ((y + x) * (x + 1.0));
else
tmp = (x / (y + (x + 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, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $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 -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -5.0499999999999997e-138Initial program 77.2%
associate-+r+77.2%
*-commutative77.2%
frac-times98.1%
associate-*l/96.2%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num98.6%
frac-times94.5%
*-rgt-identity94.5%
div-inv94.5%
associate-+r+94.5%
+-commutative94.5%
clear-num94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
Applied egg-rr94.6%
Taylor expanded in y around 0 60.5%
+-commutative60.5%
Simplified60.5%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.0%
associate-*l/79.9%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 56.5%
Final simplification61.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 1.0))))) (if (<= x -5.05e-138) (* (/ t_0 (+ y x)) (/ y x)) (/ t_0 (+ y (* x 2.0))))))
assert(x < y);
double code(double x, double y) {
double t_0 = x / (y + (x + 1.0));
double tmp;
if (x <= -5.05e-138) {
tmp = (t_0 / (y + x)) * (y / x);
} else {
tmp = t_0 / (y + (x * 2.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 + 1.0d0))
if (x <= (-5.05d-138)) then
tmp = (t_0 / (y + x)) * (y / x)
else
tmp = t_0 / (y + (x * 2.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y + (x + 1.0));
double tmp;
if (x <= -5.05e-138) {
tmp = (t_0 / (y + x)) * (y / x);
} else {
tmp = t_0 / (y + (x * 2.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y + (x + 1.0)) tmp = 0 if x <= -5.05e-138: tmp = (t_0 / (y + x)) * (y / x) else: tmp = t_0 / (y + (x * 2.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y + Float64(x + 1.0))) tmp = 0.0 if (x <= -5.05e-138) tmp = Float64(Float64(t_0 / Float64(y + x)) * Float64(y / x)); else tmp = Float64(t_0 / Float64(y + Float64(x * 2.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y + (x + 1.0));
tmp = 0.0;
if (x <= -5.05e-138)
tmp = (t_0 / (y + x)) * (y / x);
else
tmp = t_0 / (y + (x * 2.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 + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.05e-138], N[(N[(t$95$0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(y + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + \left(x + 1\right)}\\
\mathbf{if}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{t\_0}{y + x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -5.0499999999999997e-138Initial program 66.4%
associate-+r+66.4%
*-commutative66.4%
frac-times90.1%
associate-*l/88.8%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 76.7%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.0%
associate-*l/79.9%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
clear-num99.8%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 56.8%
*-commutative56.8%
Simplified56.8%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.15) (* (/ (/ x (+ y (+ x 1.0))) (+ y x)) (/ y x)) (* (/ y (+ y x)) (/ (/ x (+ y 1.0)) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.15) {
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
} else {
tmp = (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 <= (-1.15d0)) then
tmp = ((x / (y + (x + 1.0d0))) / (y + x)) * (y / x)
else
tmp = (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 <= -1.15) {
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
} else {
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.15: tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x) else: tmp = (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 <= -1.15) tmp = Float64(Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)) * Float64(y / x)); else tmp = Float64(Float64(y / Float64(y + x)) * Float64(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 <= -1.15)
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
else
tmp = (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, -1.15], N[(N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.1499999999999999Initial program 54.5%
associate-+r+54.5%
*-commutative54.5%
frac-times86.0%
associate-*l/86.0%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 81.7%
if -1.1499999999999999 < x Initial program 73.7%
associate-+r+73.7%
*-commutative73.7%
frac-times90.6%
associate-*l/82.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.5%
+-commutative83.5%
Simplified83.5%
Final simplification83.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -0.08) (* (/ (/ x (+ y (+ x 1.0))) (+ y x)) (/ y x)) (/ (* (/ y (+ y x)) (/ x (+ y 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -0.08) {
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
} else {
tmp = ((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 <= (-0.08d0)) then
tmp = ((x / (y + (x + 1.0d0))) / (y + x)) * (y / x)
else
tmp = ((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 <= -0.08) {
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
} else {
tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -0.08: tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x) else: tmp = ((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 <= -0.08) tmp = Float64(Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)) * Float64(y / x)); else tmp = Float64(Float64(Float64(y / 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 <= -0.08)
tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
else
tmp = ((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, -0.08], N[(N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.08:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -0.0800000000000000017Initial program 54.5%
associate-+r+54.5%
*-commutative54.5%
frac-times86.0%
associate-*l/86.0%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 81.7%
if -0.0800000000000000017 < x Initial program 73.7%
times-frac90.6%
+-commutative90.6%
+-commutative90.6%
+-commutative90.6%
times-frac73.7%
associate-*l/85.3%
*-commutative85.3%
*-commutative85.3%
distribute-rgt1-in77.9%
fma-def85.3%
+-commutative85.3%
+-commutative85.3%
cube-unmult85.3%
+-commutative85.3%
Simplified85.3%
associate-*r/73.7%
fma-udef67.3%
cube-mult67.4%
distribute-rgt1-in73.7%
associate-+r+73.7%
*-commutative73.7%
frac-times90.6%
associate-/r*99.8%
associate-*l/99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 83.5%
+-commutative83.5%
Simplified83.5%
Final simplification83.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 -5.05e-138) (/ y (* (+ 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 <= -5.05e-138) {
tmp = y / ((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 <= (-5.05d-138)) then
tmp = y / ((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 <= -5.05e-138) {
tmp = y / ((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 <= -5.05e-138: tmp = y / ((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 <= -5.05e-138) tmp = Float64(y / Float64(Float64(y + x) * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -5.05e-138)
tmp = y / ((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, -5.05e-138], N[(y / N[(N[(y + x), $MachinePrecision] * 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 -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -5.0499999999999997e-138Initial program 77.2%
associate-+r+77.2%
*-commutative77.2%
frac-times98.1%
associate-*l/96.2%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num98.6%
frac-times94.5%
*-rgt-identity94.5%
div-inv94.5%
associate-+r+94.5%
+-commutative94.5%
clear-num94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
Applied egg-rr94.6%
Taylor expanded in y around 0 60.5%
+-commutative60.5%
Simplified60.5%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
associate-/r*55.7%
div-inv55.7%
Applied egg-rr55.7%
un-div-inv55.7%
Applied egg-rr55.7%
Final simplification60.5%
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 -5.05e-138)
(/ y (* (+ y x) (+ x 1.0)))
(/ (/ x (+ y 1.0)) (+ y x)))))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 <= -5.05e-138) {
tmp = y / ((y + x) * (x + 1.0));
} else {
tmp = (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 <= (-5d+164)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-5.05d-138)) then
tmp = y / ((y + x) * (x + 1.0d0))
else
tmp = (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 <= -5e+164) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.05e-138) {
tmp = y / ((y + x) * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
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 <= -5.05e-138: tmp = y / ((y + x) * (x + 1.0)) else: tmp = (x / (y + 1.0)) / (y + x) 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 <= -5.05e-138) tmp = Float64(y / Float64(Float64(y + x) * Float64(x + 1.0))); else tmp = Float64(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 <= -5e+164)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -5.05e-138)
tmp = y / ((y + x) * (x + 1.0));
else
tmp = (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, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $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 -5.05 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -4.9999999999999995e164Initial program 42.1%
associate-+r+42.1%
*-commutative42.1%
frac-times72.2%
associate-*l/72.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.0%
if -4.9999999999999995e164 < x < -5.0499999999999997e-138Initial program 77.2%
associate-+r+77.2%
*-commutative77.2%
frac-times98.1%
associate-*l/96.2%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num98.6%
frac-times94.5%
*-rgt-identity94.5%
div-inv94.5%
associate-+r+94.5%
+-commutative94.5%
clear-num94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
Applied egg-rr94.6%
Taylor expanded in y around 0 60.5%
+-commutative60.5%
Simplified60.5%
if -5.0499999999999997e-138 < x Initial program 70.2%
times-frac89.1%
+-commutative89.1%
+-commutative89.1%
+-commutative89.1%
times-frac70.2%
associate-*l/83.4%
*-commutative83.4%
*-commutative83.4%
distribute-rgt1-in75.9%
fma-def83.4%
+-commutative83.4%
+-commutative83.4%
cube-unmult83.4%
+-commutative83.4%
Simplified83.4%
associate-*r/70.2%
fma-udef64.0%
cube-mult64.0%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.0%
associate-/r*99.8%
associate-*l/99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 55.9%
+-commutative55.9%
Simplified55.9%
Final simplification60.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (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 <= -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 <= (-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 <= -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 <= -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 <= -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(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 <= -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, -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[(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 -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{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -2.5e9Initial program 50.0%
associate-+r+50.0%
*-commutative50.0%
frac-times84.7%
associate-*l/84.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.1%
frac-times83.1%
*-rgt-identity83.1%
div-inv83.1%
associate-+r+83.1%
+-commutative83.1%
clear-num83.1%
+-commutative83.1%
associate-+r+83.1%
+-commutative83.1%
Applied egg-rr83.1%
Taylor expanded in x around inf 70.4%
if -2.5e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/r*95.7%
*-commutative95.7%
+-commutative95.7%
+-commutative95.7%
associate-*l/99.3%
+-commutative99.3%
associate-*r/99.3%
remove-double-neg99.3%
+-commutative99.3%
+-commutative99.3%
remove-double-neg99.3%
+-commutative99.3%
associate-+l+99.3%
Simplified99.3%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Final simplification57.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (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 <= -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 <= (-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 <= -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 <= -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 <= -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 <= -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, -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 -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 < -2.5e9Initial program 50.0%
associate-+r+50.0%
*-commutative50.0%
frac-times84.7%
associate-*l/84.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.1%
frac-times83.1%
*-rgt-identity83.1%
div-inv83.1%
associate-+r+83.1%
+-commutative83.1%
clear-num83.1%
+-commutative83.1%
associate-+r+83.1%
+-commutative83.1%
Applied egg-rr83.1%
Taylor expanded in x around inf 70.4%
if -2.5e9 < x < -5.0499999999999997e-138Initial program 93.9%
associate-/r*95.7%
*-commutative95.7%
+-commutative95.7%
+-commutative95.7%
associate-*l/99.3%
+-commutative99.3%
associate-*r/99.3%
remove-double-neg99.3%
+-commutative99.3%
+-commutative99.3%
remove-double-neg99.3%
+-commutative99.3%
associate-+l+99.3%
Simplified99.3%
Taylor expanded in y around 0 53.1%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
associate-/r*55.7%
div-inv55.7%
Applied egg-rr55.7%
un-div-inv55.7%
Applied egg-rr55.7%
Final simplification58.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9e+110) (/ y (* y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9e+110) {
tmp = y / (y * x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9d+110)) then
tmp = y / (y * x)
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9e+110) {
tmp = y / (y * x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9e+110: tmp = y / (y * x) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9e+110) tmp = Float64(y / Float64(y * x)); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9e+110)
tmp = y / (y * x);
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9e+110], N[(y / N[(y * x), $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 -9 \cdot 10^{+110}:\\
\;\;\;\;\frac{y}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -9.0000000000000005e110Initial program 38.3%
associate-+r+38.3%
*-commutative38.3%
frac-times77.0%
associate-*l/77.0%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
clear-num98.8%
frac-times77.0%
*-rgt-identity77.0%
div-inv77.0%
associate-+r+77.0%
+-commutative77.0%
clear-num77.0%
+-commutative77.0%
associate-+r+77.0%
+-commutative77.0%
Applied egg-rr77.0%
Taylor expanded in x around inf 77.0%
Taylor expanded in y around inf 36.4%
if -9.0000000000000005e110 < x Initial program 73.6%
associate-/r*78.5%
*-commutative78.5%
+-commutative78.5%
+-commutative78.5%
associate-*l/91.4%
+-commutative91.4%
associate-*r/91.4%
remove-double-neg91.4%
+-commutative91.4%
+-commutative91.4%
remove-double-neg91.4%
+-commutative91.4%
associate-+l+91.4%
Simplified91.4%
Taylor expanded in x around 0 52.3%
+-commutative52.3%
Simplified52.3%
Final simplification50.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (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 <= -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 <= (-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 <= -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 <= -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 <= -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 <= -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, -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.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 < -5.0499999999999997e-138Initial program 66.4%
associate-/r*70.9%
*-commutative70.9%
+-commutative70.9%
+-commutative70.9%
associate-*l/90.1%
+-commutative90.1%
associate-*r/90.1%
remove-double-neg90.1%
+-commutative90.1%
+-commutative90.1%
remove-double-neg90.1%
+-commutative90.1%
associate-+l+90.1%
Simplified90.1%
Taylor expanded in y around 0 55.4%
if -5.0499999999999997e-138 < x Initial program 70.2%
associate-/r*75.3%
*-commutative75.3%
+-commutative75.3%
+-commutative75.3%
associate-*l/89.0%
+-commutative89.0%
associate-*r/89.0%
remove-double-neg89.0%
+-commutative89.0%
+-commutative89.0%
remove-double-neg89.0%
+-commutative89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 53.5%
+-commutative53.5%
Simplified53.5%
Final simplification54.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.4e+21) (/ y (* y x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.4e+21) {
tmp = y / (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 <= (-2.4d+21)) then
tmp = y / (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 <= -2.4e+21) {
tmp = y / (y * x);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.4e+21: tmp = y / (y * x) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.4e+21) tmp = Float64(y / 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 <= -2.4e+21)
tmp = y / (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, -2.4e+21], N[(y / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+21}:\\
\;\;\;\;\frac{y}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2.4e21Initial program 48.3%
associate-+r+48.3%
*-commutative48.3%
frac-times84.2%
associate-*l/84.1%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.1%
frac-times82.6%
*-rgt-identity82.6%
div-inv82.5%
associate-+r+82.5%
+-commutative82.5%
clear-num82.6%
+-commutative82.6%
associate-+r+82.6%
+-commutative82.6%
Applied egg-rr82.6%
Taylor expanded in x around inf 72.7%
Taylor expanded in y around inf 32.5%
if -2.4e21 < x Initial program 74.7%
associate-/r*79.1%
*-commutative79.1%
+-commutative79.1%
+-commutative79.1%
associate-*l/91.0%
+-commutative91.0%
associate-*r/90.9%
remove-double-neg90.9%
+-commutative90.9%
+-commutative90.9%
remove-double-neg90.9%
+-commutative90.9%
associate-+l+90.9%
Simplified90.9%
Taylor expanded in x around 0 52.7%
+-commutative52.7%
Simplified52.7%
Taylor expanded in y around 0 32.1%
Final simplification32.2%
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 68.8%
associate-+r+68.8%
*-commutative68.8%
frac-times89.4%
associate-*l/83.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 50.9%
Taylor expanded in x around inf 4.0%
Taylor expanded in x around 0 4.0%
Final simplification4.0%
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-/r*73.7%
*-commutative73.7%
+-commutative73.7%
+-commutative73.7%
associate-*l/89.4%
+-commutative89.4%
associate-*r/89.4%
remove-double-neg89.4%
+-commutative89.4%
+-commutative89.4%
remove-double-neg89.4%
+-commutative89.4%
associate-+l+89.4%
Simplified89.4%
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
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))