
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* y (/ (/ x (+ y x)) (+ y (+ x 1.0)))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return (y * ((x / (y + x)) / (y + (x + 1.0)))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * ((x / (y + x)) / (y + (x + 1.0d0)))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return (y * ((x / (y + x)) / (y + (x + 1.0)))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return (y * ((x / (y + x)) / (y + (x + 1.0)))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y * Float64(Float64(x / Float64(y + x)) / Float64(y + Float64(x + 1.0)))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y * ((x / (y + x)) / (y + (x + 1.0)))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y * N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y \cdot \frac{\frac{x}{y + x}}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 67.8%
*-un-lft-identity67.8%
associate-*l*67.8%
times-frac73.1%
+-commutative73.1%
*-commutative73.1%
+-commutative73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
Applied egg-rr73.1%
associate-/r*75.9%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
associate-*l/99.8%
*-un-lft-identity99.8%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 6.6e-36)
(* (/ (/ y (+ y x)) (+ y x)) (/ x (+ x 1.0)))
(if (<= y 4.7e+98)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(/ (/ x (+ y (+ x 1.0))) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 6.6e-36) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else if (y <= 4.7e+98) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 6.6d-36) then
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0d0))
else if (y <= 4.7d+98) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = (x / (y + (x + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 6.6e-36) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else if (y <= 4.7e+98) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 6.6e-36: tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0)) elif y <= 4.7e+98: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = (x / (y + (x + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 6.6e-36) tmp = Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x + 1.0))); elseif (y <= 4.7e+98) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 6.6e-36)
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
elseif (y <= 4.7e+98)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = (x / (y + (x + 1.0))) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 6.6e-36], 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, 4.7e+98], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{-36}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x + 1}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{+98}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if y < 6.59999999999999981e-36Initial program 70.0%
*-un-lft-identity70.0%
associate-*l*70.0%
times-frac73.5%
+-commutative73.5%
*-commutative73.5%
+-commutative73.5%
associate-+r+73.5%
+-commutative73.5%
associate-+l+73.5%
Applied egg-rr73.5%
associate-/r*75.8%
associate-/l*99.6%
+-commutative99.6%
Simplified99.6%
frac-times93.9%
*-un-lft-identity93.9%
*-commutative93.9%
+-commutative93.9%
associate-*r/93.8%
*-commutative93.8%
associate-/r*99.8%
frac-times93.9%
*-commutative93.9%
+-commutative93.9%
Applied egg-rr93.9%
times-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 80.8%
if 6.59999999999999981e-36 < y < 4.6999999999999997e98Initial program 89.5%
associate-/l*93.2%
associate-+l+93.2%
Simplified93.2%
if 4.6999999999999997e98 < y Initial program 47.3%
*-un-lft-identity47.3%
associate-*l*47.3%
times-frac62.2%
+-commutative62.2%
*-commutative62.2%
+-commutative62.2%
associate-+r+62.2%
+-commutative62.2%
associate-+l+62.2%
Applied egg-rr62.2%
associate-/r*66.5%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 74.1%
associate-*l/74.1%
*-un-lft-identity74.1%
Applied egg-rr74.1%
Final simplification80.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -7e+154)
(/ 1.0 (* (+ y x) (/ t_0 y)))
(* (/ x (+ y x)) (/ y (* (+ y x) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -7e+154) {
tmp = 1.0 / ((y + x) * (t_0 / y));
} else {
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-7d+154)) then
tmp = 1.0d0 / ((y + x) * (t_0 / y))
else
tmp = (x / (y + x)) * (y / ((y + x) * t_0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -7e+154) {
tmp = 1.0 / ((y + x) * (t_0 / y));
} else {
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -7e+154: tmp = 1.0 / ((y + x) * (t_0 / y)) else: tmp = (x / (y + x)) * (y / ((y + x) * t_0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -7e+154) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(t_0 / y))); else tmp = Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) * t_0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -7e+154)
tmp = 1.0 / ((y + x) * (t_0 / y));
else
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+154], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{t\_0}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot t\_0}\\
\end{array}
\end{array}
if x < -7.00000000000000041e154Initial program 44.1%
*-un-lft-identity44.1%
associate-*l*44.1%
times-frac44.1%
+-commutative44.1%
*-commutative44.1%
+-commutative44.1%
associate-+r+44.1%
+-commutative44.1%
associate-+l+44.1%
Applied egg-rr44.1%
associate-/r*50.8%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.6%
frac-times99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 84.4%
if -7.00000000000000041e154 < x Initial program 71.2%
associate-*l*71.2%
times-frac94.7%
+-commutative94.7%
+-commutative94.7%
associate-+r+94.7%
+-commutative94.7%
associate-+l+94.7%
Applied egg-rr94.7%
Final simplification93.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -6.5e+154)
(/ (/ y (+ y x)) (+ y x))
(if (<= x -7.4e-96)
(/ y (* (+ y x) (+ y (+ x 1.0))))
(/ (/ x (+ y 1.0)) y))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.5e+154) {
tmp = (y / (y + x)) / (y + x);
} else if (x <= -7.4e-96) {
tmp = y / ((y + x) * (y + (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 (x <= (-6.5d+154)) then
tmp = (y / (y + x)) / (y + x)
else if (x <= (-7.4d-96)) then
tmp = y / ((y + x) * (y + (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 (x <= -6.5e+154) {
tmp = (y / (y + x)) / (y + x);
} else if (x <= -7.4e-96) {
tmp = y / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.5e+154: tmp = (y / (y + x)) / (y + x) elif x <= -7.4e-96: tmp = y / ((y + x) * (y + (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 (x <= -6.5e+154) tmp = Float64(Float64(y / Float64(y + x)) / Float64(y + x)); elseif (x <= -7.4e-96) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + 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 (x <= -6.5e+154)
tmp = (y / (y + x)) / (y + x);
elseif (x <= -7.4e-96)
tmp = y / ((y + x) * (y + (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[x, -6.5e+154], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.4e-96], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $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}\;x \leq -6.5 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{y + x}\\
\mathbf{elif}\;x \leq -7.4 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -6.5000000000000005e154Initial program 44.1%
*-un-lft-identity44.1%
associate-*l*44.1%
times-frac44.1%
+-commutative44.1%
*-commutative44.1%
+-commutative44.1%
associate-+r+44.1%
+-commutative44.1%
associate-+l+44.1%
Applied egg-rr44.1%
associate-/r*50.8%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
frac-times73.9%
*-un-lft-identity73.9%
*-commutative73.9%
+-commutative73.9%
associate-*r/73.9%
*-commutative73.9%
associate-/r*99.7%
frac-times73.9%
*-commutative73.9%
+-commutative73.9%
Applied egg-rr73.9%
times-frac99.7%
Simplified99.7%
Taylor expanded in x around inf 84.4%
if -6.5000000000000005e154 < x < -7.39999999999999972e-96Initial program 73.1%
associate-*l*73.1%
times-frac96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
Taylor expanded in x around inf 74.1%
if -7.39999999999999972e-96 < x Initial program 70.5%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
Simplified57.2%
*-un-lft-identity57.2%
times-frac58.4%
Applied egg-rr58.4%
associate-*l/58.4%
*-un-lft-identity58.4%
Applied egg-rr58.4%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.35e+154)
(* (/ 1.0 (+ y x)) (/ y t_0))
(if (<= x -2.9e-95) (/ y (* (+ y x) t_0)) (/ (/ x (+ y 1.0)) y)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+154) {
tmp = (1.0 / (y + x)) * (y / t_0);
} else if (x <= -2.9e-95) {
tmp = y / ((y + x) * t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.35d+154)) then
tmp = (1.0d0 / (y + x)) * (y / t_0)
else if (x <= (-2.9d-95)) then
tmp = y / ((y + x) * t_0)
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 t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+154) {
tmp = (1.0 / (y + x)) * (y / t_0);
} else if (x <= -2.9e-95) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.35e+154: tmp = (1.0 / (y + x)) * (y / t_0) elif x <= -2.9e-95: tmp = y / ((y + x) * t_0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(Float64(1.0 / Float64(y + x)) * Float64(y / t_0)); elseif (x <= -2.9e-95) tmp = Float64(y / Float64(Float64(y + x) * t_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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -1.35e+154)
tmp = (1.0 / (y + x)) * (y / t_0);
elseif (x <= -2.9e-95)
tmp = y / ((y + x) * t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.9e-95], N[(y / N[(N[(y + x), $MachinePrecision] * t$95$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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{y}{t\_0}\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-95}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 44.1%
*-un-lft-identity44.1%
associate-*l*44.1%
times-frac44.1%
+-commutative44.1%
*-commutative44.1%
+-commutative44.1%
associate-+r+44.1%
+-commutative44.1%
associate-+l+44.1%
Applied egg-rr44.1%
associate-/r*50.8%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 84.4%
if -1.35000000000000003e154 < x < -2.90000000000000002e-95Initial program 73.1%
associate-*l*73.1%
times-frac96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
Taylor expanded in x around inf 74.1%
if -2.90000000000000002e-95 < x Initial program 70.5%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
Simplified57.2%
*-un-lft-identity57.2%
times-frac58.4%
Applied egg-rr58.4%
associate-*l/58.4%
*-un-lft-identity58.4%
Applied egg-rr58.4%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.4e+155)
(/ 1.0 (* (+ y x) (/ t_0 y)))
(if (<= x -2.05e-95) (/ y (* (+ y x) t_0)) (/ (/ x (+ y 1.0)) y)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.4e+155) {
tmp = 1.0 / ((y + x) * (t_0 / y));
} else if (x <= -2.05e-95) {
tmp = y / ((y + x) * t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.4d+155)) then
tmp = 1.0d0 / ((y + x) * (t_0 / y))
else if (x <= (-2.05d-95)) then
tmp = y / ((y + x) * t_0)
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 t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.4e+155) {
tmp = 1.0 / ((y + x) * (t_0 / y));
} else if (x <= -2.05e-95) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.4e+155: tmp = 1.0 / ((y + x) * (t_0 / y)) elif x <= -2.05e-95: tmp = y / ((y + x) * t_0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.4e+155) tmp = Float64(1.0 / Float64(Float64(y + x) * Float64(t_0 / y))); elseif (x <= -2.05e-95) tmp = Float64(y / Float64(Float64(y + x) * t_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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -1.4e+155)
tmp = 1.0 / ((y + x) * (t_0 / y));
elseif (x <= -2.05e-95)
tmp = y / ((y + x) * t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+155], N[(1.0 / N[(N[(y + x), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.05e-95], N[(y / N[(N[(y + x), $MachinePrecision] * t$95$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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+155}:\\
\;\;\;\;\frac{1}{\left(y + x\right) \cdot \frac{t\_0}{y}}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{-95}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.40000000000000008e155Initial program 44.1%
*-un-lft-identity44.1%
associate-*l*44.1%
times-frac44.1%
+-commutative44.1%
*-commutative44.1%
+-commutative44.1%
associate-+r+44.1%
+-commutative44.1%
associate-+l+44.1%
Applied egg-rr44.1%
associate-/r*50.8%
associate-/l*99.8%
+-commutative99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.6%
frac-times99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 84.4%
if -1.40000000000000008e155 < x < -2.0499999999999999e-95Initial program 73.1%
associate-*l*73.1%
times-frac96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
Taylor expanded in x around inf 74.1%
if -2.0499999999999999e-95 < x Initial program 70.5%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
Simplified57.2%
*-un-lft-identity57.2%
times-frac58.4%
Applied egg-rr58.4%
associate-*l/58.4%
*-un-lft-identity58.4%
Applied egg-rr58.4%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.35e+36) (* (/ (/ y (+ y x)) (+ y x)) (/ x (+ x 1.0))) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.35e+36) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.35d+36) then
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0d0))
else
tmp = (x / (y + (x + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.35e+36) {
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.35e+36: tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0)) else: tmp = (x / (y + (x + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.35e+36) tmp = Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.35e+36)
tmp = ((y / (y + x)) / (y + x)) * (x / (x + 1.0));
else
tmp = (x / (y + (x + 1.0))) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.35e+36], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.35 \cdot 10^{+36}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if y < 2.34999999999999994e36Initial program 72.3%
*-un-lft-identity72.3%
associate-*l*72.3%
times-frac75.5%
+-commutative75.5%
*-commutative75.5%
+-commutative75.5%
associate-+r+75.5%
+-commutative75.5%
associate-+l+75.5%
Applied egg-rr75.5%
associate-/r*77.6%
associate-/l*99.6%
+-commutative99.6%
Simplified99.6%
frac-times94.3%
*-un-lft-identity94.3%
*-commutative94.3%
+-commutative94.3%
associate-*r/94.3%
*-commutative94.3%
associate-/r*99.8%
frac-times94.3%
*-commutative94.3%
+-commutative94.3%
Applied egg-rr94.3%
times-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 81.3%
if 2.34999999999999994e36 < y Initial program 54.1%
*-un-lft-identity54.1%
associate-*l*54.1%
times-frac65.8%
+-commutative65.8%
*-commutative65.8%
+-commutative65.8%
associate-+r+65.8%
+-commutative65.8%
associate-+l+65.8%
Applied egg-rr65.8%
associate-/r*70.7%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 72.7%
associate-*l/72.7%
*-un-lft-identity72.7%
Applied egg-rr72.7%
Final simplification79.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ (/ y (+ y x)) (+ y x)) (/ x (+ y (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
return ((y / (y + x)) / (y + x)) * (x / (y + (x + 1.0)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (y + x)) / (y + x)) * (x / (y + (x + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + x)) / (y + x)) * (x / (y + (x + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + x)) / (y + x)) * (x / (y + (x + 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(y + Float64(x + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + x)) / (y + x)) * (x / (y + (x + 1.0)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + N[(x + 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}{y + \left(x + 1\right)}
\end{array}
Initial program 67.8%
*-un-lft-identity67.8%
associate-*l*67.8%
times-frac73.1%
+-commutative73.1%
*-commutative73.1%
+-commutative73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
Applied egg-rr73.1%
associate-/r*75.9%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
frac-times92.1%
*-un-lft-identity92.1%
*-commutative92.1%
+-commutative92.1%
associate-*r/92.1%
*-commutative92.1%
associate-/r*99.8%
frac-times92.1%
*-commutative92.1%
+-commutative92.1%
Applied egg-rr92.1%
times-frac99.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 (if (<= y 1.85e-106) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.85e-106) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.85d-106) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + (x + 1.0d0))) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.85e-106) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.85e-106: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + (x + 1.0))) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.85e-106) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.85e-106)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + (x + 1.0))) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.85e-106], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{-106}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x}\\
\end{array}
\end{array}
if y < 1.8499999999999999e-106Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
if 1.8499999999999999e-106 < y Initial program 64.6%
*-un-lft-identity64.6%
associate-*l*64.6%
times-frac73.5%
+-commutative73.5%
*-commutative73.5%
+-commutative73.5%
associate-+r+73.5%
+-commutative73.5%
associate-+l+73.5%
Applied egg-rr73.5%
associate-/r*77.0%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 66.9%
associate-*l/66.9%
*-un-lft-identity66.9%
Applied egg-rr66.9%
Final simplification61.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.0) (/ x y) (* (/ 1.0 y) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = (1.0 / y) * (x / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.0d0) then
tmp = x / y
else
tmp = (1.0d0 / y) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = (1.0 / y) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.0: tmp = x / y else: tmp = (1.0 / y) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.0) tmp = Float64(x / y); else tmp = Float64(Float64(1.0 / y) * 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.0)
tmp = x / y;
else
tmp = (1.0 / y) * (x / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 1Initial program 71.1%
associate-/l*81.9%
associate-+l+81.9%
Simplified81.9%
Taylor expanded in x around 0 42.4%
+-commutative42.4%
Simplified42.4%
*-un-lft-identity42.4%
times-frac44.2%
Applied egg-rr44.2%
Taylor expanded in y around 0 25.8%
if 1 < y Initial program 59.2%
*-un-lft-identity59.2%
associate-*l*59.2%
times-frac69.6%
+-commutative69.6%
*-commutative69.6%
+-commutative69.6%
associate-+r+69.6%
+-commutative69.6%
associate-+l+69.6%
Applied egg-rr69.6%
associate-/r*73.9%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 65.3%
Taylor expanded in y around inf 64.6%
Final simplification36.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x 3.55e+61) (/ x (* y (+ y 1.0))) (* (/ 1.0 y) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= 3.55e+61) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (1.0 / y) * (x / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 3.55d+61) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (1.0d0 / y) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= 3.55e+61) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (1.0 / y) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= 3.55e+61: tmp = x / (y * (y + 1.0)) else: tmp = (1.0 / y) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= 3.55e+61) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(1.0 / y) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= 3.55e+61)
tmp = x / (y * (y + 1.0));
else
tmp = (1.0 / y) * (x / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, 3.55e+61], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.55 \cdot 10^{+61}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 3.55e61Initial program 69.6%
associate-/l*82.2%
associate-+l+82.2%
Simplified82.2%
Taylor expanded in x around 0 58.0%
+-commutative58.0%
Simplified58.0%
if 3.55e61 < x Initial program 60.0%
*-un-lft-identity60.0%
associate-*l*60.0%
times-frac63.8%
+-commutative63.8%
*-commutative63.8%
+-commutative63.8%
associate-+r+63.8%
+-commutative63.8%
associate-+l+63.8%
Applied egg-rr63.8%
associate-/r*71.7%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 21.3%
Taylor expanded in y around inf 20.6%
Final simplification50.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 5.9e-108) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 5.9e-108) {
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 <= 5.9d-108) 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 <= 5.9e-108) {
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 <= 5.9e-108: 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 <= 5.9e-108) 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 <= 5.9e-108)
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, 5.9e-108], 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 5.9 \cdot 10^{-108}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 5.89999999999999965e-108Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
if 5.89999999999999965e-108 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
Final simplification61.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.9e-106) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-106) {
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 <= 1.9d-106) 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 <= 1.9e-106) {
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 <= 1.9e-106: 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 <= 1.9e-106) 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 <= 1.9e-106)
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, 1.9e-106], 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 1.9 \cdot 10^{-106}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.9e-106Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
if 1.9e-106 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
*-un-lft-identity69.2%
times-frac65.7%
Applied egg-rr65.7%
associate-*l/65.7%
*-un-lft-identity65.7%
Applied egg-rr65.7%
Final simplification60.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.9e-106) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-106) {
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 <= 1.9d-106) 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 <= 1.9e-106) {
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 <= 1.9e-106: 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 <= 1.9e-106) 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 <= 1.9e-106)
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, 1.9e-106], 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 1.9 \cdot 10^{-106}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.9e-106Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
if 1.9e-106 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
*-un-lft-identity69.2%
times-frac65.7%
Applied egg-rr65.7%
associate-*l/65.7%
*-un-lft-identity65.7%
Applied egg-rr65.7%
Final simplification61.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.55e-31) (/ 1.0 (+ x 1.0)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.55e-31) {
tmp = 1.0 / (x + 1.0);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.55d-31)) then
tmp = 1.0d0 / (x + 1.0d0)
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.55e-31) {
tmp = 1.0 / (x + 1.0);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.55e-31: tmp = 1.0 / (x + 1.0) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.55e-31) tmp = Float64(1.0 / Float64(x + 1.0)); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.55e-31)
tmp = 1.0 / (x + 1.0);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.55e-31], N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{-31}:\\
\;\;\;\;\frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2.5499999999999999e-31Initial program 52.8%
*-un-lft-identity52.8%
associate-*l*52.8%
times-frac62.0%
+-commutative62.0%
*-commutative62.0%
+-commutative62.0%
associate-+r+62.0%
+-commutative62.0%
associate-+l+62.0%
Applied egg-rr62.0%
associate-/r*67.1%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
frac-times98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Taylor expanded in y around 0 69.9%
Taylor expanded in y around inf 6.1%
+-commutative6.1%
Simplified6.1%
if -2.5499999999999999e-31 < x Initial program 72.7%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
Taylor expanded in x around 0 56.1%
+-commutative56.1%
Simplified56.1%
*-un-lft-identity56.1%
times-frac57.1%
Applied egg-rr57.1%
Taylor expanded in y around 0 32.3%
Final simplification25.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 y))
assert(x < y);
double code(double x, double y) {
return 1.0 / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / y
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / y;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / y
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y}
\end{array}
Initial program 67.8%
*-un-lft-identity67.8%
associate-*l*67.8%
times-frac73.1%
+-commutative73.1%
*-commutative73.1%
+-commutative73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
Applied egg-rr73.1%
associate-/r*75.9%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 38.0%
Taylor expanded in y around 0 4.2%
Final simplification4.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 67.8%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
Simplified50.0%
*-un-lft-identity50.0%
times-frac50.1%
Applied egg-rr50.1%
Taylor expanded in y around 0 25.0%
Final simplification25.0%
(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 2024055
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))