
(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 16 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 (* (/ x (+ x y)) (/ (/ y (+ y (+ x 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (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 / (x + y)) * ((y / (y + (x + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 70.3%
associate-*l*70.3%
times-frac92.5%
+-commutative92.5%
+-commutative92.5%
associate-+r+92.5%
+-commutative92.5%
associate-+l+92.5%
Applied egg-rr92.5%
*-un-lft-identity92.5%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= y -2.2e-261)
(/ (/ y (+ y (+ x 1.0))) (+ x y))
(if (<= y 7.8e-207)
(* t_0 (/ (/ y (+ y 1.0)) (+ x y)))
(if (<= y 8.6e+29)
(* x (/ y (* (* (+ x y) (+ x y)) (+ x (+ y 1.0)))))
(/ t_0 (* (+ x y) (/ (+ y 1.0) y))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= -2.2e-261) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else if (y <= 7.8e-207) {
tmp = t_0 * ((y / (y + 1.0)) / (x + y));
} else if (y <= 8.6e+29) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = t_0 / ((x + y) * ((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 = x / (x + y)
if (y <= (-2.2d-261)) then
tmp = (y / (y + (x + 1.0d0))) / (x + y)
else if (y <= 7.8d-207) then
tmp = t_0 * ((y / (y + 1.0d0)) / (x + y))
else if (y <= 8.6d+29) then
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0d0))))
else
tmp = t_0 / ((x + y) * ((y + 1.0d0) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= -2.2e-261) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else if (y <= 7.8e-207) {
tmp = t_0 * ((y / (y + 1.0)) / (x + y));
} else if (y <= 8.6e+29) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = t_0 / ((x + y) * ((y + 1.0) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= -2.2e-261: tmp = (y / (y + (x + 1.0))) / (x + y) elif y <= 7.8e-207: tmp = t_0 * ((y / (y + 1.0)) / (x + y)) elif y <= 8.6e+29: tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0)))) else: tmp = t_0 / ((x + y) * ((y + 1.0) / y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (y <= -2.2e-261) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)); elseif (y <= 7.8e-207) tmp = Float64(t_0 * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y))); elseif (y <= 8.6e+29) tmp = Float64(x * Float64(y / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(t_0 / Float64(Float64(x + y) * Float64(Float64(y + 1.0) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
tmp = 0.0;
if (y <= -2.2e-261)
tmp = (y / (y + (x + 1.0))) / (x + y);
elseif (y <= 7.8e-207)
tmp = t_0 * ((y / (y + 1.0)) / (x + y));
elseif (y <= 8.6e+29)
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
else
tmp = t_0 / ((x + y) * ((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[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e-261], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e-207], N[(t$95$0 * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.6e+29], N[(x * N[(y / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(x + y), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-261}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-207}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y}{y + 1}}{x + y}\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(x + y\right) \cdot \frac{y + 1}{y}}\\
\end{array}
\end{array}
if y < -2.2000000000000002e-261Initial program 69.0%
associate-*l*69.0%
times-frac90.6%
+-commutative90.6%
+-commutative90.6%
associate-+r+90.6%
+-commutative90.6%
associate-+l+90.6%
Applied egg-rr90.6%
*-un-lft-identity90.6%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around inf 48.1%
if -2.2000000000000002e-261 < y < 7.80000000000000042e-207Initial program 60.2%
associate-*l*60.2%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
*-un-lft-identity99.9%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around 0 94.8%
+-commutative94.8%
Simplified94.8%
if 7.80000000000000042e-207 < y < 8.6000000000000006e29Initial program 84.9%
associate-/l*90.0%
associate-+l+90.0%
Simplified90.0%
if 8.6000000000000006e29 < y Initial program 66.1%
associate-*l*66.1%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
*-un-lft-identity84.8%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
+-commutative99.8%
div-inv99.8%
clear-num99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 88.5%
+-commutative88.5%
Simplified88.5%
Final simplification72.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))) (t_1 (+ y (+ x 1.0))))
(if (<= y -4e+124)
(/ (/ y t_1) (+ x y))
(if (<= y 6.2e+74) (* t_0 (/ y (* (+ x y) t_1))) (/ t_0 (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double t_1 = y + (x + 1.0);
double tmp;
if (y <= -4e+124) {
tmp = (y / t_1) / (x + y);
} else if (y <= 6.2e+74) {
tmp = t_0 * (y / ((x + y) * t_1));
} else {
tmp = t_0 / (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) :: t_1
real(8) :: tmp
t_0 = x / (x + y)
t_1 = y + (x + 1.0d0)
if (y <= (-4d+124)) then
tmp = (y / t_1) / (x + y)
else if (y <= 6.2d+74) then
tmp = t_0 * (y / ((x + y) * t_1))
else
tmp = t_0 / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (x + y);
double t_1 = y + (x + 1.0);
double tmp;
if (y <= -4e+124) {
tmp = (y / t_1) / (x + y);
} else if (y <= 6.2e+74) {
tmp = t_0 * (y / ((x + y) * t_1));
} else {
tmp = t_0 / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) t_1 = y + (x + 1.0) tmp = 0 if y <= -4e+124: tmp = (y / t_1) / (x + y) elif y <= 6.2e+74: tmp = t_0 * (y / ((x + y) * t_1)) else: tmp = t_0 / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) t_1 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= -4e+124) tmp = Float64(Float64(y / t_1) / Float64(x + y)); elseif (y <= 6.2e+74) tmp = Float64(t_0 * Float64(y / Float64(Float64(x + y) * t_1))); else tmp = Float64(t_0 / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (x + y);
t_1 = y + (x + 1.0);
tmp = 0.0;
if (y <= -4e+124)
tmp = (y / t_1) / (x + y);
elseif (y <= 6.2e+74)
tmp = t_0 * (y / ((x + y) * t_1));
else
tmp = t_0 / (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[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e+124], N[(N[(y / t$95$1), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e+74], N[(t$95$0 * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
t_1 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{+124}:\\
\;\;\;\;\frac{\frac{y}{t\_1}}{x + y}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+74}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(x + y\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{y + 1}\\
\end{array}
\end{array}
if y < -3.99999999999999979e124Initial program 53.0%
associate-*l*53.0%
times-frac81.0%
+-commutative81.0%
+-commutative81.0%
associate-+r+81.0%
+-commutative81.0%
associate-+l+81.0%
Applied egg-rr81.0%
*-un-lft-identity81.0%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 27.3%
if -3.99999999999999979e124 < y < 6.20000000000000043e74Initial program 76.4%
associate-*l*76.4%
times-frac97.7%
+-commutative97.7%
+-commutative97.7%
associate-+r+97.7%
+-commutative97.7%
associate-+l+97.7%
Applied egg-rr97.7%
if 6.20000000000000043e74 < y Initial program 63.0%
associate-*l*63.0%
times-frac83.6%
+-commutative83.6%
+-commutative83.6%
associate-+r+83.6%
+-commutative83.6%
associate-+l+83.6%
Applied egg-rr83.6%
*-un-lft-identity83.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
+-commutative99.9%
div-inv99.9%
clear-num99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 91.6%
+-commutative91.6%
Simplified91.6%
Final simplification85.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 (<= y -6e-133)
(/ (/ y t_0) (+ x y))
(if (<= y 6.2e+74)
(* x (/ (/ y (* (+ x y) t_0)) (+ x y)))
(/ (/ 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 (y <= -6e-133) {
tmp = (y / t_0) / (x + y);
} else if (y <= 6.2e+74) {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
} 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 (y <= (-6d-133)) then
tmp = (y / t_0) / (x + y)
else if (y <= 6.2d+74) then
tmp = x * ((y / ((x + y) * t_0)) / (x + y))
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 (y <= -6e-133) {
tmp = (y / t_0) / (x + y);
} else if (y <= 6.2e+74) {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
} 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 y <= -6e-133: tmp = (y / t_0) / (x + y) elif y <= 6.2e+74: tmp = x * ((y / ((x + y) * t_0)) / (x + y)) 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 (y <= -6e-133) tmp = Float64(Float64(y / t_0) / Float64(x + y)); elseif (y <= 6.2e+74) tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + y))); 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 (y <= -6e-133)
tmp = (y / t_0) / (x + y);
elseif (y <= 6.2e+74)
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
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[y, -6e-133], N[(N[(y / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e+74], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq -6 \cdot 10^{-133}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{x + y}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+74}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < -6.00000000000000038e-133Initial program 69.8%
associate-*l*69.8%
times-frac88.1%
+-commutative88.1%
+-commutative88.1%
associate-+r+88.1%
+-commutative88.1%
associate-+l+88.1%
Applied egg-rr88.1%
*-un-lft-identity88.1%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around inf 39.6%
if -6.00000000000000038e-133 < y < 6.20000000000000043e74Initial program 73.4%
associate-/l*84.1%
associate-+l+84.1%
Simplified84.1%
*-un-lft-identity84.1%
associate-+r+84.1%
associate-*l*84.2%
times-frac96.5%
+-commutative96.5%
+-commutative96.5%
associate-+r+96.5%
+-commutative96.5%
associate-+l+96.5%
Applied egg-rr96.5%
associate-*l/96.7%
*-lft-identity96.7%
+-commutative96.7%
Simplified96.7%
if 6.20000000000000043e74 < y Initial program 63.0%
associate-*l*63.0%
times-frac83.6%
+-commutative83.6%
+-commutative83.6%
associate-+r+83.6%
+-commutative83.6%
associate-+l+83.6%
Applied egg-rr83.6%
*-un-lft-identity83.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
+-commutative99.9%
div-inv99.9%
clear-num99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 91.6%
+-commutative91.6%
Simplified91.6%
Final simplification76.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -9.2e-151)
(/ (/ y (+ x y)) (+ x 1.0))
(if (<= x -1.55e-183)
(/ x y)
(if (<= x -1.05e-188)
(* (/ y x) (- 1.0 (/ y x)))
(/ (/ x (+ y 1.0)) y)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.2e-151) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (x <= -1.55e-183) {
tmp = x / y;
} else if (x <= -1.05e-188) {
tmp = (y / x) * (1.0 - (y / x));
} 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 <= (-9.2d-151)) then
tmp = (y / (x + y)) / (x + 1.0d0)
else if (x <= (-1.55d-183)) then
tmp = x / y
else if (x <= (-1.05d-188)) then
tmp = (y / x) * (1.0d0 - (y / x))
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 <= -9.2e-151) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (x <= -1.55e-183) {
tmp = x / y;
} else if (x <= -1.05e-188) {
tmp = (y / x) * (1.0 - (y / x));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.2e-151: tmp = (y / (x + y)) / (x + 1.0) elif x <= -1.55e-183: tmp = x / y elif x <= -1.05e-188: tmp = (y / x) * (1.0 - (y / x)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.2e-151) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0)); elseif (x <= -1.55e-183) tmp = Float64(x / y); elseif (x <= -1.05e-188) tmp = Float64(Float64(y / x) * Float64(1.0 - Float64(y / x))); 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 <= -9.2e-151)
tmp = (y / (x + y)) / (x + 1.0);
elseif (x <= -1.55e-183)
tmp = x / y;
elseif (x <= -1.05e-188)
tmp = (y / x) * (1.0 - (y / x));
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, -9.2e-151], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.55e-183], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.05e-188], N[(N[(y / x), $MachinePrecision] * N[(1.0 - N[(y / x), $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 -9.2 \cdot 10^{-151}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-183}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-188}:\\
\;\;\;\;\frac{y}{x} \cdot \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -9.19999999999999984e-151Initial program 66.6%
associate-*l*66.6%
times-frac88.3%
+-commutative88.3%
+-commutative88.3%
associate-+r+88.3%
+-commutative88.3%
associate-+l+88.3%
Applied egg-rr88.3%
clear-num88.3%
associate-/r*99.7%
frac-times98.0%
*-un-lft-identity98.0%
+-commutative98.0%
Applied egg-rr98.0%
Taylor expanded in y around 0 66.3%
+-commutative66.3%
Simplified66.3%
if -9.19999999999999984e-151 < x < -1.55e-183Initial program 99.6%
associate-/l*98.4%
associate-+l+98.4%
Simplified98.4%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 76.0%
if -1.55e-183 < x < -1.05e-188Initial program 0.0%
associate-*l*0.0%
times-frac100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 24.3%
clear-num24.3%
inv-pow24.3%
distribute-lft-in24.3%
*-rgt-identity24.3%
pow224.3%
Applied egg-rr24.3%
unpow-124.3%
*-lft-identity24.3%
unpow224.3%
distribute-rgt-in24.3%
associate-/l*24.3%
+-commutative24.3%
Simplified24.3%
Taylor expanded in x around 0 24.3%
Taylor expanded in x around inf 24.4%
mul-1-neg24.4%
unsub-neg24.4%
Simplified24.4%
if -1.05e-188 < x Initial program 72.4%
associate-/l*82.6%
associate-+l+82.6%
Simplified82.6%
Taylor expanded in x around 0 59.7%
+-commutative59.7%
Simplified59.7%
*-un-lft-identity59.7%
times-frac60.6%
Applied egg-rr60.6%
associate-*l/60.6%
*-lft-identity60.6%
Simplified60.6%
Final simplification62.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.8e+16) (/ (/ y (+ y (+ x 1.0))) (+ x y)) (* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.8e+16) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else {
tmp = (x / (x + y)) * ((y / (y + 1.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) :: tmp
if (x <= (-3.8d+16)) then
tmp = (y / (y + (x + 1.0d0))) / (x + y)
else
tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.8e+16) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.8e+16: tmp = (y / (y + (x + 1.0))) / (x + y) else: tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.8e+16) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / 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.8e+16)
tmp = (y / (y + (x + 1.0))) / (x + y);
else
tmp = (x / (x + y)) * ((y / (y + 1.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_] := If[LessEqual[x, -3.8e+16], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -3.8e16Initial program 59.9%
associate-*l*59.9%
times-frac81.4%
+-commutative81.4%
+-commutative81.4%
associate-+r+81.4%
+-commutative81.4%
associate-+l+81.4%
Applied egg-rr81.4%
*-un-lft-identity81.4%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 77.9%
if -3.8e16 < x Initial program 73.5%
associate-*l*73.5%
times-frac96.0%
+-commutative96.0%
+-commutative96.0%
associate-+r+96.0%
+-commutative96.0%
associate-+l+96.0%
Applied egg-rr96.0%
*-un-lft-identity96.0%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification83.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.02e-150) (/ (/ y x) (+ x 1.0)) (if (<= x -8.5e-246) (/ (/ x (+ y 1.0)) y) (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.02e-150) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -8.5e-246) {
tmp = (x / (y + 1.0)) / y;
} 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.02d-150)) then
tmp = (y / x) / (x + 1.0d0)
else if (x <= (-8.5d-246)) then
tmp = (x / (y + 1.0d0)) / y
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.02e-150) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -8.5e-246) {
tmp = (x / (y + 1.0)) / y;
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.02e-150: tmp = (y / x) / (x + 1.0) elif x <= -8.5e-246: tmp = (x / (y + 1.0)) / y 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.02e-150) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (x <= -8.5e-246) tmp = Float64(Float64(x / Float64(y + 1.0)) / y); 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.02e-150)
tmp = (y / x) / (x + 1.0);
elseif (x <= -8.5e-246)
tmp = (x / (y + 1.0)) / y;
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.02e-150], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-246], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $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.02 \cdot 10^{-150}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-246}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.0199999999999999e-150Initial program 66.6%
associate-/l*80.8%
associate-+l+80.8%
Simplified80.8%
Taylor expanded in y around 0 63.6%
associate-/r*66.2%
+-commutative66.2%
Simplified66.2%
if -1.0199999999999999e-150 < x < -8.4999999999999998e-246Initial program 83.2%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 84.7%
+-commutative84.7%
Simplified84.7%
*-un-lft-identity84.7%
times-frac84.5%
Applied egg-rr84.5%
associate-*l/84.8%
*-lft-identity84.8%
Simplified84.8%
if -8.4999999999999998e-246 < x Initial program 71.3%
associate-*l*71.3%
times-frac94.6%
+-commutative94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
associate-+l+94.6%
Applied egg-rr94.6%
*-un-lft-identity94.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
+-commutative99.8%
div-inv99.7%
clear-num99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 58.7%
+-commutative58.7%
Simplified58.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (or (<= x -8.2e-151) (and (not (<= x -1.75e-245)) (<= x -1.7e-245))) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245))) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-8.2d-151)) .or. (.not. (x <= (-1.75d-245))) .and. (x <= (-1.7d-245))) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245))) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if (x <= -8.2e-151) or (not (x <= -1.75e-245) and (x <= -1.7e-245)): tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245))) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if ((x <= -8.2e-151) || (~((x <= -1.75e-245)) && (x <= -1.7e-245)))
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[Or[LessEqual[x, -8.2e-151], And[N[Not[LessEqual[x, -1.75e-245]], $MachinePrecision], LessEqual[x, -1.7e-245]]], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-151} \lor \neg \left(x \leq -1.75 \cdot 10^{-245}\right) \land x \leq -1.7 \cdot 10^{-245}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -8.2000000000000002e-151 or -1.75000000000000008e-245 < x < -1.7e-245Initial program 65.9%
associate-/l*80.0%
associate-+l+80.0%
Simplified80.0%
Taylor expanded in y around 0 64.0%
associate-/r*66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in x around 0 33.1%
if -8.2000000000000002e-151 < x < -1.75000000000000008e-245 or -1.7e-245 < x Initial program 73.1%
associate-/l*83.0%
associate-+l+83.0%
Simplified83.0%
Taylor expanded in x around 0 60.8%
+-commutative60.8%
Simplified60.8%
Taylor expanded in y around 0 39.2%
Final simplification36.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.1e-141) (/ (/ y (+ y (+ x 1.0))) (+ x y)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.1e-141) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} 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 <= (-5.1d-141)) then
tmp = (y / (y + (x + 1.0d0))) / (x + y)
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 <= -5.1e-141) {
tmp = (y / (y + (x + 1.0))) / (x + y);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.1e-141: tmp = (y / (y + (x + 1.0))) / (x + y) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.1e-141) tmp = Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y)); 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 <= -5.1e-141)
tmp = (y / (y + (x + 1.0))) / (x + y);
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, -5.1e-141], N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $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 -5.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -5.09999999999999977e-141Initial program 66.9%
associate-*l*66.9%
times-frac88.1%
+-commutative88.1%
+-commutative88.1%
associate-+r+88.1%
+-commutative88.1%
associate-+l+88.1%
Applied egg-rr88.1%
*-un-lft-identity88.1%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around inf 67.0%
if -5.09999999999999977e-141 < x Initial program 72.3%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
Taylor expanded in x around 0 60.3%
+-commutative60.3%
Simplified60.3%
*-un-lft-identity60.3%
times-frac61.1%
Applied egg-rr61.1%
associate-*l/61.2%
*-lft-identity61.2%
Simplified61.2%
Final simplification63.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.15e-124) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.15e-124) {
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 (x <= (-1.15d-124)) 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 (x <= -1.15e-124) {
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 x <= -1.15e-124: 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 (x <= -1.15e-124) 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 (x <= -1.15e-124)
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[x, -1.15e-124], 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}\;x \leq -1.15 \cdot 10^{-124}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.15000000000000006e-124Initial program 67.6%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in y around 0 64.1%
associate-/r*67.0%
+-commutative67.0%
Simplified67.0%
if -1.15000000000000006e-124 < x Initial program 71.8%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
*-un-lft-identity59.3%
times-frac60.0%
Applied egg-rr60.0%
associate-*l/60.1%
*-lft-identity60.1%
Simplified60.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -5.4e-141) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.4e-141) {
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 (x <= (-5.4d-141)) 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 (x <= -5.4e-141) {
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 x <= -5.4e-141: 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 (x <= -5.4e-141) 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 (x <= -5.4e-141)
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[x, -5.4e-141], 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}\;x \leq -5.4 \cdot 10^{-141}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -5.4000000000000005e-141Initial program 66.9%
associate-/l*80.5%
associate-+l+80.5%
Simplified80.5%
Taylor expanded in y around 0 63.8%
if -5.4000000000000005e-141 < x Initial program 72.3%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
Taylor expanded in x around 0 60.3%
+-commutative60.3%
Simplified60.3%
*-un-lft-identity60.3%
times-frac61.1%
Applied egg-rr61.1%
associate-*l/61.2%
*-lft-identity61.2%
Simplified61.2%
Final simplification62.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.15e-124) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.15e-124) {
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 <= (-1.15d-124)) 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 <= -1.15e-124) {
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 <= -1.15e-124: 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 <= -1.15e-124) 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 <= -1.15e-124)
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, -1.15e-124], 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 -1.15 \cdot 10^{-124}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.15000000000000006e-124Initial program 67.6%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in y around 0 64.1%
if -1.15000000000000006e-124 < x Initial program 71.8%
associate-/l*83.4%
associate-+l+83.4%
Simplified83.4%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
Final simplification61.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.9e-156) (/ y x) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.9e-156) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.9d-156) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.9e-156) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.9e-156: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.9e-156) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.9e-156)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.9e-156], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9 \cdot 10^{-156}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 2.90000000000000021e-156Initial program 67.2%
associate-/l*80.5%
associate-+l+80.5%
Simplified80.5%
Taylor expanded in y around 0 54.9%
associate-/r*58.8%
+-commutative58.8%
Simplified58.8%
Taylor expanded in x around 0 35.9%
if 2.90000000000000021e-156 < y Initial program 75.2%
associate-/l*83.9%
associate-+l+83.9%
Simplified83.9%
Taylor expanded in x around 0 60.2%
+-commutative60.2%
Simplified60.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9e+34) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9e+34) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9d+34)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9e+34) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9e+34: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9e+34) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9e+34)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9e+34], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+34}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -9.0000000000000001e34Initial program 58.9%
associate-*l*58.9%
times-frac80.0%
+-commutative80.0%
+-commutative80.0%
associate-+r+80.0%
+-commutative80.0%
associate-+l+80.0%
Applied egg-rr80.0%
Taylor expanded in y around 0 73.1%
Taylor expanded in y around inf 6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 6.2%
if -9.0000000000000001e34 < x Initial program 73.6%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in y around 0 33.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 70.3%
associate-*l*70.3%
times-frac92.5%
+-commutative92.5%
+-commutative92.5%
associate-+r+92.5%
+-commutative92.5%
associate-+l+92.5%
Applied egg-rr92.5%
Taylor expanded in y around 0 47.4%
Taylor expanded in y around inf 4.7%
+-commutative4.7%
Simplified4.7%
Taylor expanded in x around inf 4.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
return 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 = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
return 1.0;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0
x, y = sort([x, y]) function code(x, y) return 1.0 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Initial program 70.3%
associate-*l*70.3%
times-frac92.5%
+-commutative92.5%
+-commutative92.5%
associate-+r+92.5%
+-commutative92.5%
associate-+l+92.5%
Applied egg-rr92.5%
*-un-lft-identity92.5%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
clear-num99.7%
un-div-inv99.8%
+-commutative99.8%
div-inv99.7%
clear-num99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in y around 0 3.4%
(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 2024107
(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))))