
(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 (* (/ y (+ y x)) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * ((x / (y + (x + 1.0d0))) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 68.8%
*-commutative68.8%
associate-*l*68.8%
times-frac91.9%
+-commutative91.9%
+-commutative91.9%
associate-+r+91.9%
+-commutative91.9%
associate-+l+91.9%
Applied egg-rr91.9%
*-un-lft-identity91.9%
+-commutative91.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
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 (/ y (+ y x))))
(if (<= x -1.55e+103)
(* t_0 (/ 1.0 (+ y x)))
(if (<= x -7.6e-16)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(* t_0 (/ (/ x (+ y 1.0)) (+ y x)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -1.55e+103) {
tmp = t_0 * (1.0 / (y + x));
} else if (x <= -7.6e-16) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-1.55d+103)) then
tmp = t_0 * (1.0d0 / (y + x))
else if (x <= (-7.6d-16)) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = t_0 * ((x / (y + 1.0d0)) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -1.55e+103) {
tmp = t_0 * (1.0 / (y + x));
} else if (x <= -7.6e-16) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -1.55e+103: tmp = t_0 * (1.0 / (y + x)) elif x <= -7.6e-16: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = t_0 * ((x / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -1.55e+103) tmp = Float64(t_0 * Float64(1.0 / Float64(y + x))); elseif (x <= -7.6e-16) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(t_0 * Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -1.55e+103)
tmp = t_0 * (1.0 / (y + x));
elseif (x <= -7.6e-16)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.55e+103], N[(t$95$0 * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.6e-16], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+103}:\\
\;\;\;\;t\_0 \cdot \frac{1}{y + x}\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.5500000000000001e103Initial program 50.8%
*-commutative50.8%
associate-*l*50.8%
times-frac72.7%
+-commutative72.7%
+-commutative72.7%
associate-+r+72.7%
+-commutative72.7%
associate-+l+72.7%
Applied egg-rr72.7%
*-un-lft-identity72.7%
+-commutative72.7%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 78.8%
if -1.5500000000000001e103 < x < -7.60000000000000024e-16Initial program 87.6%
associate-/l*91.8%
associate-+l+91.8%
Simplified91.8%
if -7.60000000000000024e-16 < x Initial program 70.5%
*-commutative70.5%
associate-*l*70.5%
times-frac95.9%
+-commutative95.9%
+-commutative95.9%
associate-+r+95.9%
+-commutative95.9%
associate-+l+95.9%
Applied egg-rr95.9%
*-un-lft-identity95.9%
+-commutative95.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 83.7%
+-commutative83.7%
Simplified83.7%
Final simplification83.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y -1.8e+18)
(/ (/ y x) (+ x 1.0))
(if (<= y 6.2e+96)
(* (/ y (* (+ y x) (+ y (+ x 1.0)))) (/ x (+ y x)))
(/ (/ x (+ y 1.0)) (* (+ y x) (/ (+ y x) y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= -1.8e+18) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.2e+96) {
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (x / (y + x));
} else {
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.8d+18)) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 6.2d+96) then
tmp = (y / ((y + x) * (y + (x + 1.0d0)))) * (x / (y + x))
else
tmp = (x / (y + 1.0d0)) / ((y + x) * ((y + x) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= -1.8e+18) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.2e+96) {
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (x / (y + x));
} else {
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= -1.8e+18: tmp = (y / x) / (x + 1.0) elif y <= 6.2e+96: tmp = (y / ((y + x) * (y + (x + 1.0)))) * (x / (y + x)) else: tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= -1.8e+18) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 6.2e+96) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) * Float64(x / Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(Float64(y + x) * Float64(Float64(y + x) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= -1.8e+18)
tmp = (y / x) / (x + 1.0);
elseif (y <= 6.2e+96)
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (x / (y + x));
else
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, -1.8e+18], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e+96], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+96}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{\left(y + x\right) \cdot \frac{y + x}{y}}\\
\end{array}
\end{array}
if y < -1.8e18Initial program 64.9%
associate-/l*75.6%
associate-+l+75.6%
Simplified75.6%
Taylor expanded in y around 0 20.8%
associate-/r*29.5%
+-commutative29.5%
Simplified29.5%
if -1.8e18 < y < 6.1999999999999996e96Initial program 73.9%
associate-*l*73.9%
times-frac98.6%
+-commutative98.6%
+-commutative98.6%
associate-+r+98.6%
+-commutative98.6%
associate-+l+98.6%
Applied egg-rr98.6%
if 6.1999999999999996e96 < y Initial program 58.5%
*-commutative58.5%
associate-*l*58.5%
times-frac86.7%
+-commutative86.7%
+-commutative86.7%
associate-+r+86.7%
+-commutative86.7%
associate-+l+86.7%
Applied egg-rr86.7%
*-un-lft-identity86.7%
+-commutative86.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around 0 92.3%
+-commutative92.3%
Simplified92.3%
clear-num92.3%
+-commutative92.3%
frac-times96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
Final simplification81.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y -2e+25)
(/ (/ y x) (+ x 1.0))
(if (<= y 5.6e+146)
(* (/ y (+ y x)) (/ x (* (+ y x) (+ y (+ x 1.0)))))
(/ (/ x (+ y 1.0)) (* (+ y x) (/ (+ y x) y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= -2e+25) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 5.6e+146) {
tmp = (y / (y + x)) * (x / ((y + x) * (y + (x + 1.0))));
} else {
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2d+25)) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 5.6d+146) then
tmp = (y / (y + x)) * (x / ((y + x) * (y + (x + 1.0d0))))
else
tmp = (x / (y + 1.0d0)) / ((y + x) * ((y + x) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= -2e+25) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 5.6e+146) {
tmp = (y / (y + x)) * (x / ((y + x) * (y + (x + 1.0))));
} else {
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= -2e+25: tmp = (y / x) / (x + 1.0) elif y <= 5.6e+146: tmp = (y / (y + x)) * (x / ((y + x) * (y + (x + 1.0)))) else: tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= -2e+25) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 5.6e+146) tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(Float64(y + x) * Float64(Float64(y + x) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= -2e+25)
tmp = (y / x) / (x + 1.0);
elseif (y <= 5.6e+146)
tmp = (y / (y + x)) * (x / ((y + x) * (y + (x + 1.0))));
else
tmp = (x / (y + 1.0)) / ((y + x) * ((y + x) / y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, -2e+25], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+146], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+146}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{\left(y + x\right) \cdot \frac{y + x}{y}}\\
\end{array}
\end{array}
if y < -2.00000000000000018e25Initial program 63.8%
associate-/l*74.8%
associate-+l+74.8%
Simplified74.8%
Taylor expanded in y around 0 19.8%
associate-/r*28.8%
+-commutative28.8%
Simplified28.8%
if -2.00000000000000018e25 < y < 5.6000000000000002e146Initial program 72.7%
*-commutative72.7%
associate-*l*72.7%
times-frac98.6%
+-commutative98.6%
+-commutative98.6%
associate-+r+98.6%
+-commutative98.6%
associate-+l+98.6%
Applied egg-rr98.6%
if 5.6000000000000002e146 < y Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
times-frac83.9%
+-commutative83.9%
+-commutative83.9%
associate-+r+83.9%
+-commutative83.9%
associate-+l+83.9%
Applied egg-rr83.9%
*-un-lft-identity83.9%
+-commutative83.9%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 92.9%
+-commutative92.9%
Simplified92.9%
clear-num92.9%
+-commutative92.9%
frac-times95.2%
*-un-lft-identity95.2%
Applied egg-rr95.2%
Final simplification82.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= x -4.3e+155)
(* t_0 (/ 1.0 (+ y x)))
(if (<= x -3.5e-6)
(* (/ y x) (/ x (* (+ y x) (+ y (+ x 1.0)))))
(* t_0 (/ (/ x (+ y 1.0)) (+ y x)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -4.3e+155) {
tmp = t_0 * (1.0 / (y + x));
} else if (x <= -3.5e-6) {
tmp = (y / x) * (x / ((y + x) * (y + (x + 1.0))));
} else {
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (y + x)
if (x <= (-4.3d+155)) then
tmp = t_0 * (1.0d0 / (y + x))
else if (x <= (-3.5d-6)) then
tmp = (y / x) * (x / ((y + x) * (y + (x + 1.0d0))))
else
tmp = t_0 * ((x / (y + 1.0d0)) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (x <= -4.3e+155) {
tmp = t_0 * (1.0 / (y + x));
} else if (x <= -3.5e-6) {
tmp = (y / x) * (x / ((y + x) * (y + (x + 1.0))));
} else {
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if x <= -4.3e+155: tmp = t_0 * (1.0 / (y + x)) elif x <= -3.5e-6: tmp = (y / x) * (x / ((y + x) * (y + (x + 1.0)))) else: tmp = t_0 * ((x / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -4.3e+155) tmp = Float64(t_0 * Float64(1.0 / Float64(y + x))); elseif (x <= -3.5e-6) tmp = Float64(Float64(y / x) * Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))))); else tmp = Float64(t_0 * Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (x <= -4.3e+155)
tmp = t_0 * (1.0 / (y + x));
elseif (x <= -3.5e-6)
tmp = (y / x) * (x / ((y + x) * (y + (x + 1.0))));
else
tmp = t_0 * ((x / (y + 1.0)) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.3e+155], N[(t$95$0 * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.5e-6], N[(N[(y / x), $MachinePrecision] * N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{+155}:\\
\;\;\;\;t\_0 \cdot \frac{1}{y + x}\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -4.3000000000000002e155Initial program 52.3%
*-commutative52.3%
associate-*l*52.3%
times-frac71.0%
+-commutative71.0%
+-commutative71.0%
associate-+r+71.0%
+-commutative71.0%
associate-+l+71.0%
Applied egg-rr71.0%
*-un-lft-identity71.0%
+-commutative71.0%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 84.2%
if -4.3000000000000002e155 < x < -3.49999999999999995e-6Initial program 73.7%
*-commutative73.7%
associate-*l*73.7%
times-frac90.4%
+-commutative90.4%
+-commutative90.4%
associate-+r+90.4%
+-commutative90.4%
associate-+l+90.4%
Applied egg-rr90.4%
Taylor expanded in y around 0 77.9%
if -3.49999999999999995e-6 < x Initial program 71.0%
*-commutative71.0%
associate-*l*71.0%
times-frac95.9%
+-commutative95.9%
+-commutative95.9%
associate-+r+95.9%
+-commutative95.9%
associate-+l+95.9%
Applied egg-rr95.9%
*-un-lft-identity95.9%
+-commutative95.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
Simplified83.9%
Final simplification83.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.25e-150) (/ (/ y x) (+ x 1.0)) (if (<= y 3.8e+141) (/ x (* (+ y x) (+ y (+ x 1.0)))) (/ (/ x (+ y x)) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.25e-150) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3.8e+141) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.25d-150) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 3.8d+141) then
tmp = x / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / (y + x)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.25e-150) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3.8e+141) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.25e-150: tmp = (y / x) / (x + 1.0) elif y <= 3.8e+141: tmp = x / ((y + x) * (y + (x + 1.0))) else: tmp = (x / (y + x)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.25e-150) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 3.8e+141) tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(y + x)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.25e-150)
tmp = (y / x) / (x + 1.0);
elseif (y <= 3.8e+141)
tmp = x / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / (y + x)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.25e-150], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+141], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.25 \cdot 10^{-150}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y}\\
\end{array}
\end{array}
if y < 2.2500000000000001e-150Initial program 67.5%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 54.6%
associate-/r*58.0%
+-commutative58.0%
Simplified58.0%
if 2.2500000000000001e-150 < y < 3.79999999999999976e141Initial program 79.2%
*-commutative79.2%
associate-*l*79.2%
times-frac96.4%
+-commutative96.4%
+-commutative96.4%
associate-+r+96.4%
+-commutative96.4%
associate-+l+96.4%
Applied egg-rr96.4%
Taylor expanded in y around inf 67.8%
if 3.79999999999999976e141 < y Initial program 59.7%
*-commutative59.7%
associate-*l*59.7%
times-frac84.3%
+-commutative84.3%
+-commutative84.3%
associate-+r+84.3%
+-commutative84.3%
associate-+l+84.3%
Applied egg-rr84.3%
clear-num84.3%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 93.0%
Final simplification65.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 (<= y 1.85e-150)
(/ (/ y x) (+ x 1.0))
(if (<= y 5.6e+146) (/ x (* (+ y x) t_0)) (/ (/ x t_0) (+ y x))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.85e-150) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 5.6e+146) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / t_0) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 1.85d-150) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 5.6d+146) then
tmp = x / ((y + x) * t_0)
else
tmp = (x / t_0) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.85e-150) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 5.6e+146) {
tmp = x / ((y + x) * t_0);
} else {
tmp = (x / t_0) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 1.85e-150: tmp = (y / x) / (x + 1.0) elif y <= 5.6e+146: tmp = x / ((y + x) * t_0) else: tmp = (x / t_0) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 1.85e-150) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 5.6e+146) tmp = Float64(x / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / t_0) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 1.85e-150)
tmp = (y / x) / (x + 1.0);
elseif (y <= 5.6e+146)
tmp = x / ((y + x) * t_0);
else
tmp = (x / t_0) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.85e-150], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+146], N[(x / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 1.85 \cdot 10^{-150}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+146}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t\_0}}{y + x}\\
\end{array}
\end{array}
if y < 1.85e-150Initial program 67.5%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 54.6%
associate-/r*58.0%
+-commutative58.0%
Simplified58.0%
if 1.85e-150 < y < 5.6000000000000002e146Initial program 77.9%
*-commutative77.9%
associate-*l*77.9%
times-frac96.4%
+-commutative96.4%
+-commutative96.4%
associate-+r+96.4%
+-commutative96.4%
associate-+l+96.4%
Applied egg-rr96.4%
Taylor expanded in y around inf 68.4%
if 5.6000000000000002e146 < y Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
times-frac83.9%
+-commutative83.9%
+-commutative83.9%
associate-+r+83.9%
+-commutative83.9%
associate-+l+83.9%
Applied egg-rr83.9%
*-un-lft-identity83.9%
+-commutative83.9%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 92.9%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.45e-43) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y x)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.45e-43) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + x)) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.45d-43) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + x)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.45e-43) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + x)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.45e-43: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + x)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.45e-43) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.45e-43)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + x)) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.45e-43], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{-43}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\
\end{array}
\end{array}
if y < 1.4500000000000001e-43Initial program 70.6%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in y around 0 57.3%
associate-/r*60.2%
+-commutative60.2%
Simplified60.2%
if 1.4500000000000001e-43 < y Initial program 64.4%
*-commutative64.4%
associate-*l*64.4%
times-frac88.6%
+-commutative88.6%
+-commutative88.6%
associate-+r+88.6%
+-commutative88.6%
associate-+l+88.6%
Applied egg-rr88.6%
clear-num88.6%
associate-/r*99.8%
+-commutative99.8%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 80.2%
+-commutative80.2%
Simplified80.2%
Final simplification66.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4e-44) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) (+ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4e-44) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4d-44) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4e-44) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4e-44: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4e-44) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4e-44)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + 1.0)) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4e-44], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-44}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if y < 3.99999999999999981e-44Initial program 70.6%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in y around 0 57.3%
associate-/r*60.2%
+-commutative60.2%
Simplified60.2%
if 3.99999999999999981e-44 < y Initial program 64.4%
*-commutative64.4%
associate-*l*64.4%
times-frac88.6%
+-commutative88.6%
+-commutative88.6%
associate-+r+88.6%
+-commutative88.6%
associate-+l+88.6%
Applied egg-rr88.6%
clear-num88.6%
associate-/r*99.8%
+-commutative99.8%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 80.2%
+-commutative80.2%
Simplified80.2%
div-inv80.2%
frac-times76.6%
*-rgt-identity76.6%
div-inv76.6%
Applied egg-rr76.6%
associate-*r/76.6%
*-rgt-identity76.6%
associate-/l/80.2%
Simplified80.2%
Final simplification66.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2e-157) (/ y x) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2e-157) {
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 <= 2d-157) 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 <= 2e-157) {
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 <= 2e-157: 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 <= 2e-157) 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 <= 2e-157)
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, 2e-157], 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 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.99999999999999989e-157Initial program 67.9%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in y around 0 54.9%
associate-/r*58.3%
+-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 34.0%
if 1.99999999999999989e-157 < y Initial program 70.1%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in x around 0 63.9%
+-commutative63.9%
Simplified63.9%
Final simplification45.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8.2e-123) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.2e-123) {
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.2d-123)) 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.2e-123) {
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.2e-123: 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.2e-123) 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 <= -8.2e-123)
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.2e-123], 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 -8.2 \cdot 10^{-123}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -8.2000000000000001e-123Initial program 68.1%
associate-/l*81.7%
associate-+l+81.7%
Simplified81.7%
Taylor expanded in y around 0 59.9%
if -8.2000000000000001e-123 < x Initial program 69.1%
associate-/l*79.8%
associate-+l+79.8%
Simplified79.8%
Taylor expanded in x around 0 59.4%
+-commutative59.4%
Simplified59.4%
Final simplification59.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.5e-36) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.5e-36) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.5d-36) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.5e-36) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.5e-36: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.5e-36) 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 (y <= 1.5e-36)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.5e-36], 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}\;y \leq 1.5 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.5000000000000001e-36Initial program 70.9%
associate-/l*80.9%
associate-+l+80.9%
Simplified80.9%
Taylor expanded in y around 0 57.2%
if 1.5000000000000001e-36 < y Initial program 63.5%
associate-/l*79.3%
associate-+l+79.3%
Simplified79.3%
Taylor expanded in x around 0 75.7%
associate-/r*75.8%
+-commutative75.8%
Simplified75.8%
associate-*r/80.7%
div-inv80.7%
Applied egg-rr80.7%
Final simplification63.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 6e-39) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 6e-39) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 6d-39) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 6e-39) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 6e-39: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 6e-39) 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 (y <= 6e-39)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 6e-39], 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}\;y \leq 6 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 6.00000000000000055e-39Initial program 70.9%
associate-/l*80.9%
associate-+l+80.9%
Simplified80.9%
Taylor expanded in y around 0 57.2%
associate-/r*60.1%
+-commutative60.1%
Simplified60.1%
if 6.00000000000000055e-39 < y Initial program 63.5%
associate-/l*79.3%
associate-+l+79.3%
Simplified79.3%
Taylor expanded in x around 0 75.7%
associate-/r*75.8%
+-commutative75.8%
Simplified75.8%
associate-*r/80.7%
div-inv80.7%
Applied egg-rr80.7%
Final simplification66.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.3e-123) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.3e-123) {
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 <= (-2.3d-123)) 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 <= -2.3e-123) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.3e-123: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.3e-123) 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 <= -2.3e-123)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.3e-123], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-123}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2.29999999999999987e-123Initial program 68.4%
associate-/l*81.9%
associate-+l+81.9%
Simplified81.9%
Taylor expanded in y around 0 59.2%
associate-/r*64.3%
+-commutative64.3%
Simplified64.3%
Taylor expanded in x around 0 27.6%
if -2.29999999999999987e-123 < x Initial program 68.9%
associate-/l*79.7%
associate-+l+79.7%
Simplified79.7%
Taylor expanded in x around 0 59.2%
+-commutative59.2%
Simplified59.2%
Taylor expanded in y around 0 41.8%
Final simplification36.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 68.8%
associate-/l*80.5%
associate-+l+80.5%
Simplified80.5%
Taylor expanded in x around 0 49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around 0 30.8%
Final simplification30.8%
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 68.8%
*-commutative68.8%
associate-*l*68.8%
times-frac91.9%
+-commutative91.9%
+-commutative91.9%
associate-+r+91.9%
+-commutative91.9%
associate-+l+91.9%
Applied egg-rr91.9%
clear-num91.8%
associate-/r*99.7%
+-commutative99.7%
frac-times99.6%
*-un-lft-identity99.6%
+-commutative99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 53.0%
+-commutative53.0%
Simplified53.0%
Taylor expanded in y around 0 3.4%
Final simplification3.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 2024069
(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))))