
(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 18 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 (* (* (/ 1.0 (+ x (+ y 1.0))) (/ x (+ x y))) (/ y (+ x y))))
assert(x < y);
double code(double x, double y) {
return ((1.0 / (x + (y + 1.0))) * (x / (x + y))) * (y / (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 = ((1.0d0 / (x + (y + 1.0d0))) * (x / (x + y))) * (y / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return ((1.0 / (x + (y + 1.0))) * (x / (x + y))) * (y / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return ((1.0 / (x + (y + 1.0))) * (x / (x + y))) * (y / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(1.0 / Float64(x + Float64(y + 1.0))) * Float64(x / Float64(x + y))) * Float64(y / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((1.0 / (x + (y + 1.0))) * (x / (x + y))) * (y / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(1.0 / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\frac{1}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}\right) \cdot \frac{y}{x + y}
\end{array}
Initial program 68.7%
+-commutative68.7%
distribute-rgt-in68.7%
+-commutative68.7%
+-commutative68.7%
Applied egg-rr68.7%
times-frac84.4%
distribute-rgt-out88.0%
associate-/l/99.7%
+-commutative99.7%
associate-+r+99.7%
frac-times94.1%
+-commutative94.1%
*-commutative94.1%
+-commutative94.1%
times-frac99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
div-inv99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.56e+154)
(* (/ (- 1.0 (/ y x)) (+ x y)) (/ y t_0))
(* (/ x (+ x y)) (/ y (* (+ x y) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.56e+154) {
tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
} else {
tmp = (x / (x + y)) * (y / ((x + y) * 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 <= (-1.56d+154)) then
tmp = ((1.0d0 - (y / x)) / (x + y)) * (y / t_0)
else
tmp = (x / (x + y)) * (y / ((x + y) * 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 <= -1.56e+154) {
tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
} else {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.56e+154: tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0) else: tmp = (x / (x + y)) * (y / ((x + y) * 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 <= -1.56e+154) tmp = Float64(Float64(Float64(1.0 - Float64(y / x)) / Float64(x + y)) * Float64(y / t_0)); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * 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 <= -1.56e+154)
tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
else
tmp = (x / (x + y)) * (y / ((x + y) * 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, -1.56e+154], N[(N[(N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $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 -1.56 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - \frac{y}{x}}{x + y} \cdot \frac{y}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\
\end{array}
\end{array}
if x < -1.55999999999999993e154Initial program 57.8%
associate-*l*57.8%
times-frac75.4%
+-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
+-commutative75.4%
associate-+l+75.4%
Applied egg-rr75.4%
frac-times57.8%
*-commutative57.8%
+-commutative57.8%
Applied egg-rr57.8%
associate-/r*57.8%
*-commutative57.8%
associate-*l/75.4%
times-frac99.7%
Simplified99.7%
Taylor expanded in x around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
Simplified81.5%
if -1.55999999999999993e154 < x Initial program 70.0%
associate-*l*70.1%
times-frac96.4%
+-commutative96.4%
+-commutative96.4%
associate-+r+96.4%
+-commutative96.4%
associate-+l+96.4%
Applied egg-rr96.4%
Final simplification94.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.35e+154) (/ 1.0 (* (+ x y) (/ (+ x (+ y 1.0)) y))) (* (/ x (+ x y)) (/ y (* (+ x y) (+ y (+ x 1.0)))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
} else {
tmp = (x / (x + y)) * (y / ((x + y) * (y + (x + 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.35d+154)) then
tmp = 1.0d0 / ((x + y) * ((x + (y + 1.0d0)) / y))
else
tmp = (x / (x + y)) * (y / ((x + y) * (y + (x + 1.0d0))))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
} else {
tmp = (x / (x + y)) * (y / ((x + y) * (y + (x + 1.0))));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.35e+154: tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y)) else: tmp = (x / (x + y)) * (y / ((x + y) * (y + (x + 1.0)))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / Float64(Float64(x + y) * Float64(Float64(x + Float64(y + 1.0)) / y))); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0))))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.35e+154)
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
else
tmp = (x / (x + y)) * (y / ((x + y) * (y + (x + 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.35e+154], N[(1.0 / N[(N[(x + y), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\left(x + y\right) \cdot \frac{x + \left(y + 1\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 57.8%
associate-*l*57.8%
times-frac75.4%
+-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
+-commutative75.4%
associate-+l+75.4%
Applied egg-rr75.4%
frac-times57.8%
*-commutative57.8%
+-commutative57.8%
Applied egg-rr57.8%
associate-/r*57.8%
*-commutative57.8%
associate-*l/75.4%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.9%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 81.1%
if -1.35000000000000003e154 < x Initial program 70.0%
associate-*l*70.1%
times-frac96.4%
+-commutative96.4%
+-commutative96.4%
associate-+r+96.4%
+-commutative96.4%
associate-+l+96.4%
Applied egg-rr96.4%
Final simplification94.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -9.5e+118)
(* (/ y t_0) (/ 1.0 (+ x y)))
(* x (/ (/ y (* (+ x y) t_0)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -9.5e+118) {
tmp = (y / t_0) * (1.0 / (x + y));
} else {
tmp = x * ((y / ((x + y) * t_0)) / (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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-9.5d+118)) then
tmp = (y / t_0) * (1.0d0 / (x + y))
else
tmp = x * ((y / ((x + y) * t_0)) / (x + 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 <= -9.5e+118) {
tmp = (y / t_0) * (1.0 / (x + y));
} else {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -9.5e+118: tmp = (y / t_0) * (1.0 / (x + y)) else: tmp = x * ((y / ((x + y) * t_0)) / (x + 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 <= -9.5e+118) tmp = Float64(Float64(y / t_0) * Float64(1.0 / Float64(x + y))); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + 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 <= -9.5e+118)
tmp = (y / t_0) * (1.0 / (x + y));
else
tmp = x * ((y / ((x + y) * t_0)) / (x + 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, -9.5e+118], N[(N[(y / t$95$0), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $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 -9.5 \cdot 10^{+118}:\\
\;\;\;\;\frac{y}{t\_0} \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\end{array}
\end{array}
if x < -9.49999999999999974e118Initial program 49.8%
associate-*l*49.8%
times-frac80.2%
+-commutative80.2%
+-commutative80.2%
associate-+r+80.2%
+-commutative80.2%
associate-+l+80.2%
Applied egg-rr80.2%
frac-times49.8%
*-commutative49.8%
+-commutative49.8%
Applied egg-rr49.8%
associate-/r*60.4%
*-commutative60.4%
associate-*l/80.2%
times-frac99.8%
Simplified99.8%
Taylor expanded in x around inf 76.7%
if -9.49999999999999974e118 < x Initial program 71.7%
associate-/l*83.6%
associate-+l+83.6%
Simplified83.6%
*-un-lft-identity83.6%
associate-+r+83.6%
associate-*l*83.6%
times-frac94.6%
+-commutative94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
associate-+l+94.6%
Applied egg-rr94.6%
associate-*l/94.6%
*-lft-identity94.6%
+-commutative94.6%
Simplified94.6%
Final simplification92.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.4e+154)
(/ 1.0 (* (+ x y) (/ (+ x (+ y 1.0)) y)))
(if (<= x -9.8e-68)
(/ y (* (+ x y) (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.4e+154) {
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
} else if (x <= -9.8e-68) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (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.4d+154)) then
tmp = 1.0d0 / ((x + y) * ((x + (y + 1.0d0)) / y))
else if (x <= (-9.8d-68)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (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.4e+154) {
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
} else if (x <= -9.8e-68) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.4e+154: tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y)) elif x <= -9.8e-68: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.4e+154) tmp = Float64(1.0 / Float64(Float64(x + y) * Float64(Float64(x + Float64(y + 1.0)) / y))); elseif (x <= -9.8e-68) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.4e+154)
tmp = 1.0 / ((x + y) * ((x + (y + 1.0)) / y));
elseif (x <= -9.8e-68)
tmp = y / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (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.4e+154], N[(1.0 / N[(N[(x + y), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.8e-68], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\left(x + y\right) \cdot \frac{x + \left(y + 1\right)}{y}}\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.4e154Initial program 57.8%
associate-*l*57.8%
times-frac75.4%
+-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
+-commutative75.4%
associate-+l+75.4%
Applied egg-rr75.4%
frac-times57.8%
*-commutative57.8%
+-commutative57.8%
Applied egg-rr57.8%
associate-/r*57.8%
*-commutative57.8%
associate-*l/75.4%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.9%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 81.1%
if -1.4e154 < x < -9.79999999999999954e-68Initial program 69.1%
associate-*l*69.1%
times-frac96.0%
+-commutative96.0%
+-commutative96.0%
associate-+r+96.0%
+-commutative96.0%
associate-+l+96.0%
Applied egg-rr96.0%
Taylor expanded in x around inf 72.7%
if -9.79999999999999954e-68 < x Initial program 70.3%
associate-*l*70.3%
times-frac96.6%
+-commutative96.6%
+-commutative96.6%
associate-+r+96.6%
+-commutative96.6%
associate-+l+96.6%
Applied egg-rr96.6%
frac-times70.3%
*-commutative70.3%
+-commutative70.3%
Applied egg-rr70.3%
associate-/r*74.3%
*-commutative74.3%
associate-*l/96.6%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 61.3%
+-commutative61.3%
Simplified61.3%
Final simplification65.6%
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)
(* (/ y t_0) (/ 1.0 (+ x y)))
(if (<= x -1.15e-68) (/ y (* (+ x y) t_0)) (/ (/ x (+ x y)) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+154) {
tmp = (y / t_0) * (1.0 / (x + y));
} else if (x <= -1.15e-68) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / (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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.35d+154)) then
tmp = (y / t_0) * (1.0d0 / (x + y))
else if (x <= (-1.15d-68)) then
tmp = y / ((x + y) * t_0)
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+154) {
tmp = (y / t_0) * (1.0 / (x + y));
} else if (x <= -1.15e-68) {
tmp = y / ((x + y) * t_0);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
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 = (y / t_0) * (1.0 / (x + y)) elif x <= -1.15e-68: tmp = y / ((x + y) * t_0) else: tmp = (x / (x + y)) / (y + 1.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 <= -1.35e+154) tmp = Float64(Float64(y / t_0) * Float64(1.0 / Float64(x + y))); elseif (x <= -1.15e-68) tmp = Float64(y / Float64(Float64(x + y) * t_0)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.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 <= -1.35e+154)
tmp = (y / t_0) * (1.0 / (x + y));
elseif (x <= -1.15e-68)
tmp = y / ((x + y) * t_0);
else
tmp = (x / (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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(N[(y / t$95$0), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.15e-68], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $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 -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{y}{t\_0} \cdot \frac{1}{x + y}\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 57.8%
associate-*l*57.8%
times-frac75.4%
+-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
+-commutative75.4%
associate-+l+75.4%
Applied egg-rr75.4%
frac-times57.8%
*-commutative57.8%
+-commutative57.8%
Applied egg-rr57.8%
associate-/r*57.8%
*-commutative57.8%
associate-*l/75.4%
times-frac99.7%
Simplified99.7%
Taylor expanded in x around inf 81.0%
if -1.35000000000000003e154 < x < -1.14999999999999998e-68Initial program 69.7%
associate-*l*69.7%
times-frac96.0%
+-commutative96.0%
+-commutative96.0%
associate-+r+96.0%
+-commutative96.0%
associate-+l+96.0%
Applied egg-rr96.0%
Taylor expanded in x around inf 71.4%
if -1.14999999999999998e-68 < x Initial program 70.1%
associate-*l*70.2%
times-frac96.5%
+-commutative96.5%
+-commutative96.5%
associate-+r+96.5%
+-commutative96.5%
associate-+l+96.5%
Applied egg-rr96.5%
frac-times70.2%
*-commutative70.2%
+-commutative70.2%
Applied egg-rr70.2%
associate-/r*74.2%
*-commutative74.2%
associate-*l/96.5%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 61.0%
+-commutative61.0%
Simplified61.0%
Final simplification65.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.25e+154)
(* (/ y (+ x y)) (/ 1.0 x))
(if (<= x -6e-69)
(/ y (* (+ x y) (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.25e+154) {
tmp = (y / (x + y)) * (1.0 / x);
} else if (x <= -6e-69) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (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.25d+154)) then
tmp = (y / (x + y)) * (1.0d0 / x)
else if (x <= (-6d-69)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (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.25e+154) {
tmp = (y / (x + y)) * (1.0 / x);
} else if (x <= -6e-69) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.25e+154: tmp = (y / (x + y)) * (1.0 / x) elif x <= -6e-69: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.25e+154) tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / x)); elseif (x <= -6e-69) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.25e+154)
tmp = (y / (x + y)) * (1.0 / x);
elseif (x <= -6e-69)
tmp = y / ((x + y) * (y + (x + 1.0)));
else
tmp = (x / (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.25e+154], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e-69], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+154}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-69}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.25000000000000001e154Initial program 57.8%
+-commutative57.8%
distribute-rgt-in57.8%
+-commutative57.8%
+-commutative57.8%
Applied egg-rr57.8%
times-frac69.0%
distribute-rgt-out75.4%
associate-/l/99.7%
+-commutative99.7%
associate-+r+99.7%
frac-times75.4%
+-commutative75.4%
*-commutative75.4%
+-commutative75.4%
times-frac99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.6%
if -1.25000000000000001e154 < x < -5.99999999999999978e-69Initial program 69.7%
associate-*l*69.7%
times-frac96.0%
+-commutative96.0%
+-commutative96.0%
associate-+r+96.0%
+-commutative96.0%
associate-+l+96.0%
Applied egg-rr96.0%
Taylor expanded in x around inf 71.4%
if -5.99999999999999978e-69 < x Initial program 70.1%
associate-*l*70.2%
times-frac96.5%
+-commutative96.5%
+-commutative96.5%
associate-+r+96.5%
+-commutative96.5%
associate-+l+96.5%
Applied egg-rr96.5%
frac-times70.2%
*-commutative70.2%
+-commutative70.2%
Applied egg-rr70.2%
associate-/r*74.2%
*-commutative74.2%
associate-*l/96.5%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 61.0%
+-commutative61.0%
Simplified61.0%
Final simplification65.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2200.0) (* (/ y (+ y (+ x 1.0))) (/ 1.0 (+ x y))) (* (/ (/ x (+ x y)) (+ x y)) (/ y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2200.0) {
tmp = (y / (y + (x + 1.0))) * (1.0 / (x + y));
} else {
tmp = ((x / (x + y)) / (x + y)) * (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 <= (-2200.0d0)) then
tmp = (y / (y + (x + 1.0d0))) * (1.0d0 / (x + y))
else
tmp = ((x / (x + y)) / (x + y)) * (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 <= -2200.0) {
tmp = (y / (y + (x + 1.0))) * (1.0 / (x + y));
} else {
tmp = ((x / (x + y)) / (x + y)) * (y / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2200.0: tmp = (y / (y + (x + 1.0))) * (1.0 / (x + y)) else: tmp = ((x / (x + y)) / (x + y)) * (y / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2200.0) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) * Float64(1.0 / Float64(x + y))); else tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + y)) * 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 <= -2200.0)
tmp = (y / (y + (x + 1.0))) * (1.0 / (x + y));
else
tmp = ((x / (x + y)) / (x + y)) * (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, -2200.0], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * 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 -2200:\\
\;\;\;\;\frac{y}{y + \left(x + 1\right)} \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y} \cdot \frac{y}{y + 1}\\
\end{array}
\end{array}
if x < -2200Initial program 58.7%
associate-*l*58.7%
times-frac85.0%
+-commutative85.0%
+-commutative85.0%
associate-+r+85.0%
+-commutative85.0%
associate-+l+85.0%
Applied egg-rr85.0%
frac-times58.7%
*-commutative58.7%
+-commutative58.7%
Applied egg-rr58.7%
associate-/r*69.8%
*-commutative69.8%
associate-*l/85.0%
times-frac99.7%
Simplified99.7%
Taylor expanded in x around inf 74.9%
if -2200 < x Initial program 71.7%
associate-*l*71.7%
times-frac96.8%
+-commutative96.8%
+-commutative96.8%
associate-+r+96.8%
+-commutative96.8%
associate-+l+96.8%
Applied egg-rr96.8%
frac-times71.7%
*-commutative71.7%
+-commutative71.7%
Applied egg-rr71.7%
associate-/r*76.0%
*-commutative76.0%
associate-*l/96.8%
times-frac99.7%
Simplified99.7%
Taylor expanded in x around 0 82.0%
+-commutative82.0%
Simplified82.0%
Final simplification80.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ y (+ x y)) (/ (/ x (+ x y)) (+ x (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
return (y / (x + y)) * ((x / (x + y)) / (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 / (x + y)) * ((x / (x + y)) / (x + (y + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (x + y)) * ((x / (x + y)) / (x + (y + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (x + y)) * ((x / (x + y)) / (x + (y + 1.0)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(x + y)) * Float64(Float64(x / Float64(x + y)) / Float64(x + Float64(y + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (x + y)) * ((x / (x + y)) / (x + (y + 1.0)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x + y} \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}
\end{array}
Initial program 68.7%
+-commutative68.7%
distribute-rgt-in68.7%
+-commutative68.7%
+-commutative68.7%
Applied egg-rr68.7%
times-frac84.4%
distribute-rgt-out88.0%
associate-/l/99.7%
+-commutative99.7%
associate-+r+99.7%
frac-times94.1%
+-commutative94.1%
*-commutative94.1%
+-commutative94.1%
times-frac99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3e-68) (* (/ y (+ y (+ x 1.0))) (/ 1.0 x)) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3e-68) {
tmp = (y / (y + (x + 1.0))) * (1.0 / x);
} else {
tmp = (x / (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 <= (-3d-68)) then
tmp = (y / (y + (x + 1.0d0))) * (1.0d0 / x)
else
tmp = (x / (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 <= -3e-68) {
tmp = (y / (y + (x + 1.0))) * (1.0 / x);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3e-68: tmp = (y / (y + (x + 1.0))) * (1.0 / x) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3e-68) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) * Float64(1.0 / x)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3e-68)
tmp = (y / (y + (x + 1.0))) * (1.0 / x);
else
tmp = (x / (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, -3e-68], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{y + \left(x + 1\right)} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -3e-68Initial program 65.4%
associate-*l*65.4%
times-frac88.6%
+-commutative88.6%
+-commutative88.6%
associate-+r+88.6%
+-commutative88.6%
associate-+l+88.6%
Applied egg-rr88.6%
frac-times65.4%
*-commutative65.4%
+-commutative65.4%
Applied egg-rr65.4%
associate-/r*75.5%
*-commutative75.5%
associate-*l/88.6%
times-frac99.6%
Simplified99.6%
Taylor expanded in x around inf 66.1%
if -3e-68 < x Initial program 70.1%
associate-*l*70.2%
times-frac96.5%
+-commutative96.5%
+-commutative96.5%
associate-+r+96.5%
+-commutative96.5%
associate-+l+96.5%
Applied egg-rr96.5%
frac-times70.2%
*-commutative70.2%
+-commutative70.2%
Applied egg-rr70.2%
associate-/r*74.2%
*-commutative74.2%
associate-*l/96.5%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 61.0%
+-commutative61.0%
Simplified61.0%
Final simplification62.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -6.2e-66) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.2e-66) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (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 <= (-6.2d-66)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (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 <= -6.2e-66) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.2e-66: tmp = (y / x) / (x + 1.0) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -6.2e-66) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -6.2e-66)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (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, -6.2e-66], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -6.1999999999999995e-66Initial program 65.0%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 64.6%
associate-/r*66.5%
+-commutative66.5%
Simplified66.5%
if -6.1999999999999995e-66 < x Initial program 70.3%
associate-*l*70.3%
times-frac96.6%
+-commutative96.6%
+-commutative96.6%
associate-+r+96.6%
+-commutative96.6%
associate-+l+96.6%
Applied egg-rr96.6%
frac-times70.3%
*-commutative70.3%
+-commutative70.3%
Applied egg-rr70.3%
associate-/r*74.3%
*-commutative74.3%
associate-*l/96.6%
times-frac99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
associate-+r+99.5%
+-commutative99.5%
associate-+l+99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 61.3%
+-commutative61.3%
Simplified61.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8.8e-66) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.8e-66) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-8.8d-66)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -8.8e-66) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8.8e-66: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8.8e-66) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -8.8e-66)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -8.8e-66], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{-66}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -8.8000000000000004e-66Initial program 65.0%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 64.6%
associate-/r*66.5%
+-commutative66.5%
Simplified66.5%
if -8.8000000000000004e-66 < x Initial program 70.3%
associate-/l*83.2%
associate-+l+83.2%
Simplified83.2%
Taylor expanded in x around 0 61.2%
associate-/r*61.2%
+-commutative61.2%
Simplified61.2%
associate-/l/61.2%
*-commutative61.2%
div-inv61.3%
associate-/r*60.9%
Applied egg-rr60.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.1e-66) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e-66) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.1d-66)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e-66) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.1e-66: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.1e-66) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.1e-66)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.1e-66], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3.0999999999999997e-66Initial program 65.0%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 64.6%
if -3.0999999999999997e-66 < x Initial program 70.3%
associate-/l*83.2%
associate-+l+83.2%
Simplified83.2%
Taylor expanded in x around 0 61.2%
associate-/r*61.2%
+-commutative61.2%
Simplified61.2%
associate-/l/61.2%
*-commutative61.2%
div-inv61.3%
associate-/r*60.9%
Applied egg-rr60.9%
Final simplification62.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.1e-66) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.1e-66) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.1d-66)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.1e-66) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.1e-66: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.1e-66) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.1e-66)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3.1e-66], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -3.0999999999999997e-66Initial program 65.0%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 64.6%
if -3.0999999999999997e-66 < x Initial program 70.3%
associate-/l*83.2%
associate-+l+83.2%
Simplified83.2%
Taylor expanded in x around 0 61.3%
+-commutative61.3%
Simplified61.3%
Final simplification62.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2250.0) (/ 1.0 (+ x 1.0)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2250.0) {
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 <= (-2250.0d0)) 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 <= -2250.0) {
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 <= -2250.0: 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 <= -2250.0) 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 <= -2250.0)
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, -2250.0], 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 -2250:\\
\;\;\;\;\frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2250Initial program 58.7%
associate-*l*58.7%
times-frac85.0%
+-commutative85.0%
+-commutative85.0%
associate-+r+85.0%
+-commutative85.0%
associate-+l+85.0%
Applied egg-rr85.0%
Taylor expanded in x around 0 33.4%
Taylor expanded in y around 0 6.2%
+-commutative6.2%
Simplified6.2%
if -2250 < x Initial program 71.7%
associate-/l*84.0%
associate-+l+84.0%
Simplified84.0%
Taylor expanded in x around 0 61.0%
+-commutative61.0%
Simplified61.0%
Taylor expanded in y around 0 40.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
return x / (y * (y + 1.0));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * (y + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * (y + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * Float64(y + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Initial program 68.7%
associate-/l*81.6%
associate-+l+81.6%
Simplified81.6%
Taylor expanded in x around 0 52.3%
+-commutative52.3%
Simplified52.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 68.7%
associate-/l*81.6%
associate-+l+81.6%
Simplified81.6%
Taylor expanded in x around 0 52.3%
+-commutative52.3%
Simplified52.3%
Taylor expanded in y around 0 31.4%
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])\\
\\
1 - x
\end{array}
Initial program 68.7%
associate-*l*68.7%
times-frac94.1%
+-commutative94.1%
+-commutative94.1%
associate-+r+94.1%
+-commutative94.1%
associate-+l+94.1%
Applied egg-rr94.1%
Taylor expanded in x around 0 61.9%
Taylor expanded in y around 0 5.1%
+-commutative5.1%
Simplified5.1%
Taylor expanded in x around 0 3.2%
neg-mul-13.2%
sub-neg3.2%
Simplified3.2%
(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 2024088
(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))))