
(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 20 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)) (+ y x)) (/ x (+ x (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
return ((y / (y + x)) / (y + x)) * (x / (x + (y + 1.0)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (y + x)) / (y + x)) * (x / (x + (y + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + x)) / (y + x)) * (x / (x + (y + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + x)) / (y + x)) * (x / (x + (y + 1.0)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x + Float64(y + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + x)) / (y + x)) * (x / (x + (y + 1.0)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x + \left(y + 1\right)}
\end{array}
Initial program 68.3%
associate-/r*74.0%
*-commutative74.0%
+-commutative74.0%
+-commutative74.0%
associate-*l/89.3%
+-commutative89.3%
associate-*r/89.4%
remove-double-neg89.4%
+-commutative89.4%
+-commutative89.4%
remove-double-neg89.4%
+-commutative89.4%
associate-+l+89.4%
Simplified89.4%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -1.05e+164)
(/ t_0 x)
(if (<= x -1.85e+15)
(/ y (* (+ y x) (+ y x)))
(if (<= x -4.2e-24)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= x -5e-63)
(/ 1.0 (* (+ y x) (/ (+ y 1.0) x)))
(if (<= x -2.9e-184)
(* x (/ t_0 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0))))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -1.05e+164) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.2e-24) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -5e-63) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2.9e-184) {
tmp = x * (t_0 / (y + x));
} 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-1.05d+164)) then
tmp = t_0 / x
else if (x <= (-1.85d+15)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-4.2d-24)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (x <= (-5d-63)) then
tmp = 1.0d0 / ((y + x) * ((y + 1.0d0) / x))
else if (x <= (-2.9d-184)) then
tmp = x * (t_0 / (y + x))
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 t_0 = y / (y + x);
double tmp;
if (x <= -1.05e+164) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.2e-24) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -5e-63) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2.9e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -1.05e+164: tmp = t_0 / x elif x <= -1.85e+15: tmp = y / ((y + x) * (y + x)) elif x <= -4.2e-24: tmp = (y / (x + 1.0)) / (y + x) elif x <= -5e-63: tmp = 1.0 / ((y + x) * ((y + 1.0) / x)) elif x <= -2.9e-184: tmp = x * (t_0 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -1.05e+164) tmp = Float64(t_0 / x); elseif (x <= -1.85e+15) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -4.2e-24) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (x <= -5e-63) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(Float64(y + 1.0) / x))); elseif (x <= -2.9e-184) tmp = Float64(x * Float64(t_0 / Float64(y + x))); 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)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -1.05e+164)
tmp = t_0 / x;
elseif (x <= -1.85e+15)
tmp = y / ((y + x) * (y + x));
elseif (x <= -4.2e-24)
tmp = (y / (x + 1.0)) / (y + x);
elseif (x <= -5e-63)
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
elseif (x <= -2.9e-184)
tmp = x * (t_0 / (y + x));
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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e+164], N[(t$95$0 / x), $MachinePrecision], If[LessEqual[x, -1.85e+15], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.2e-24], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-63], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.9e-184], N[(x * N[(t$95$0 / N[(y + x), $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}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+164}:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-63}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\
\;\;\;\;x \cdot \frac{t_0}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -1.04999999999999995e164Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 92.6%
if -1.04999999999999995e164 < x < -1.85e15Initial program 62.6%
associate-/r*85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-*l/97.0%
+-commutative97.0%
associate-*r/97.2%
remove-double-neg97.2%
+-commutative97.2%
+-commutative97.2%
remove-double-neg97.2%
+-commutative97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in x around inf 75.2%
if -1.85e15 < x < -4.1999999999999999e-24Initial program 99.4%
times-frac99.3%
+-commutative99.3%
+-commutative99.3%
+-commutative99.3%
times-frac99.4%
associate-*l/99.2%
*-commutative99.2%
*-commutative99.2%
distribute-rgt1-in86.4%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.2%
+-commutative99.2%
Simplified99.2%
associate-*r/99.6%
fma-udef87.0%
cube-mult86.8%
distribute-rgt1-in99.4%
associate-+r+99.4%
*-commutative99.4%
frac-times99.4%
*-commutative99.4%
clear-num99.6%
associate-/r*99.2%
frac-times99.4%
*-un-lft-identity99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
clear-num75.2%
inv-pow75.2%
div-inv75.4%
clear-num75.4%
+-commutative75.4%
Applied egg-rr75.4%
unpow-175.4%
associate-*r/75.4%
Simplified75.4%
clear-num75.6%
*-un-lft-identity75.6%
+-commutative75.6%
*-commutative75.6%
times-frac75.6%
Applied egg-rr75.6%
associate-*l/75.6%
*-lft-identity75.6%
+-commutative75.6%
Simplified75.6%
if -4.1999999999999999e-24 < x < -5.0000000000000002e-63Initial program 76.8%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
times-frac76.8%
associate-*l/76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt1-in76.8%
fma-def76.8%
+-commutative76.8%
+-commutative76.8%
cube-unmult76.8%
+-commutative76.8%
Simplified76.8%
associate-*r/76.8%
fma-udef76.8%
cube-mult76.8%
distribute-rgt1-in76.8%
associate-+r+76.8%
*-commutative76.8%
frac-times99.4%
*-commutative99.4%
clear-num99.3%
associate-/r*99.3%
frac-times99.6%
*-un-lft-identity99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 86.1%
Taylor expanded in x around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -5.0000000000000002e-63 < x < -2.90000000000000014e-184Initial program 72.5%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
associate-/r*99.6%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.4%
associate-/r/99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 73.3%
if -2.90000000000000014e-184 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
clear-num88.9%
associate-*l/89.0%
*-un-lft-identity89.0%
associate-+r+89.0%
+-commutative89.0%
associate-+l+89.0%
pow289.0%
Applied egg-rr89.0%
Taylor expanded in x around 0 57.0%
Final simplification66.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -9.4e+163)
(/ t_0 (+ (+ x 1.0) (* y 2.0)))
(if (<= x -1.85e+15)
(/ y (* (+ y x) (+ y x)))
(if (<= x -4.7e-23)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= x -1.18e-63)
(/ 1.0 (* (+ y x) (/ (+ y 1.0) x)))
(if (<= x -3.2e-184)
(* x (/ t_0 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0))))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -9.4e+163) {
tmp = t_0 / ((x + 1.0) + (y * 2.0));
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.7e-23) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -1.18e-63) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -3.2e-184) {
tmp = x * (t_0 / (y + x));
} 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-9.4d+163)) then
tmp = t_0 / ((x + 1.0d0) + (y * 2.0d0))
else if (x <= (-1.85d+15)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-4.7d-23)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (x <= (-1.18d-63)) then
tmp = 1.0d0 / ((y + x) * ((y + 1.0d0) / x))
else if (x <= (-3.2d-184)) then
tmp = x * (t_0 / (y + x))
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 t_0 = y / (y + x);
double tmp;
if (x <= -9.4e+163) {
tmp = t_0 / ((x + 1.0) + (y * 2.0));
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.7e-23) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -1.18e-63) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -3.2e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -9.4e+163: tmp = t_0 / ((x + 1.0) + (y * 2.0)) elif x <= -1.85e+15: tmp = y / ((y + x) * (y + x)) elif x <= -4.7e-23: tmp = (y / (x + 1.0)) / (y + x) elif x <= -1.18e-63: tmp = 1.0 / ((y + x) * ((y + 1.0) / x)) elif x <= -3.2e-184: tmp = x * (t_0 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -9.4e+163) tmp = Float64(t_0 / Float64(Float64(x + 1.0) + Float64(y * 2.0))); elseif (x <= -1.85e+15) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -4.7e-23) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (x <= -1.18e-63) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(Float64(y + 1.0) / x))); elseif (x <= -3.2e-184) tmp = Float64(x * Float64(t_0 / Float64(y + x))); 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)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -9.4e+163)
tmp = t_0 / ((x + 1.0) + (y * 2.0));
elseif (x <= -1.85e+15)
tmp = y / ((y + x) * (y + x));
elseif (x <= -4.7e-23)
tmp = (y / (x + 1.0)) / (y + x);
elseif (x <= -1.18e-63)
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
elseif (x <= -3.2e-184)
tmp = x * (t_0 / (y + x));
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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.4e+163], N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.85e+15], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.7e-23], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.18e-63], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.2e-184], N[(x * N[(t$95$0 / N[(y + x), $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}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -9.4 \cdot 10^{+163}:\\
\;\;\;\;\frac{t_0}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -4.7 \cdot 10^{-23}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;x \leq -1.18 \cdot 10^{-63}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-184}:\\
\;\;\;\;x \cdot \frac{t_0}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -9.40000000000000037e163Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.6%
associate-+r+93.6%
+-commutative93.6%
*-commutative93.6%
Simplified93.6%
if -9.40000000000000037e163 < x < -1.85e15Initial program 62.6%
associate-/r*85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-*l/97.0%
+-commutative97.0%
associate-*r/97.2%
remove-double-neg97.2%
+-commutative97.2%
+-commutative97.2%
remove-double-neg97.2%
+-commutative97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in x around inf 75.2%
if -1.85e15 < x < -4.7000000000000001e-23Initial program 99.4%
times-frac99.3%
+-commutative99.3%
+-commutative99.3%
+-commutative99.3%
times-frac99.4%
associate-*l/99.2%
*-commutative99.2%
*-commutative99.2%
distribute-rgt1-in86.4%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.2%
+-commutative99.2%
Simplified99.2%
associate-*r/99.6%
fma-udef87.0%
cube-mult86.8%
distribute-rgt1-in99.4%
associate-+r+99.4%
*-commutative99.4%
frac-times99.4%
*-commutative99.4%
clear-num99.6%
associate-/r*99.2%
frac-times99.4%
*-un-lft-identity99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
clear-num75.2%
inv-pow75.2%
div-inv75.4%
clear-num75.4%
+-commutative75.4%
Applied egg-rr75.4%
unpow-175.4%
associate-*r/75.4%
Simplified75.4%
clear-num75.6%
*-un-lft-identity75.6%
+-commutative75.6%
*-commutative75.6%
times-frac75.6%
Applied egg-rr75.6%
associate-*l/75.6%
*-lft-identity75.6%
+-commutative75.6%
Simplified75.6%
if -4.7000000000000001e-23 < x < -1.17999999999999999e-63Initial program 76.8%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
times-frac76.8%
associate-*l/76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt1-in76.8%
fma-def76.8%
+-commutative76.8%
+-commutative76.8%
cube-unmult76.8%
+-commutative76.8%
Simplified76.8%
associate-*r/76.8%
fma-udef76.8%
cube-mult76.8%
distribute-rgt1-in76.8%
associate-+r+76.8%
*-commutative76.8%
frac-times99.4%
*-commutative99.4%
clear-num99.3%
associate-/r*99.3%
frac-times99.6%
*-un-lft-identity99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 86.1%
Taylor expanded in x around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -1.17999999999999999e-63 < x < -3.2e-184Initial program 72.5%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
associate-/r*99.6%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.4%
associate-/r/99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 73.3%
if -3.2e-184 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
clear-num88.9%
associate-*l/89.0%
*-un-lft-identity89.0%
associate-+r+89.0%
+-commutative89.0%
associate-+l+89.0%
pow289.0%
Applied egg-rr89.0%
Taylor expanded in x around 0 57.0%
Final simplification67.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -2.9e+161)
(/ t_0 x)
(if (<= x -1.85e+15)
(/ y (* (+ y x) (+ y x)))
(if (<= x -2.7e-22)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= x -5.4e-62)
(/ 1.0 (* (+ y 1.0) (/ y x)))
(if (<= x -4.4e-184)
(* x (/ t_0 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) y))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.9e+161) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -2.7e-22) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -5.4e-62) {
tmp = 1.0 / ((y + 1.0) * (y / x));
} else if (x <= -4.4e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-2.9d+161)) then
tmp = t_0 / x
else if (x <= (-1.85d+15)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-2.7d-22)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (x <= (-5.4d-62)) then
tmp = 1.0d0 / ((y + 1.0d0) * (y / x))
else if (x <= (-4.4d-184)) then
tmp = x * (t_0 / (y + x))
else
tmp = (x / (y + (x + 1.0d0))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -2.9e+161) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -2.7e-22) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -5.4e-62) {
tmp = 1.0 / ((y + 1.0) * (y / x));
} else if (x <= -4.4e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -2.9e+161: tmp = t_0 / x elif x <= -1.85e+15: tmp = y / ((y + x) * (y + x)) elif x <= -2.7e-22: tmp = (y / (x + 1.0)) / (y + x) elif x <= -5.4e-62: tmp = 1.0 / ((y + 1.0) * (y / x)) elif x <= -4.4e-184: tmp = x * (t_0 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -2.9e+161) tmp = Float64(t_0 / x); elseif (x <= -1.85e+15) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -2.7e-22) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (x <= -5.4e-62) tmp = Float64(1.0 / Float64(Float64(y + 1.0) * Float64(y / x))); elseif (x <= -4.4e-184) tmp = Float64(x * Float64(t_0 / Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -2.9e+161)
tmp = t_0 / x;
elseif (x <= -1.85e+15)
tmp = y / ((y + x) * (y + x));
elseif (x <= -2.7e-22)
tmp = (y / (x + 1.0)) / (y + x);
elseif (x <= -5.4e-62)
tmp = 1.0 / ((y + 1.0) * (y / x));
elseif (x <= -4.4e-184)
tmp = x * (t_0 / (y + x));
else
tmp = (x / (y + (x + 1.0))) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.9e+161], N[(t$95$0 / x), $MachinePrecision], If[LessEqual[x, -1.85e+15], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.7e-22], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.4e-62], N[(1.0 / N[(N[(y + 1.0), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.4e-184], N[(x * N[(t$95$0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{+161}:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-22}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-62}:\\
\;\;\;\;\frac{1}{\left(y + 1\right) \cdot \frac{y}{x}}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-184}:\\
\;\;\;\;x \cdot \frac{t_0}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\
\end{array}
\end{array}
if x < -2.90000000000000016e161Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 92.6%
if -2.90000000000000016e161 < x < -1.85e15Initial program 62.6%
associate-/r*85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-*l/97.0%
+-commutative97.0%
associate-*r/97.2%
remove-double-neg97.2%
+-commutative97.2%
+-commutative97.2%
remove-double-neg97.2%
+-commutative97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in x around inf 75.2%
if -1.85e15 < x < -2.7000000000000002e-22Initial program 99.4%
times-frac99.3%
+-commutative99.3%
+-commutative99.3%
+-commutative99.3%
times-frac99.4%
associate-*l/99.2%
*-commutative99.2%
*-commutative99.2%
distribute-rgt1-in86.4%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.2%
+-commutative99.2%
Simplified99.2%
associate-*r/99.6%
fma-udef87.0%
cube-mult86.8%
distribute-rgt1-in99.4%
associate-+r+99.4%
*-commutative99.4%
frac-times99.4%
*-commutative99.4%
clear-num99.6%
associate-/r*99.2%
frac-times99.4%
*-un-lft-identity99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
clear-num75.2%
inv-pow75.2%
div-inv75.4%
clear-num75.4%
+-commutative75.4%
Applied egg-rr75.4%
unpow-175.4%
associate-*r/75.4%
Simplified75.4%
clear-num75.6%
*-un-lft-identity75.6%
+-commutative75.6%
*-commutative75.6%
times-frac75.6%
Applied egg-rr75.6%
associate-*l/75.6%
*-lft-identity75.6%
+-commutative75.6%
Simplified75.6%
if -2.7000000000000002e-22 < x < -5.40000000000000039e-62Initial program 76.8%
associate-/r*99.6%
*-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in x around 0 85.7%
+-commutative85.7%
Simplified85.7%
*-un-lft-identity85.7%
times-frac85.5%
Applied egg-rr85.5%
associate-*l/85.7%
*-lft-identity85.7%
Simplified85.7%
clear-num85.7%
inv-pow85.7%
associate-/r/85.9%
Applied egg-rr85.9%
unpow-185.9%
+-commutative85.9%
*-commutative85.9%
+-commutative85.9%
Simplified85.9%
if -5.40000000000000039e-62 < x < -4.39999999999999984e-184Initial program 72.5%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
associate-/r*99.6%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.4%
associate-/r/99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 73.3%
if -4.39999999999999984e-184 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
clear-num88.9%
associate-*l/89.0%
*-un-lft-identity89.0%
associate-+r+89.0%
+-commutative89.0%
associate-+l+89.0%
pow289.0%
Applied egg-rr89.0%
Taylor expanded in x around 0 55.8%
Final simplification66.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -3e+164)
(/ t_0 x)
(if (<= x -1.85e+15)
(/ y (* (+ y x) (+ y x)))
(if (<= x -4.8e-23)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= x -3.2e-64)
(/ 1.0 (* (+ y x) (/ (+ y 1.0) x)))
(if (<= x -2.9e-184)
(* x (/ t_0 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) y))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -3e+164) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.8e-23) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -3.2e-64) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2.9e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-3d+164)) then
tmp = t_0 / x
else if (x <= (-1.85d+15)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-4.8d-23)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (x <= (-3.2d-64)) then
tmp = 1.0d0 / ((y + x) * ((y + 1.0d0) / x))
else if (x <= (-2.9d-184)) then
tmp = x * (t_0 / (y + x))
else
tmp = (x / (y + (x + 1.0d0))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -3e+164) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -4.8e-23) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -3.2e-64) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2.9e-184) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -3e+164: tmp = t_0 / x elif x <= -1.85e+15: tmp = y / ((y + x) * (y + x)) elif x <= -4.8e-23: tmp = (y / (x + 1.0)) / (y + x) elif x <= -3.2e-64: tmp = 1.0 / ((y + x) * ((y + 1.0) / x)) elif x <= -2.9e-184: tmp = x * (t_0 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -3e+164) tmp = Float64(t_0 / x); elseif (x <= -1.85e+15) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -4.8e-23) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (x <= -3.2e-64) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(Float64(y + 1.0) / x))); elseif (x <= -2.9e-184) tmp = Float64(x * Float64(t_0 / Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -3e+164)
tmp = t_0 / x;
elseif (x <= -1.85e+15)
tmp = y / ((y + x) * (y + x));
elseif (x <= -4.8e-23)
tmp = (y / (x + 1.0)) / (y + x);
elseif (x <= -3.2e-64)
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
elseif (x <= -2.9e-184)
tmp = x * (t_0 / (y + x));
else
tmp = (x / (y + (x + 1.0))) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+164], N[(t$95$0 / x), $MachinePrecision], If[LessEqual[x, -1.85e+15], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-23], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.2e-64], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.9e-184], N[(x * N[(t$95$0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -3 \cdot 10^{+164}:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-23}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-184}:\\
\;\;\;\;x \cdot \frac{t_0}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\
\end{array}
\end{array}
if x < -3.00000000000000001e164Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 92.6%
if -3.00000000000000001e164 < x < -1.85e15Initial program 62.6%
associate-/r*85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-*l/97.0%
+-commutative97.0%
associate-*r/97.2%
remove-double-neg97.2%
+-commutative97.2%
+-commutative97.2%
remove-double-neg97.2%
+-commutative97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in x around inf 75.2%
if -1.85e15 < x < -4.79999999999999993e-23Initial program 99.4%
times-frac99.3%
+-commutative99.3%
+-commutative99.3%
+-commutative99.3%
times-frac99.4%
associate-*l/99.2%
*-commutative99.2%
*-commutative99.2%
distribute-rgt1-in86.4%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.2%
+-commutative99.2%
Simplified99.2%
associate-*r/99.6%
fma-udef87.0%
cube-mult86.8%
distribute-rgt1-in99.4%
associate-+r+99.4%
*-commutative99.4%
frac-times99.4%
*-commutative99.4%
clear-num99.6%
associate-/r*99.2%
frac-times99.4%
*-un-lft-identity99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
clear-num75.2%
inv-pow75.2%
div-inv75.4%
clear-num75.4%
+-commutative75.4%
Applied egg-rr75.4%
unpow-175.4%
associate-*r/75.4%
Simplified75.4%
clear-num75.6%
*-un-lft-identity75.6%
+-commutative75.6%
*-commutative75.6%
times-frac75.6%
Applied egg-rr75.6%
associate-*l/75.6%
*-lft-identity75.6%
+-commutative75.6%
Simplified75.6%
if -4.79999999999999993e-23 < x < -3.19999999999999975e-64Initial program 79.3%
times-frac99.5%
+-commutative99.5%
+-commutative99.5%
+-commutative99.5%
times-frac79.3%
associate-*l/79.3%
*-commutative79.3%
*-commutative79.3%
distribute-rgt1-in79.3%
fma-def79.3%
+-commutative79.3%
+-commutative79.3%
cube-unmult79.2%
+-commutative79.2%
Simplified79.2%
associate-*r/79.2%
fma-udef79.2%
cube-mult79.3%
distribute-rgt1-in79.3%
associate-+r+79.3%
*-commutative79.3%
frac-times99.3%
*-commutative99.3%
clear-num99.2%
associate-/r*99.2%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 87.6%
Taylor expanded in x around 0 87.6%
+-commutative87.6%
Simplified87.6%
if -3.19999999999999975e-64 < x < -2.90000000000000014e-184Initial program 71.3%
associate-/r*71.3%
*-commutative71.3%
+-commutative71.3%
+-commutative71.3%
associate-*l/87.5%
+-commutative87.5%
associate-*r/87.4%
remove-double-neg87.4%
+-commutative87.4%
+-commutative87.4%
remove-double-neg87.4%
+-commutative87.4%
associate-+l+87.4%
Simplified87.4%
associate-/r*99.6%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.5%
associate-/r/99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 76.3%
if -2.90000000000000014e-184 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
clear-num88.9%
associate-*l/89.0%
*-un-lft-identity89.0%
associate-+r+89.0%
+-commutative89.0%
associate-+l+89.0%
pow289.0%
Applied egg-rr89.0%
Taylor expanded in x around 0 55.8%
Final simplification66.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -3.6e+163)
(/ t_0 x)
(if (<= x -1.85e+15)
(/ y (* (+ y x) (+ y x)))
(if (<= x -2.7e-22)
(/ (/ y (+ x 1.0)) (+ y x))
(if (<= x -6.5e-64)
(/ 1.0 (* (+ y x) (/ (+ y 1.0) x)))
(if (<= x -2e-185)
(* x (/ t_0 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) (+ y x)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -3.6e+163) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -2.7e-22) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -6.5e-64) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2e-185) {
tmp = x * (t_0 / (y + x));
} 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) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-3.6d+163)) then
tmp = t_0 / x
else if (x <= (-1.85d+15)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-2.7d-22)) then
tmp = (y / (x + 1.0d0)) / (y + x)
else if (x <= (-6.5d-64)) then
tmp = 1.0d0 / ((y + x) * ((y + 1.0d0) / x))
else if (x <= (-2d-185)) then
tmp = x * (t_0 / (y + x))
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 t_0 = y / (y + x);
double tmp;
if (x <= -3.6e+163) {
tmp = t_0 / x;
} else if (x <= -1.85e+15) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -2.7e-22) {
tmp = (y / (x + 1.0)) / (y + x);
} else if (x <= -6.5e-64) {
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
} else if (x <= -2e-185) {
tmp = x * (t_0 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -3.6e+163: tmp = t_0 / x elif x <= -1.85e+15: tmp = y / ((y + x) * (y + x)) elif x <= -2.7e-22: tmp = (y / (x + 1.0)) / (y + x) elif x <= -6.5e-64: tmp = 1.0 / ((y + x) * ((y + 1.0) / x)) elif x <= -2e-185: tmp = x * (t_0 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -3.6e+163) tmp = Float64(t_0 / x); elseif (x <= -1.85e+15) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -2.7e-22) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); elseif (x <= -6.5e-64) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(Float64(y + 1.0) / x))); elseif (x <= -2e-185) tmp = Float64(x * Float64(t_0 / Float64(y + x))); 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)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -3.6e+163)
tmp = t_0 / x;
elseif (x <= -1.85e+15)
tmp = y / ((y + x) * (y + x));
elseif (x <= -2.7e-22)
tmp = (y / (x + 1.0)) / (y + x);
elseif (x <= -6.5e-64)
tmp = 1.0 / ((y + x) * ((y + 1.0) / x));
elseif (x <= -2e-185)
tmp = x * (t_0 / (y + x));
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_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.6e+163], N[(t$95$0 / x), $MachinePrecision], If[LessEqual[x, -1.85e+15], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.7e-22], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.5e-64], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e-185], N[(x * N[(t$95$0 / N[(y + x), $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}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{+163}:\\
\;\;\;\;\frac{t_0}{x}\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-22}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-185}:\\
\;\;\;\;x \cdot \frac{t_0}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if x < -3.59999999999999978e163Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 92.6%
if -3.59999999999999978e163 < x < -1.85e15Initial program 62.6%
associate-/r*85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-*l/97.0%
+-commutative97.0%
associate-*r/97.2%
remove-double-neg97.2%
+-commutative97.2%
+-commutative97.2%
remove-double-neg97.2%
+-commutative97.2%
associate-+l+97.2%
Simplified97.2%
Taylor expanded in x around inf 75.2%
if -1.85e15 < x < -2.7000000000000002e-22Initial program 99.4%
times-frac99.3%
+-commutative99.3%
+-commutative99.3%
+-commutative99.3%
times-frac99.4%
associate-*l/99.2%
*-commutative99.2%
*-commutative99.2%
distribute-rgt1-in86.4%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.2%
+-commutative99.2%
Simplified99.2%
associate-*r/99.6%
fma-udef87.0%
cube-mult86.8%
distribute-rgt1-in99.4%
associate-+r+99.4%
*-commutative99.4%
frac-times99.4%
*-commutative99.4%
clear-num99.6%
associate-/r*99.2%
frac-times99.4%
*-un-lft-identity99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
clear-num75.2%
inv-pow75.2%
div-inv75.4%
clear-num75.4%
+-commutative75.4%
Applied egg-rr75.4%
unpow-175.4%
associate-*r/75.4%
Simplified75.4%
clear-num75.6%
*-un-lft-identity75.6%
+-commutative75.6%
*-commutative75.6%
times-frac75.6%
Applied egg-rr75.6%
associate-*l/75.6%
*-lft-identity75.6%
+-commutative75.6%
Simplified75.6%
if -2.7000000000000002e-22 < x < -6.5000000000000004e-64Initial program 76.8%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
times-frac76.8%
associate-*l/76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt1-in76.8%
fma-def76.8%
+-commutative76.8%
+-commutative76.8%
cube-unmult76.8%
+-commutative76.8%
Simplified76.8%
associate-*r/76.8%
fma-udef76.8%
cube-mult76.8%
distribute-rgt1-in76.8%
associate-+r+76.8%
*-commutative76.8%
frac-times99.4%
*-commutative99.4%
clear-num99.3%
associate-/r*99.3%
frac-times99.6%
*-un-lft-identity99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 86.1%
Taylor expanded in x around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -6.5000000000000004e-64 < x < -2e-185Initial program 72.5%
associate-/r*72.4%
*-commutative72.4%
+-commutative72.4%
+-commutative72.4%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.8%
remove-double-neg87.8%
+-commutative87.8%
+-commutative87.8%
remove-double-neg87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
associate-/r*99.6%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.4%
associate-/r/99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 73.3%
if -2e-185 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
*-commutative89.4%
clear-num89.3%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 56.6%
clear-num56.6%
associate-/r/56.6%
associate-/r*56.8%
clear-num56.8%
+-commutative56.8%
Applied egg-rr56.8%
Final simplification66.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* (+ y x) (+ y x)))) (t_1 (/ y (+ y x))))
(if (<= x -9.4e+163)
(/ t_1 (+ (+ x 1.0) (* y 2.0)))
(if (<= x -1.5e-6)
(* (/ x (+ x 1.0)) t_0)
(if (<= x -1.25e-163)
(* (/ x (+ y 1.0)) t_0)
(if (<= x -2e-185)
(* x (/ t_1 (+ y x)))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / ((y + x) * (y + x));
double t_1 = y / (y + x);
double tmp;
if (x <= -9.4e+163) {
tmp = t_1 / ((x + 1.0) + (y * 2.0));
} else if (x <= -1.5e-6) {
tmp = (x / (x + 1.0)) * t_0;
} else if (x <= -1.25e-163) {
tmp = (x / (y + 1.0)) * t_0;
} else if (x <= -2e-185) {
tmp = x * (t_1 / (y + x));
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / ((y + x) * (y + x))
t_1 = y / (y + x)
if (x <= (-9.4d+163)) then
tmp = t_1 / ((x + 1.0d0) + (y * 2.0d0))
else if (x <= (-1.5d-6)) then
tmp = (x / (x + 1.0d0)) * t_0
else if (x <= (-1.25d-163)) then
tmp = (x / (y + 1.0d0)) * t_0
else if (x <= (-2d-185)) then
tmp = x * (t_1 / (y + x))
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 t_0 = y / ((y + x) * (y + x));
double t_1 = y / (y + x);
double tmp;
if (x <= -9.4e+163) {
tmp = t_1 / ((x + 1.0) + (y * 2.0));
} else if (x <= -1.5e-6) {
tmp = (x / (x + 1.0)) * t_0;
} else if (x <= -1.25e-163) {
tmp = (x / (y + 1.0)) * t_0;
} else if (x <= -2e-185) {
tmp = x * (t_1 / (y + x));
} else {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / ((y + x) * (y + x)) t_1 = y / (y + x) tmp = 0 if x <= -9.4e+163: tmp = t_1 / ((x + 1.0) + (y * 2.0)) elif x <= -1.5e-6: tmp = (x / (x + 1.0)) * t_0 elif x <= -1.25e-163: tmp = (x / (y + 1.0)) * t_0 elif x <= -2e-185: tmp = x * (t_1 / (y + x)) else: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(Float64(y + x) * Float64(y + x))) t_1 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -9.4e+163) tmp = Float64(t_1 / Float64(Float64(x + 1.0) + Float64(y * 2.0))); elseif (x <= -1.5e-6) tmp = Float64(Float64(x / Float64(x + 1.0)) * t_0); elseif (x <= -1.25e-163) tmp = Float64(Float64(x / Float64(y + 1.0)) * t_0); elseif (x <= -2e-185) tmp = Float64(x * Float64(t_1 / Float64(y + x))); 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)
t_0 = y / ((y + x) * (y + x));
t_1 = y / (y + x);
tmp = 0.0;
if (x <= -9.4e+163)
tmp = t_1 / ((x + 1.0) + (y * 2.0));
elseif (x <= -1.5e-6)
tmp = (x / (x + 1.0)) * t_0;
elseif (x <= -1.25e-163)
tmp = (x / (y + 1.0)) * t_0;
elseif (x <= -2e-185)
tmp = x * (t_1 / (y + x));
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_] := Block[{t$95$0 = N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.4e+163], N[(t$95$1 / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-6], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, -1.25e-163], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, -2e-185], N[(x * N[(t$95$1 / N[(y + x), $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}
t_0 := \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
t_1 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -9.4 \cdot 10^{+163}:\\
\;\;\;\;\frac{t_1}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{x + 1} \cdot t_0\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-163}:\\
\;\;\;\;\frac{x}{y + 1} \cdot t_0\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-185}:\\
\;\;\;\;x \cdot \frac{t_1}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -9.40000000000000037e163Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.6%
associate-+r+93.6%
+-commutative93.6%
*-commutative93.6%
Simplified93.6%
if -9.40000000000000037e163 < x < -1.5e-6Initial program 66.4%
associate-/r*87.2%
*-commutative87.2%
+-commutative87.2%
+-commutative87.2%
associate-*l/97.2%
+-commutative97.2%
associate-*r/97.4%
remove-double-neg97.4%
+-commutative97.4%
+-commutative97.4%
remove-double-neg97.4%
+-commutative97.4%
associate-+l+97.4%
Simplified97.4%
Taylor expanded in y around 0 77.7%
+-commutative77.7%
Simplified77.7%
if -1.5e-6 < x < -1.24999999999999994e-163Initial program 82.0%
associate-/r*87.6%
*-commutative87.6%
+-commutative87.6%
+-commutative87.6%
associate-*l/99.5%
+-commutative99.5%
associate-*r/99.4%
remove-double-neg99.4%
+-commutative99.4%
+-commutative99.4%
remove-double-neg99.4%
+-commutative99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
Simplified99.4%
if -1.24999999999999994e-163 < x < -2e-185Initial program 40.0%
associate-/r*40.0%
*-commutative40.0%
+-commutative40.0%
+-commutative40.0%
associate-*l/41.4%
+-commutative41.4%
associate-*r/41.4%
remove-double-neg41.4%
+-commutative41.4%
+-commutative41.4%
remove-double-neg41.4%
+-commutative41.4%
associate-+l+41.4%
Simplified41.4%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
clear-num99.4%
associate-/r/99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
if -2e-185 < x Initial program 70.2%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac70.2%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
distribute-rgt1-in80.1%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.3%
+-commutative86.3%
Simplified86.3%
associate-*r/70.2%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.2%
associate-+r+70.2%
*-commutative70.2%
frac-times89.4%
clear-num88.9%
associate-*l/89.0%
*-un-lft-identity89.0%
associate-+r+89.0%
+-commutative89.0%
associate-+l+89.0%
pow289.0%
Applied egg-rr89.0%
Taylor expanded in x around 0 57.0%
Final simplification70.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.32e-17)
(* (/ (/ y (+ y x)) (+ y x)) (/ x (+ x 1.0)))
(if (<= y 8.2e+141)
(* (/ x (+ y 1.0)) (/ y (* (+ y x) (+ y x))))
(if (<= y 1.4e+224)
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0)))
(/ x (* y (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.32e-17) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else if (y <= 8.2e+141) {
tmp = (x / (y + 1.0)) * (y / ((y + x) * (y + x)));
} else if (y <= 1.4e+224) {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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 (y <= 1.32d-17) then
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0d0))
else if (y <= 8.2d+141) then
tmp = (x / (y + 1.0d0)) * (y / ((y + x) * (y + x)))
else if (y <= 1.4d+224) then
tmp = (x / (y + (x + 1.0d0))) / (y + (x * 2.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 (y <= 1.32e-17) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else if (y <= 8.2e+141) {
tmp = (x / (y + 1.0)) * (y / ((y + x) * (y + x)));
} else if (y <= 1.4e+224) {
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.32e-17: tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0)) elif y <= 8.2e+141: tmp = (x / (y + 1.0)) * (y / ((y + x) * (y + x))) elif y <= 1.4e+224: tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.32e-17) tmp = Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x + 1.0))); elseif (y <= 8.2e+141) tmp = Float64(Float64(x / Float64(y + 1.0)) * Float64(y / Float64(Float64(y + x) * Float64(y + x)))); elseif (y <= 1.4e+224) tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + Float64(x * 2.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 (y <= 1.32e-17)
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
elseif (y <= 8.2e+141)
tmp = (x / (y + 1.0)) * (y / ((y + x) * (y + x)));
elseif (y <= 1.4e+224)
tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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[y, 1.32e-17], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+141], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+224], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x * 2.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}\;y \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x + 1}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+141}:\\
\;\;\;\;\frac{x}{y + 1} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+224}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.3200000000000001e-17Initial program 72.6%
associate-/r*75.1%
*-commutative75.1%
+-commutative75.1%
+-commutative75.1%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in y around 0 82.3%
+-commutative77.5%
Simplified82.3%
if 1.3200000000000001e-17 < y < 8.20000000000000044e141Initial program 68.3%
associate-/r*83.4%
*-commutative83.4%
+-commutative83.4%
+-commutative83.4%
associate-*l/94.6%
+-commutative94.6%
associate-*r/94.6%
remove-double-neg94.6%
+-commutative94.6%
+-commutative94.6%
remove-double-neg94.6%
+-commutative94.6%
associate-+l+94.6%
Simplified94.6%
Taylor expanded in x around 0 75.3%
+-commutative75.3%
Simplified75.3%
if 8.20000000000000044e141 < y < 1.40000000000000004e224Initial program 49.7%
times-frac83.6%
+-commutative83.6%
+-commutative83.6%
+-commutative83.6%
times-frac49.7%
associate-*l/66.4%
*-commutative66.4%
*-commutative66.4%
distribute-rgt1-in60.8%
fma-def66.4%
+-commutative66.4%
+-commutative66.4%
cube-unmult66.4%
+-commutative66.4%
Simplified66.4%
associate-*r/49.7%
fma-udef49.7%
cube-mult49.7%
distribute-rgt1-in49.7%
associate-+r+49.7%
*-commutative49.7%
frac-times83.7%
clear-num83.6%
associate-*l/83.7%
*-un-lft-identity83.7%
associate-+r+83.7%
+-commutative83.7%
associate-+l+83.7%
pow283.7%
Applied egg-rr83.7%
Taylor expanded in x around 0 78.3%
if 1.40000000000000004e224 < y Initial program 52.9%
associate-/r*52.9%
*-commutative52.9%
+-commutative52.9%
+-commutative52.9%
associate-*l/98.6%
+-commutative98.6%
associate-*r/98.6%
remove-double-neg98.6%
+-commutative98.6%
+-commutative98.6%
remove-double-neg98.6%
+-commutative98.6%
associate-+l+98.6%
Simplified98.6%
Taylor expanded in x around 0 98.6%
+-commutative98.6%
Simplified98.6%
Final simplification82.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.0)
(/ (/ y x) x)
(if (or (<= x -1.05e-24) (and (not (<= x -6.2e-164)) (<= x -4.4e-184)))
(/ y x)
(/ x (* y (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if ((x <= -1.05e-24) || (!(x <= -6.2e-164) && (x <= -4.4e-184))) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) / x
else if ((x <= (-1.05d-24)) .or. (.not. (x <= (-6.2d-164))) .and. (x <= (-4.4d-184))) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if ((x <= -1.05e-24) || (!(x <= -6.2e-164) && (x <= -4.4e-184))) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) / x elif (x <= -1.05e-24) or (not (x <= -6.2e-164) and (x <= -4.4e-184)): tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) / x); elseif ((x <= -1.05e-24) || (!(x <= -6.2e-164) && (x <= -4.4e-184))) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) / x;
elseif ((x <= -1.05e-24) || (~((x <= -6.2e-164)) && (x <= -4.4e-184)))
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[x, -1.05e-24], And[N[Not[LessEqual[x, -6.2e-164]], $MachinePrecision], LessEqual[x, -4.4e-184]]], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-24} \lor \neg \left(x \leq -6.2 \cdot 10^{-164}\right) \land x \leq -4.4 \cdot 10^{-184}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 59.5%
times-frac88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
times-frac59.5%
associate-*l/76.2%
*-commutative76.2%
*-commutative76.2%
distribute-rgt1-in36.1%
fma-def76.2%
+-commutative76.2%
+-commutative76.2%
cube-unmult76.2%
+-commutative76.2%
Simplified76.2%
associate-*r/59.5%
fma-udef31.8%
cube-mult31.7%
distribute-rgt1-in59.5%
associate-+r+59.5%
*-commutative59.5%
frac-times88.0%
*-commutative88.0%
clear-num87.9%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 73.3%
Taylor expanded in y around 0 72.6%
if -1 < x < -1.05e-24 or -6.2000000000000001e-164 < x < -4.39999999999999984e-184Initial program 61.9%
associate-/r*61.9%
*-commutative61.9%
+-commutative61.9%
+-commutative61.9%
associate-*l/63.0%
+-commutative63.0%
associate-*r/63.0%
remove-double-neg63.0%
+-commutative63.0%
+-commutative63.0%
remove-double-neg63.0%
+-commutative63.0%
associate-+l+63.0%
Simplified63.0%
associate-/r*99.6%
div-inv99.2%
Applied egg-rr99.2%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
clear-num99.2%
associate-/r/99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in y around 0 64.0%
if -1.05e-24 < x < -6.2000000000000001e-164 or -4.39999999999999984e-184 < x Initial program 72.0%
associate-/r*75.5%
*-commutative75.5%
+-commutative75.5%
+-commutative75.5%
associate-*l/91.1%
+-commutative91.1%
associate-*r/91.1%
remove-double-neg91.1%
+-commutative91.1%
+-commutative91.1%
remove-double-neg91.1%
+-commutative91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 58.1%
+-commutative58.1%
Simplified58.1%
Final simplification62.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ y (+ y x)) (+ y x))))
(if (<= y 5e-73)
(* t_0 (/ x (+ x 1.0)))
(if (<= y 2.1e+176)
(* (/ x (+ x (+ y 1.0))) (/ y (* (+ y x) (+ y x))))
(* t_0 (/ x (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / (y + x)) / (y + x);
double tmp;
if (y <= 5e-73) {
tmp = t_0 * (x / (x + 1.0));
} else if (y <= 2.1e+176) {
tmp = (x / (x + (y + 1.0))) * (y / ((y + x) * (y + x)));
} else {
tmp = t_0 * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y / (y + x)) / (y + x)
if (y <= 5d-73) then
tmp = t_0 * (x / (x + 1.0d0))
else if (y <= 2.1d+176) then
tmp = (x / (x + (y + 1.0d0))) * (y / ((y + x) * (y + x)))
else
tmp = t_0 * (x / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y / (y + x)) / (y + x);
double tmp;
if (y <= 5e-73) {
tmp = t_0 * (x / (x + 1.0));
} else if (y <= 2.1e+176) {
tmp = (x / (x + (y + 1.0))) * (y / ((y + x) * (y + x)));
} else {
tmp = t_0 * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / (y + x)) / (y + x) tmp = 0 if y <= 5e-73: tmp = t_0 * (x / (x + 1.0)) elif y <= 2.1e+176: tmp = (x / (x + (y + 1.0))) * (y / ((y + x) * (y + x))) else: tmp = t_0 * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / Float64(y + x)) / Float64(y + x)) tmp = 0.0 if (y <= 5e-73) tmp = Float64(t_0 * Float64(x / Float64(x + 1.0))); elseif (y <= 2.1e+176) tmp = Float64(Float64(x / Float64(x + Float64(y + 1.0))) * Float64(y / Float64(Float64(y + x) * Float64(y + x)))); else tmp = Float64(t_0 * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y / (y + x)) / (y + x);
tmp = 0.0;
if (y <= 5e-73)
tmp = t_0 * (x / (x + 1.0));
elseif (y <= 2.1e+176)
tmp = (x / (x + (y + 1.0))) * (y / ((y + x) * (y + x)));
else
tmp = t_0 * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5e-73], N[(t$95$0 * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+176], N[(N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{if}\;y \leq 5 \cdot 10^{-73}:\\
\;\;\;\;t_0 \cdot \frac{x}{x + 1}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+176}:\\
\;\;\;\;\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if y < 4.9999999999999998e-73Initial program 72.3%
associate-/r*74.5%
*-commutative74.5%
+-commutative74.5%
+-commutative74.5%
associate-*l/87.5%
+-commutative87.5%
associate-*r/87.5%
remove-double-neg87.5%
+-commutative87.5%
+-commutative87.5%
remove-double-neg87.5%
+-commutative87.5%
associate-+l+87.5%
Simplified87.5%
associate-/r*99.7%
div-inv99.8%
Applied egg-rr99.8%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in y around 0 81.3%
+-commutative76.2%
Simplified81.3%
if 4.9999999999999998e-73 < y < 2.0999999999999999e176Initial program 65.2%
associate-/r*83.6%
*-commutative83.6%
+-commutative83.6%
+-commutative83.6%
associate-*l/95.5%
+-commutative95.5%
associate-*r/95.5%
remove-double-neg95.5%
+-commutative95.5%
+-commutative95.5%
remove-double-neg95.5%
+-commutative95.5%
associate-+l+95.5%
Simplified95.5%
if 2.0999999999999999e176 < y Initial program 53.5%
associate-/r*53.5%
*-commutative53.5%
+-commutative53.5%
+-commutative53.5%
associate-*l/87.3%
+-commutative87.3%
associate-*r/87.3%
remove-double-neg87.3%
+-commutative87.3%
+-commutative87.3%
remove-double-neg87.3%
+-commutative87.3%
associate-+l+87.3%
Simplified87.3%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
clear-num99.8%
associate-/r/99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 89.1%
+-commutative89.1%
Simplified89.1%
Final simplification85.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.9e+161)
(/ (/ y (+ y x)) (+ (+ x 1.0) (* y 2.0)))
(if (<= x -5.5e-138)
(* (/ x (+ x 1.0)) (/ y (* (+ y x) (+ y x))))
(/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.9e+161) {
tmp = (y / (y + x)) / ((x + 1.0) + (y * 2.0));
} else if (x <= -5.5e-138) {
tmp = (x / (x + 1.0)) * (y / ((y + x) * (y + x)));
} 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 <= (-2.9d+161)) then
tmp = (y / (y + x)) / ((x + 1.0d0) + (y * 2.0d0))
else if (x <= (-5.5d-138)) then
tmp = (x / (x + 1.0d0)) * (y / ((y + x) * (y + x)))
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 <= -2.9e+161) {
tmp = (y / (y + x)) / ((x + 1.0) + (y * 2.0));
} else if (x <= -5.5e-138) {
tmp = (x / (x + 1.0)) * (y / ((y + x) * (y + x)));
} 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 <= -2.9e+161: tmp = (y / (y + x)) / ((x + 1.0) + (y * 2.0)) elif x <= -5.5e-138: tmp = (x / (x + 1.0)) * (y / ((y + x) * (y + x))) 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 <= -2.9e+161) tmp = Float64(Float64(y / Float64(y + x)) / Float64(Float64(x + 1.0) + Float64(y * 2.0))); elseif (x <= -5.5e-138) tmp = Float64(Float64(x / Float64(x + 1.0)) * Float64(y / Float64(Float64(y + x) * Float64(y + x)))); 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 <= -2.9e+161)
tmp = (y / (y + x)) / ((x + 1.0) + (y * 2.0));
elseif (x <= -5.5e-138)
tmp = (x / (x + 1.0)) * (y / ((y + x) * (y + x)));
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, -2.9e+161], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.5e-138], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $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 -2.9 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{\left(x + 1\right) + y \cdot 2}\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{x}{x + 1} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\
\end{array}
\end{array}
if x < -2.90000000000000016e161Initial program 52.1%
times-frac76.4%
+-commutative76.4%
+-commutative76.4%
+-commutative76.4%
times-frac52.1%
associate-*l/76.4%
*-commutative76.4%
*-commutative76.4%
distribute-rgt1-in3.4%
fma-def76.4%
+-commutative76.4%
+-commutative76.4%
cube-unmult76.4%
+-commutative76.4%
Simplified76.4%
associate-*r/52.1%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in52.1%
associate-+r+52.1%
*-commutative52.1%
frac-times76.4%
*-commutative76.4%
clear-num76.4%
associate-/r*99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.6%
associate-+r+93.6%
+-commutative93.6%
*-commutative93.6%
Simplified93.6%
if -2.90000000000000016e161 < x < -5.5000000000000003e-138Initial program 71.8%
associate-/r*86.6%
*-commutative86.6%
+-commutative86.6%
+-commutative86.6%
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 76.8%
+-commutative76.8%
Simplified76.8%
if -5.5000000000000003e-138 < x Initial program 70.0%
times-frac88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
times-frac70.0%
associate-*l/85.2%
*-commutative85.2%
*-commutative85.2%
distribute-rgt1-in79.3%
fma-def85.2%
+-commutative85.2%
+-commutative85.2%
cube-unmult85.2%
+-commutative85.2%
Simplified85.2%
associate-*r/70.0%
fma-udef66.8%
cube-mult66.8%
distribute-rgt1-in70.0%
associate-+r+70.0%
*-commutative70.0%
frac-times88.1%
clear-num87.7%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-+r+87.8%
+-commutative87.8%
associate-+l+87.8%
pow287.8%
Applied egg-rr87.8%
Taylor expanded in x around 0 57.7%
Final simplification67.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (let* ((t_0 (/ (/ y (+ y x)) (+ y x)))) (if (<= y 1.32e-17) (* t_0 (/ x (+ x 1.0))) (* t_0 (/ x (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double t_0 = (y / (y + x)) / (y + x);
double tmp;
if (y <= 1.32e-17) {
tmp = t_0 * (x / (x + 1.0));
} else {
tmp = t_0 * (x / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y / (y + x)) / (y + x)
if (y <= 1.32d-17) then
tmp = t_0 * (x / (x + 1.0d0))
else
tmp = t_0 * (x / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (y / (y + x)) / (y + x);
double tmp;
if (y <= 1.32e-17) {
tmp = t_0 * (x / (x + 1.0));
} else {
tmp = t_0 * (x / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / (y + x)) / (y + x) tmp = 0 if y <= 1.32e-17: tmp = t_0 * (x / (x + 1.0)) else: tmp = t_0 * (x / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / Float64(y + x)) / Float64(y + x)) tmp = 0.0 if (y <= 1.32e-17) tmp = Float64(t_0 * Float64(x / Float64(x + 1.0))); else tmp = Float64(t_0 * Float64(x / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (y / (y + x)) / (y + x);
tmp = 0.0;
if (y <= 1.32e-17)
tmp = t_0 * (x / (x + 1.0));
else
tmp = t_0 * (x / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.32e-17], N[(t$95$0 * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{y + x}}{y + x}\\
\mathbf{if}\;y \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;t_0 \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if y < 1.3200000000000001e-17Initial program 72.6%
associate-/r*75.1%
*-commutative75.1%
+-commutative75.1%
+-commutative75.1%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in y around 0 82.3%
+-commutative77.5%
Simplified82.3%
if 1.3200000000000001e-17 < y Initial program 58.9%
associate-/r*71.5%
*-commutative71.5%
+-commutative71.5%
+-commutative71.5%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.8%
remove-double-neg91.8%
+-commutative91.8%
+-commutative91.8%
remove-double-neg91.8%
+-commutative91.8%
associate-+l+91.8%
Simplified91.8%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
clear-num99.6%
associate-/r/99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 82.8%
+-commutative82.8%
Simplified82.8%
Final simplification82.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.3e-78) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y (+ x 1.0))) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.3e-78) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.3d-78) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + (x + 1.0d0))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.3e-78) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.3e-78: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + (x + 1.0))) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.3e-78) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.3e-78)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + (x + 1.0))) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.3e-78], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-78}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\
\end{array}
\end{array}
if y < 3.29999999999999982e-78Initial program 72.3%
associate-/r*74.6%
*-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l/87.3%
+-commutative87.3%
associate-*r/87.3%
remove-double-neg87.3%
+-commutative87.3%
+-commutative87.3%
remove-double-neg87.3%
+-commutative87.3%
associate-+l+87.3%
Simplified87.3%
Taylor expanded in y around 0 62.6%
associate-/r*65.0%
+-commutative65.0%
Simplified65.0%
if 3.29999999999999982e-78 < y Initial program 61.3%
times-frac92.8%
+-commutative92.8%
+-commutative92.8%
+-commutative92.8%
times-frac61.3%
associate-*l/81.4%
*-commutative81.4%
*-commutative81.4%
distribute-rgt1-in74.5%
fma-def81.4%
+-commutative81.4%
+-commutative81.4%
cube-unmult81.4%
+-commutative81.4%
Simplified81.4%
associate-*r/61.3%
fma-udef58.1%
cube-mult58.1%
distribute-rgt1-in61.3%
associate-+r+61.3%
*-commutative61.3%
frac-times92.8%
clear-num92.2%
associate-*l/92.3%
*-un-lft-identity92.3%
associate-+r+92.3%
+-commutative92.3%
associate-+l+92.3%
pow292.3%
Applied egg-rr92.3%
Taylor expanded in x around 0 68.0%
Final simplification66.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ (/ y x) x) (if (<= x -4.4e-184) (/ y x) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -4.4e-184) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) / x
else if (x <= (-4.4d-184)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) / x;
} else if (x <= -4.4e-184) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) / x elif x <= -4.4e-184: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) / x); elseif (x <= -4.4e-184) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) / x;
elseif (x <= -4.4e-184)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -4.4e-184], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-184}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 59.5%
times-frac88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
times-frac59.5%
associate-*l/76.2%
*-commutative76.2%
*-commutative76.2%
distribute-rgt1-in36.1%
fma-def76.2%
+-commutative76.2%
+-commutative76.2%
cube-unmult76.2%
+-commutative76.2%
Simplified76.2%
associate-*r/59.5%
fma-udef31.8%
cube-mult31.7%
distribute-rgt1-in59.5%
associate-+r+59.5%
*-commutative59.5%
frac-times88.0%
*-commutative88.0%
clear-num87.9%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 73.3%
Taylor expanded in y around 0 72.6%
if -1 < x < -4.39999999999999984e-184Initial program 76.9%
associate-/r*81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
associate-*l/91.8%
+-commutative91.8%
associate-*r/91.8%
remove-double-neg91.8%
+-commutative91.8%
+-commutative91.8%
remove-double-neg91.8%
+-commutative91.8%
associate-+l+91.8%
Simplified91.8%
associate-/r*99.5%
div-inv99.4%
Applied egg-rr99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 39.5%
if -4.39999999999999984e-184 < x Initial program 70.2%
associate-/r*73.2%
*-commutative73.2%
+-commutative73.2%
+-commutative73.2%
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 56.1%
+-commutative56.1%
Simplified56.1%
Taylor expanded in y around 0 32.8%
Final simplification44.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.1e-79) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.1e-79) {
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 (y <= 1.1d-79) 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 (y <= 1.1e-79) {
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 y <= 1.1e-79: 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 (y <= 1.1e-79) 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 (y <= 1.1e-79)
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[y, 1.1e-79], 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}\;y \leq 1.1 \cdot 10^{-79}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.0999999999999999e-79Initial program 72.3%
associate-/r*74.6%
*-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l/87.3%
+-commutative87.3%
associate-*r/87.3%
remove-double-neg87.3%
+-commutative87.3%
+-commutative87.3%
remove-double-neg87.3%
+-commutative87.3%
associate-+l+87.3%
Simplified87.3%
Taylor expanded in y around 0 62.6%
if 1.0999999999999999e-79 < y Initial program 61.3%
associate-/r*72.8%
*-commutative72.8%
+-commutative72.8%
+-commutative72.8%
associate-*l/92.8%
+-commutative92.8%
associate-*r/92.8%
remove-double-neg92.8%
+-commutative92.8%
+-commutative92.8%
remove-double-neg92.8%
+-commutative92.8%
associate-+l+92.8%
Simplified92.8%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
Final simplification65.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-81) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-81) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.1d-81) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-81) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-81: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-81) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-81)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + 1.0)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.1e-81], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-81}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 3.09999999999999988e-81Initial program 72.3%
associate-/r*74.6%
*-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l/87.3%
+-commutative87.3%
associate-*r/87.3%
remove-double-neg87.3%
+-commutative87.3%
+-commutative87.3%
remove-double-neg87.3%
+-commutative87.3%
associate-+l+87.3%
Simplified87.3%
Taylor expanded in y around 0 62.6%
if 3.09999999999999988e-81 < y Initial program 61.3%
associate-/r*72.8%
*-commutative72.8%
+-commutative72.8%
+-commutative72.8%
associate-*l/92.8%
+-commutative92.8%
associate-*r/92.8%
remove-double-neg92.8%
+-commutative92.8%
+-commutative92.8%
remove-double-neg92.8%
+-commutative92.8%
associate-+l+92.8%
Simplified92.8%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
*-un-lft-identity69.4%
times-frac67.3%
Applied egg-rr67.3%
associate-*l/67.4%
*-lft-identity67.4%
Simplified67.4%
Final simplification64.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.6e-78) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.6e-78) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.6d-78) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.6e-78) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.6e-78: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.6e-78) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.6e-78)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + 1.0)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.6e-78], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{-78}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 2.6000000000000001e-78Initial program 72.3%
associate-/r*74.6%
*-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l/87.3%
+-commutative87.3%
associate-*r/87.3%
remove-double-neg87.3%
+-commutative87.3%
+-commutative87.3%
remove-double-neg87.3%
+-commutative87.3%
associate-+l+87.3%
Simplified87.3%
Taylor expanded in y around 0 62.6%
associate-/r*65.0%
+-commutative65.0%
Simplified65.0%
if 2.6000000000000001e-78 < y Initial program 61.3%
associate-/r*72.8%
*-commutative72.8%
+-commutative72.8%
+-commutative72.8%
associate-*l/92.8%
+-commutative92.8%
associate-*r/92.8%
remove-double-neg92.8%
+-commutative92.8%
+-commutative92.8%
remove-double-neg92.8%
+-commutative92.8%
associate-+l+92.8%
Simplified92.8%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
*-un-lft-identity69.4%
times-frac67.3%
Applied egg-rr67.3%
associate-*l/67.4%
*-lft-identity67.4%
Simplified67.4%
Final simplification65.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-18) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-18) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-18)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-18) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e-18: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-18) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e-18)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-18], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -9.5000000000000003e-18Initial program 61.1%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
times-frac61.1%
associate-*l/77.1%
*-commutative77.1%
*-commutative77.1%
distribute-rgt1-in37.3%
fma-def77.1%
+-commutative77.1%
+-commutative77.1%
cube-unmult77.1%
+-commutative77.1%
Simplified77.1%
associate-*r/61.2%
fma-udef33.2%
cube-mult33.1%
distribute-rgt1-in61.1%
associate-+r+61.1%
*-commutative61.1%
frac-times88.4%
*-commutative88.4%
clear-num88.4%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 29.2%
Taylor expanded in x around inf 6.3%
if -9.5000000000000003e-18 < x Initial program 71.1%
associate-/r*74.6%
*-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l/89.7%
+-commutative89.7%
associate-*r/89.7%
remove-double-neg89.7%
+-commutative89.7%
+-commutative89.7%
remove-double-neg89.7%
+-commutative89.7%
associate-+l+89.7%
Simplified89.7%
Taylor expanded in x around 0 56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in y around 0 32.0%
Final simplification24.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.95e-130) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.95e-130) {
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 (y <= 1.95d-130) 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 (y <= 1.95e-130) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.95e-130: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.95e-130) 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 (y <= 1.95e-130)
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[y, 1.95e-130], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95 \cdot 10^{-130}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 1.95e-130Initial program 70.8%
associate-/r*73.3%
*-commutative73.3%
+-commutative73.3%
+-commutative73.3%
associate-*l/86.3%
+-commutative86.3%
associate-*r/86.4%
remove-double-neg86.4%
+-commutative86.4%
+-commutative86.4%
remove-double-neg86.4%
+-commutative86.4%
associate-+l+86.4%
Simplified86.4%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
clear-num99.7%
associate-/r/99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 86.0%
+-commutative86.0%
Simplified86.0%
Taylor expanded in y around 0 39.8%
if 1.95e-130 < y Initial program 64.8%
associate-/r*74.9%
*-commutative74.9%
+-commutative74.9%
+-commutative74.9%
associate-*l/93.6%
+-commutative93.6%
associate-*r/93.6%
remove-double-neg93.6%
+-commutative93.6%
+-commutative93.6%
remove-double-neg93.6%
+-commutative93.6%
associate-+l+93.6%
Simplified93.6%
Taylor expanded in x around 0 65.5%
+-commutative65.5%
Simplified65.5%
Taylor expanded in y around 0 34.2%
Final simplification37.5%
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.3%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
times-frac68.3%
associate-*l/83.7%
*-commutative83.7%
*-commutative83.7%
distribute-rgt1-in68.1%
fma-def83.7%
+-commutative83.7%
+-commutative83.7%
cube-unmult83.7%
+-commutative83.7%
Simplified83.7%
associate-*r/68.3%
fma-udef57.7%
cube-mult57.7%
distribute-rgt1-in68.3%
associate-+r+68.3%
*-commutative68.3%
frac-times89.4%
*-commutative89.4%
clear-num89.3%
associate-/r*99.6%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 49.1%
Taylor expanded in x around inf 4.6%
Final simplification4.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 2024018
(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))))