
(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 19 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)) (* (+ x y) (/ (+ x (+ y 1.0)) y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) / ((x + y) * ((x + (y + 1.0d0)) / y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(x + Float64(y + 1.0)) / y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / 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[(x + y), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{x + \left(y + 1\right)}{y}}
\end{array}
Initial program 70.3%
associate-*l*70.3%
+-commutative70.3%
+-commutative70.3%
+-commutative70.3%
associate-*l*70.3%
*-commutative70.3%
associate-*r/85.0%
*-commutative85.0%
distribute-rgt1-in66.3%
fma-def85.0%
+-commutative85.0%
+-commutative85.0%
cube-unmult85.0%
+-commutative85.0%
Simplified85.0%
associate-*r/70.3%
*-commutative70.3%
fma-udef54.9%
cube-mult54.9%
distribute-rgt1-in70.3%
*-commutative70.3%
+-commutative70.3%
associate-+r+70.3%
frac-times88.8%
*-commutative88.8%
clear-num88.7%
associate-/r*99.7%
frac-times99.2%
*-un-lft-identity99.2%
associate-+r+99.2%
+-commutative99.2%
associate-+l+99.2%
Applied egg-rr99.2%
Final simplification99.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 7.2e-305)
(/ (/ y x) (+ x 1.0))
(if (<= y 2.2e-146)
(/ (/ x (+ (+ x 1.0) (/ x y))) (+ x y))
(if (<= y 3e+151)
(* (/ y (* (+ x y) (+ x y))) (/ x (+ y 1.0)))
(/ (/ x (+ x y)) (+ y (+ x (+ x 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 7.2e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.2e-146) {
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
} else if (y <= 3e+151) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
} else {
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 7.2d-305) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 2.2d-146) then
tmp = (x / ((x + 1.0d0) + (x / y))) / (x + y)
else if (y <= 3d+151) then
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0d0))
else
tmp = (x / (x + y)) / (y + (x + (x + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 7.2e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.2e-146) {
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
} else if (y <= 3e+151) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
} else {
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 7.2e-305: tmp = (y / x) / (x + 1.0) elif y <= 2.2e-146: tmp = (x / ((x + 1.0) + (x / y))) / (x + y) elif y <= 3e+151: tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0)) else: tmp = (x / (x + y)) / (y + (x + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 7.2e-305) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 2.2e-146) tmp = Float64(Float64(x / Float64(Float64(x + 1.0) + Float64(x / y))) / Float64(x + y)); elseif (y <= 3e+151) tmp = Float64(Float64(y / Float64(Float64(x + y) * Float64(x + y))) * Float64(x / Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + Float64(x + Float64(x + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 7.2e-305)
tmp = (y / x) / (x + 1.0);
elseif (y <= 2.2e-146)
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
elseif (y <= 3e+151)
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
else
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 7.2e-305], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e-146], N[(N[(x / N[(N[(x + 1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+151], N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-305}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{x}{\left(x + 1\right) + \frac{x}{y}}}{x + y}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+151}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + \left(x + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 7.20000000000000007e-305Initial program 68.3%
times-frac89.3%
+-commutative89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.7%
associate-/r*51.0%
+-commutative51.0%
Simplified51.0%
if 7.20000000000000007e-305 < y < 2.2e-146Initial program 56.6%
associate-*l*56.6%
+-commutative56.6%
+-commutative56.6%
+-commutative56.6%
associate-*l*56.6%
*-commutative56.6%
associate-*r/77.6%
*-commutative77.6%
distribute-rgt1-in72.1%
fma-def77.6%
+-commutative77.6%
+-commutative77.6%
cube-unmult77.6%
+-commutative77.6%
Simplified77.6%
associate-*r/56.6%
*-commutative56.6%
fma-udef51.0%
cube-mult51.0%
distribute-rgt1-in56.6%
*-commutative56.6%
+-commutative56.6%
associate-+r+56.6%
frac-times77.7%
*-commutative77.7%
clear-num77.6%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 90.3%
Taylor expanded in y around 0 90.4%
associate-+r+90.4%
+-commutative90.4%
Simplified90.4%
expm1-log1p-u90.4%
expm1-udef46.4%
associate-/l/46.4%
+-commutative46.4%
Applied egg-rr46.4%
expm1-def97.9%
expm1-log1p97.9%
associate-/r*90.4%
+-commutative90.4%
Simplified90.4%
if 2.2e-146 < y < 2.9999999999999999e151Initial program 90.3%
associate-*l*90.3%
+-commutative90.3%
+-commutative90.3%
+-commutative90.3%
*-commutative90.3%
associate-*l*90.3%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around 0 85.2%
+-commutative85.2%
Simplified85.2%
if 2.9999999999999999e151 < y Initial program 55.2%
associate-*l*55.2%
+-commutative55.2%
+-commutative55.2%
+-commutative55.2%
associate-*l*55.2%
*-commutative55.2%
associate-*r/78.7%
*-commutative78.7%
distribute-rgt1-in78.3%
fma-def78.7%
+-commutative78.7%
+-commutative78.7%
cube-unmult78.7%
+-commutative78.7%
Simplified78.7%
associate-*r/55.2%
*-commutative55.2%
fma-udef55.2%
cube-mult55.2%
distribute-rgt1-in55.2%
*-commutative55.2%
+-commutative55.2%
associate-+r+55.2%
frac-times78.7%
*-commutative78.7%
clear-num78.7%
associate-/r*100.0%
frac-times97.8%
*-un-lft-identity97.8%
associate-+r+97.8%
+-commutative97.8%
associate-+l+97.8%
Applied egg-rr97.8%
Taylor expanded in y around -inf 85.0%
mul-1-neg85.0%
unsub-neg85.0%
neg-mul-185.0%
+-commutative85.0%
unsub-neg85.0%
distribute-lft-in85.0%
metadata-eval85.0%
neg-mul-185.0%
unsub-neg85.0%
Simplified85.0%
Final simplification69.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -6.9e+155)
(/ (/ y (+ x y)) (+ x (+ y (+ y 1.0))))
(if (<= x -1.16e-116)
(* (/ x (* (+ x y) (+ x y))) (/ y (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (* (+ x y) (/ (+ y 1.0) y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.9e+155) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else if (x <= -1.16e-116) {
tmp = (x / ((x + y) * (x + y))) * (y / (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((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) :: tmp
if (x <= (-6.9d+155)) then
tmp = (y / (x + y)) / (x + (y + (y + 1.0d0)))
else if (x <= (-1.16d-116)) then
tmp = (x / ((x + y) * (x + y))) * (y / (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0d0) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -6.9e+155) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else if (x <= -1.16e-116) {
tmp = (x / ((x + y) * (x + y))) * (y / (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.9e+155: tmp = (y / (x + y)) / (x + (y + (y + 1.0))) elif x <= -1.16e-116: tmp = (x / ((x + y) * (x + y))) * (y / (y + (x + 1.0))) else: tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -6.9e+155) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -1.16e-116) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / 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)
tmp = 0.0;
if (x <= -6.9e+155)
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
elseif (x <= -1.16e-116)
tmp = (x / ((x + y) * (x + y))) * (y / (y + (x + 1.0)));
else
tmp = (x / (x + y)) / ((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_] := If[LessEqual[x, -6.9e+155], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.16e-116], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / 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}
\mathbf{if}\;x \leq -6.9 \cdot 10^{+155}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-116}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{y}}\\
\end{array}
\end{array}
if x < -6.9000000000000004e155Initial program 74.3%
associate-*l*74.3%
+-commutative74.3%
+-commutative74.3%
+-commutative74.3%
associate-*l*74.3%
*-commutative74.3%
associate-*r/83.0%
*-commutative83.0%
distribute-rgt1-in0.6%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
cube-unmult83.0%
+-commutative83.0%
Simplified83.0%
associate-*r/74.3%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in74.3%
*-commutative74.3%
+-commutative74.3%
associate-+r+74.3%
frac-times83.0%
*-commutative83.0%
associate-/r*99.9%
clear-num99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 92.9%
mul-1-neg92.9%
unsub-neg92.9%
neg-mul-192.9%
+-commutative92.9%
unsub-neg92.9%
distribute-lft-in92.9%
metadata-eval92.9%
neg-mul-192.9%
unsub-neg92.9%
Simplified92.9%
if -6.9000000000000004e155 < x < -1.16e-116Initial program 72.9%
times-frac95.1%
+-commutative95.1%
associate-+l+95.1%
Simplified95.1%
if -1.16e-116 < x Initial program 68.7%
associate-*l*68.7%
+-commutative68.7%
+-commutative68.7%
+-commutative68.7%
associate-*l*68.7%
*-commutative68.7%
associate-*r/83.9%
*-commutative83.9%
distribute-rgt1-in73.0%
fma-def83.9%
+-commutative83.9%
+-commutative83.9%
cube-unmult83.9%
+-commutative83.9%
Simplified83.9%
associate-*r/68.7%
*-commutative68.7%
fma-udef61.6%
cube-mult61.5%
distribute-rgt1-in68.7%
*-commutative68.7%
+-commutative68.7%
associate-+r+68.7%
frac-times87.4%
*-commutative87.4%
clear-num87.4%
associate-/r*99.7%
frac-times99.0%
*-un-lft-identity99.0%
associate-+r+99.0%
+-commutative99.0%
associate-+l+99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 79.3%
Final simplification84.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -6.8e+155)
(/ (/ y (+ x y)) (+ x (+ y (+ y 1.0))))
(if (<= x -1.55e-63)
(* (/ y (* (+ x y) (+ x y))) (/ x (+ y (+ x 1.0))))
(/ (/ x (+ x y)) (* (+ x y) (/ (+ y 1.0) y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -6.8e+155) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else if (x <= -1.55e-63) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((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) :: tmp
if (x <= (-6.8d+155)) then
tmp = (y / (x + y)) / (x + (y + (y + 1.0d0)))
else if (x <= (-1.55d-63)) then
tmp = (y / ((x + y) * (x + y))) * (x / (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0d0) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -6.8e+155) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else if (x <= -1.55e-63) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -6.8e+155: tmp = (y / (x + y)) / (x + (y + (y + 1.0))) elif x <= -1.55e-63: tmp = (y / ((x + y) * (x + y))) * (x / (y + (x + 1.0))) else: tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -6.8e+155) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + Float64(y + Float64(y + 1.0)))); elseif (x <= -1.55e-63) tmp = Float64(Float64(y / Float64(Float64(x + y) * Float64(x + y))) * Float64(x / Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / 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)
tmp = 0.0;
if (x <= -6.8e+155)
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
elseif (x <= -1.55e-63)
tmp = (y / ((x + y) * (x + y))) * (x / (y + (x + 1.0)));
else
tmp = (x / (x + y)) / ((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_] := If[LessEqual[x, -6.8e+155], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.55e-63], N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / 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}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+155}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{y + \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{y}}\\
\end{array}
\end{array}
if x < -6.8000000000000002e155Initial program 74.3%
associate-*l*74.3%
+-commutative74.3%
+-commutative74.3%
+-commutative74.3%
associate-*l*74.3%
*-commutative74.3%
associate-*r/83.0%
*-commutative83.0%
distribute-rgt1-in0.6%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
cube-unmult83.0%
+-commutative83.0%
Simplified83.0%
associate-*r/74.3%
fma-udef0.0%
cube-mult0.0%
distribute-rgt1-in74.3%
*-commutative74.3%
+-commutative74.3%
associate-+r+74.3%
frac-times83.0%
*-commutative83.0%
associate-/r*99.9%
clear-num99.9%
frac-times99.9%
*-un-lft-identity99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in x around -inf 92.9%
mul-1-neg92.9%
unsub-neg92.9%
neg-mul-192.9%
+-commutative92.9%
unsub-neg92.9%
distribute-lft-in92.9%
metadata-eval92.9%
neg-mul-192.9%
unsub-neg92.9%
Simplified92.9%
if -6.8000000000000002e155 < x < -1.54999999999999992e-63Initial program 73.6%
associate-*l*73.6%
+-commutative73.6%
+-commutative73.6%
+-commutative73.6%
*-commutative73.6%
associate-*l*73.6%
times-frac93.9%
+-commutative93.9%
+-commutative93.9%
associate-+l+93.9%
Simplified93.9%
if -1.54999999999999992e-63 < x Initial program 68.8%
associate-*l*68.8%
+-commutative68.8%
+-commutative68.8%
+-commutative68.8%
associate-*l*68.8%
*-commutative68.8%
associate-*r/85.0%
*-commutative85.0%
distribute-rgt1-in74.4%
fma-def85.0%
+-commutative85.0%
+-commutative85.0%
cube-unmult85.0%
+-commutative85.0%
Simplified85.0%
associate-*r/68.9%
*-commutative68.9%
fma-udef61.6%
cube-mult61.6%
distribute-rgt1-in68.8%
*-commutative68.8%
+-commutative68.8%
associate-+r+68.8%
frac-times88.3%
*-commutative88.3%
clear-num88.3%
associate-/r*99.7%
frac-times99.0%
*-un-lft-identity99.0%
associate-+r+99.0%
+-commutative99.0%
associate-+l+99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 80.7%
Final simplification84.4%
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 3.75e-305)
(/ (/ y x) (+ x 1.0))
(if (<= y 7.4e-25) (/ t_0 (+ (+ x 1.0) (/ x y))) (/ t_0 (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 3.75e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7.4e-25) {
tmp = t_0 / ((x + 1.0) + (x / y));
} 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) :: tmp
t_0 = x / (x + y)
if (y <= 3.75d-305) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 7.4d-25) then
tmp = t_0 / ((x + 1.0d0) + (x / y))
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 tmp;
if (y <= 3.75e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 7.4e-25) {
tmp = t_0 / ((x + 1.0) + (x / y));
} else {
tmp = t_0 / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= 3.75e-305: tmp = (y / x) / (x + 1.0) elif y <= 7.4e-25: tmp = t_0 / ((x + 1.0) + (x / y)) 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)) tmp = 0.0 if (y <= 3.75e-305) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 7.4e-25) tmp = Float64(t_0 / Float64(Float64(x + 1.0) + Float64(x / y))); 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);
tmp = 0.0;
if (y <= 3.75e-305)
tmp = (y / x) / (x + 1.0);
elseif (y <= 7.4e-25)
tmp = t_0 / ((x + 1.0) + (x / y));
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]}, If[LessEqual[y, 3.75e-305], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.4e-25], N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] + N[(x / y), $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}\\
\mathbf{if}\;y \leq 3.75 \cdot 10^{-305}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-25}:\\
\;\;\;\;\frac{t_0}{\left(x + 1\right) + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{y + 1}\\
\end{array}
\end{array}
if y < 3.7500000000000001e-305Initial program 68.3%
times-frac89.3%
+-commutative89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.7%
associate-/r*51.0%
+-commutative51.0%
Simplified51.0%
if 3.7500000000000001e-305 < y < 7.40000000000000017e-25Initial program 74.3%
associate-*l*74.3%
+-commutative74.3%
+-commutative74.3%
+-commutative74.3%
associate-*l*74.3%
*-commutative74.3%
associate-*r/87.5%
*-commutative87.5%
distribute-rgt1-in75.2%
fma-def87.5%
+-commutative87.5%
+-commutative87.5%
cube-unmult87.5%
+-commutative87.5%
Simplified87.5%
associate-*r/74.3%
*-commutative74.3%
fma-udef62.0%
cube-mult62.0%
distribute-rgt1-in74.3%
*-commutative74.3%
+-commutative74.3%
associate-+r+74.3%
frac-times87.5%
*-commutative87.5%
clear-num87.4%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 78.8%
Taylor expanded in y around 0 78.8%
associate-+r+78.8%
+-commutative78.8%
Simplified78.8%
if 7.40000000000000017e-25 < y Initial program 70.1%
associate-*l*70.1%
+-commutative70.1%
+-commutative70.1%
+-commutative70.1%
associate-*l*70.1%
*-commutative70.1%
associate-*r/80.8%
*-commutative80.8%
distribute-rgt1-in77.7%
fma-def80.8%
+-commutative80.8%
+-commutative80.8%
cube-unmult80.8%
+-commutative80.8%
Simplified80.8%
associate-*r/70.1%
*-commutative70.1%
fma-udef67.1%
cube-mult67.1%
distribute-rgt1-in70.1%
*-commutative70.1%
+-commutative70.1%
associate-+r+70.1%
frac-times89.1%
*-commutative89.1%
clear-num89.1%
associate-/r*99.8%
frac-times98.7%
*-un-lft-identity98.7%
associate-+r+98.7%
+-commutative98.7%
associate-+l+98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 75.0%
Final simplification64.3%
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 7.2e-305)
(/ (/ y x) (+ x 1.0))
(if (<= y 8.2e-12)
(/ t_0 (+ (+ x 1.0) (/ x y)))
(/ t_0 (+ y (+ x (+ x 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 7.2e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 8.2e-12) {
tmp = t_0 / ((x + 1.0) + (x / y));
} else {
tmp = t_0 / (y + (x + (x + 1.0)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (x + y)
if (y <= 7.2d-305) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 8.2d-12) then
tmp = t_0 / ((x + 1.0d0) + (x / y))
else
tmp = t_0 / (y + (x + (x + 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 tmp;
if (y <= 7.2e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 8.2e-12) {
tmp = t_0 / ((x + 1.0) + (x / y));
} else {
tmp = t_0 / (y + (x + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= 7.2e-305: tmp = (y / x) / (x + 1.0) elif y <= 8.2e-12: tmp = t_0 / ((x + 1.0) + (x / y)) else: tmp = t_0 / (y + (x + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (y <= 7.2e-305) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 8.2e-12) tmp = Float64(t_0 / Float64(Float64(x + 1.0) + Float64(x / y))); else tmp = Float64(t_0 / Float64(y + Float64(x + Float64(x + 1.0)))); 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 <= 7.2e-305)
tmp = (y / x) / (x + 1.0);
elseif (y <= 8.2e-12)
tmp = t_0 / ((x + 1.0) + (x / y));
else
tmp = t_0 / (y + (x + (x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 7.2e-305], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-12], N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $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 7.2 \cdot 10^{-305}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{t_0}{\left(x + 1\right) + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{y + \left(x + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 7.20000000000000007e-305Initial program 68.3%
times-frac89.3%
+-commutative89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.7%
associate-/r*51.0%
+-commutative51.0%
Simplified51.0%
if 7.20000000000000007e-305 < y < 8.19999999999999979e-12Initial program 75.4%
associate-*l*75.4%
+-commutative75.4%
+-commutative75.4%
+-commutative75.4%
associate-*l*75.4%
*-commutative75.4%
associate-*r/88.0%
*-commutative88.0%
distribute-rgt1-in74.8%
fma-def88.0%
+-commutative88.0%
+-commutative88.0%
cube-unmult88.0%
+-commutative88.0%
Simplified88.0%
associate-*r/75.4%
*-commutative75.4%
fma-udef62.2%
cube-mult62.2%
distribute-rgt1-in75.4%
*-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
frac-times88.0%
*-commutative88.0%
clear-num87.9%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 78.3%
Taylor expanded in y around 0 78.4%
associate-+r+78.4%
+-commutative78.4%
Simplified78.4%
if 8.19999999999999979e-12 < y Initial program 68.7%
associate-*l*68.7%
+-commutative68.7%
+-commutative68.7%
+-commutative68.7%
associate-*l*68.7%
*-commutative68.7%
associate-*r/80.0%
*-commutative80.0%
distribute-rgt1-in78.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/68.7%
*-commutative68.7%
fma-udef67.1%
cube-mult67.1%
distribute-rgt1-in68.7%
*-commutative68.7%
+-commutative68.7%
associate-+r+68.7%
frac-times88.6%
*-commutative88.6%
clear-num88.6%
associate-/r*99.8%
frac-times98.7%
*-un-lft-identity98.7%
associate-+r+98.7%
+-commutative98.7%
associate-+l+98.7%
Applied egg-rr98.7%
Taylor expanded in y around -inf 77.4%
mul-1-neg77.4%
unsub-neg77.4%
neg-mul-177.4%
+-commutative77.4%
unsub-neg77.4%
distribute-lft-in77.4%
metadata-eval77.4%
neg-mul-177.4%
unsub-neg77.4%
Simplified77.4%
Final simplification64.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 4.3e-305)
(/ (/ y x) (+ x 1.0))
(if (<= y 1.3e-11)
(/ (/ x (+ (+ x 1.0) (/ x y))) (+ x y))
(/ (/ x (+ x y)) (+ y (+ x (+ x 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.3e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.3e-11) {
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
} else {
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 4.3d-305) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 1.3d-11) then
tmp = (x / ((x + 1.0d0) + (x / y))) / (x + y)
else
tmp = (x / (x + y)) / (y + (x + (x + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 4.3e-305) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.3e-11) {
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
} else {
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 4.3e-305: tmp = (y / x) / (x + 1.0) elif y <= 1.3e-11: tmp = (x / ((x + 1.0) + (x / y))) / (x + y) else: tmp = (x / (x + y)) / (y + (x + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 4.3e-305) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 1.3e-11) tmp = Float64(Float64(x / Float64(Float64(x + 1.0) + Float64(x / y))) / Float64(x + y)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + Float64(x + Float64(x + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.3e-305)
tmp = (y / x) / (x + 1.0);
elseif (y <= 1.3e-11)
tmp = (x / ((x + 1.0) + (x / y))) / (x + y);
else
tmp = (x / (x + y)) / (y + (x + (x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 4.3e-305], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-11], N[(N[(x / N[(N[(x + 1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{-305}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{x}{\left(x + 1\right) + \frac{x}{y}}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + \left(x + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 4.3000000000000002e-305Initial program 68.3%
times-frac89.3%
+-commutative89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.7%
associate-/r*51.0%
+-commutative51.0%
Simplified51.0%
if 4.3000000000000002e-305 < y < 1.3e-11Initial program 75.4%
associate-*l*75.4%
+-commutative75.4%
+-commutative75.4%
+-commutative75.4%
associate-*l*75.4%
*-commutative75.4%
associate-*r/88.0%
*-commutative88.0%
distribute-rgt1-in74.8%
fma-def88.0%
+-commutative88.0%
+-commutative88.0%
cube-unmult88.0%
+-commutative88.0%
Simplified88.0%
associate-*r/75.4%
*-commutative75.4%
fma-udef62.2%
cube-mult62.2%
distribute-rgt1-in75.4%
*-commutative75.4%
+-commutative75.4%
associate-+r+75.4%
frac-times88.0%
*-commutative88.0%
clear-num87.9%
associate-/r*99.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 78.3%
Taylor expanded in y around 0 78.4%
associate-+r+78.4%
+-commutative78.4%
Simplified78.4%
expm1-log1p-u78.4%
expm1-udef49.5%
associate-/l/49.5%
+-commutative49.5%
Applied egg-rr49.5%
expm1-def93.3%
expm1-log1p93.3%
associate-/r*78.4%
+-commutative78.4%
Simplified78.4%
if 1.3e-11 < y Initial program 68.7%
associate-*l*68.7%
+-commutative68.7%
+-commutative68.7%
+-commutative68.7%
associate-*l*68.7%
*-commutative68.7%
associate-*r/80.0%
*-commutative80.0%
distribute-rgt1-in78.2%
fma-def80.0%
+-commutative80.0%
+-commutative80.0%
cube-unmult80.0%
+-commutative80.0%
Simplified80.0%
associate-*r/68.7%
*-commutative68.7%
fma-udef67.1%
cube-mult67.1%
distribute-rgt1-in68.7%
*-commutative68.7%
+-commutative68.7%
associate-+r+68.7%
frac-times88.6%
*-commutative88.6%
clear-num88.6%
associate-/r*99.8%
frac-times98.7%
*-un-lft-identity98.7%
associate-+r+98.7%
+-commutative98.7%
associate-+l+98.7%
Applied egg-rr98.7%
Taylor expanded in y around -inf 77.4%
mul-1-neg77.4%
unsub-neg77.4%
neg-mul-177.4%
+-commutative77.4%
unsub-neg77.4%
distribute-lft-in77.4%
metadata-eval77.4%
neg-mul-177.4%
unsub-neg77.4%
Simplified77.4%
Final simplification64.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.25e-6) (/ (/ y (+ x y)) (+ x (+ y (+ y 1.0)))) (/ (/ x (+ x y)) (* (+ x y) (/ (+ y 1.0) y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.25e-6) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else {
tmp = (x / (x + y)) / ((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) :: tmp
if (x <= (-2.25d-6)) then
tmp = (y / (x + y)) / (x + (y + (y + 1.0d0)))
else
tmp = (x / (x + y)) / ((x + y) * ((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 <= -2.25e-6) {
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
} else {
tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.25e-6: tmp = (y / (x + y)) / (x + (y + (y + 1.0))) else: tmp = (x / (x + y)) / ((x + y) * ((y + 1.0) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.25e-6) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + Float64(y + Float64(y + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) / 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)
tmp = 0.0;
if (x <= -2.25e-6)
tmp = (y / (x + y)) / (x + (y + (y + 1.0)));
else
tmp = (x / (x + y)) / ((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_] := If[LessEqual[x, -2.25e-6], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / 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}
\mathbf{if}\;x \leq -2.25 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + \left(y + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{y}}\\
\end{array}
\end{array}
if x < -2.25000000000000006e-6Initial program 71.9%
associate-*l*71.9%
+-commutative71.9%
+-commutative71.9%
+-commutative71.9%
associate-*l*71.9%
*-commutative71.9%
associate-*r/81.0%
*-commutative81.0%
distribute-rgt1-in36.3%
fma-def81.0%
+-commutative81.0%
+-commutative81.0%
cube-unmult81.0%
+-commutative81.0%
Simplified81.0%
associate-*r/71.9%
fma-udef30.9%
cube-mult30.9%
distribute-rgt1-in71.9%
*-commutative71.9%
+-commutative71.9%
associate-+r+71.9%
frac-times87.4%
*-commutative87.4%
associate-/r*99.8%
clear-num99.8%
frac-times99.8%
*-un-lft-identity99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around -inf 74.5%
mul-1-neg74.5%
unsub-neg74.5%
neg-mul-174.5%
+-commutative74.5%
unsub-neg74.5%
distribute-lft-in74.5%
metadata-eval74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
if -2.25000000000000006e-6 < x Initial program 69.8%
associate-*l*69.8%
+-commutative69.8%
+-commutative69.8%
+-commutative69.8%
associate-*l*69.8%
*-commutative69.8%
associate-*r/86.2%
*-commutative86.2%
distribute-rgt1-in75.3%
fma-def86.2%
+-commutative86.2%
+-commutative86.2%
cube-unmult86.2%
+-commutative86.2%
Simplified86.2%
associate-*r/69.8%
*-commutative69.8%
fma-udef62.1%
cube-mult62.1%
distribute-rgt1-in69.8%
*-commutative69.8%
+-commutative69.8%
associate-+r+69.8%
frac-times89.2%
*-commutative89.2%
clear-num89.2%
associate-/r*99.7%
frac-times99.1%
*-un-lft-identity99.1%
associate-+r+99.1%
+-commutative99.1%
associate-+l+99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 82.0%
Final simplification80.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.4e-77)
(/ (/ y x) (+ x 1.0))
(if (<= y 22500000.0)
(* (/ x (+ y (+ x 1.0))) (/ 1.0 y))
(if (<= y 3e+151) (/ x (* (+ x y) (+ x y))) (/ (/ x (+ x y)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.4e-77) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 22500000.0) {
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
} else if (y <= 3e+151) {
tmp = x / ((x + y) * (x + y));
} else {
tmp = (x / (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.4d-77) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 22500000.0d0) then
tmp = (x / (y + (x + 1.0d0))) * (1.0d0 / y)
else if (y <= 3d+151) then
tmp = x / ((x + y) * (x + y))
else
tmp = (x / (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.4e-77) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 22500000.0) {
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
} else if (y <= 3e+151) {
tmp = x / ((x + y) * (x + y));
} else {
tmp = (x / (x + y)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.4e-77: tmp = (y / x) / (x + 1.0) elif y <= 22500000.0: tmp = (x / (y + (x + 1.0))) * (1.0 / y) elif y <= 3e+151: tmp = x / ((x + y) * (x + y)) else: tmp = (x / (x + y)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.4e-77) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 22500000.0) tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) * Float64(1.0 / y)); elseif (y <= 3e+151) tmp = Float64(x / Float64(Float64(x + y) * Float64(x + y))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(x + y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.4e-77)
tmp = (y / x) / (x + 1.0);
elseif (y <= 22500000.0)
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
elseif (y <= 3e+151)
tmp = x / ((x + y) * (x + y));
else
tmp = (x / (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.4e-77], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 22500000.0], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+151], N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 22500000:\\
\;\;\;\;\frac{x}{y + \left(x + 1\right)} \cdot \frac{1}{y}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+151}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.4e-77Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
associate-/r*61.4%
+-commutative61.4%
Simplified61.4%
if 1.4e-77 < y < 2.25e7Initial program 95.4%
associate-*l*95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
*-commutative95.4%
associate-*l*95.4%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in y around inf 42.9%
if 2.25e7 < y < 2.9999999999999999e151Initial program 80.3%
times-frac99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in y around inf 82.5%
if 2.9999999999999999e151 < y Initial program 55.2%
associate-*l*55.2%
+-commutative55.2%
+-commutative55.2%
+-commutative55.2%
associate-*l*55.2%
*-commutative55.2%
associate-*r/78.7%
*-commutative78.7%
distribute-rgt1-in78.3%
fma-def78.7%
+-commutative78.7%
+-commutative78.7%
cube-unmult78.7%
+-commutative78.7%
Simplified78.7%
associate-*r/55.2%
*-commutative55.2%
fma-udef55.2%
cube-mult55.2%
distribute-rgt1-in55.2%
*-commutative55.2%
+-commutative55.2%
associate-+r+55.2%
frac-times78.7%
associate-*l/78.7%
associate-/r*100.0%
clear-num100.0%
un-div-inv100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 84.3%
Final simplification64.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.55e-74) (/ (/ y x) (+ x 1.0)) (* (/ x (+ y (+ x 1.0))) (/ 1.0 y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.55e-74) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.55d-74) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + (x + 1.0d0))) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.55e-74) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.55e-74: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + (x + 1.0))) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.55e-74) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.55e-74)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + (x + 1.0))) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.55e-74], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.55 \cdot 10^{-74}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + \left(x + 1\right)} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 2.5499999999999998e-74Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
associate-/r*61.4%
+-commutative61.4%
Simplified61.4%
if 2.5499999999999998e-74 < y Initial program 74.1%
associate-*l*74.1%
+-commutative74.1%
+-commutative74.1%
+-commutative74.1%
*-commutative74.1%
associate-*l*74.1%
times-frac91.0%
+-commutative91.0%
+-commutative91.0%
associate-+l+91.0%
Simplified91.0%
Taylor expanded in y around inf 68.5%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ 1.0 (* x (/ x y))) (if (<= x -2.15e-100) (- (/ y x) y) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (x * (x / y));
} else if (x <= -2.15e-100) {
tmp = (y / x) - y;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = 1.0d0 / (x * (x / y))
else if (x <= (-2.15d-100)) then
tmp = (y / x) - y
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (x * (x / y));
} else if (x <= -2.15e-100) {
tmp = (y / x) - y;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = 1.0 / (x * (x / y)) elif x <= -2.15e-100: tmp = (y / x) - y else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 / Float64(x * Float64(x / y))); elseif (x <= -2.15e-100) tmp = Float64(Float64(y / x) - y); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = 1.0 / (x * (x / y));
elseif (x <= -2.15e-100)
tmp = (y / x) - y;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 / N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.15e-100], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{x \cdot \frac{x}{y}}\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-100}:\\
\;\;\;\;\frac{y}{x} - y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 71.0%
times-frac86.9%
+-commutative86.9%
associate-+l+86.9%
Simplified86.9%
Taylor expanded in x around inf 76.5%
*-commutative76.5%
clear-num76.5%
associate-+r+76.5%
+-commutative76.5%
associate-+r+76.5%
frac-times76.4%
metadata-eval76.4%
Applied egg-rr76.4%
Taylor expanded in x around inf 73.7%
if -1 < x < -2.14999999999999999e-100Initial program 84.8%
times-frac99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in y around 0 57.1%
associate-/r*57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in x around 0 57.1%
neg-mul-157.1%
+-commutative57.1%
unsub-neg57.1%
Simplified57.1%
if -2.14999999999999999e-100 < x Initial program 68.0%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in x around 0 55.2%
+-commutative55.2%
Simplified55.2%
Final simplification59.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.28e-73) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.28e-73) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.28d-73) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.28e-73) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.28e-73: tmp = (y / x) / (x + 1.0) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.28e-73) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.28e-73)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (x + y)) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.28e-73], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.28 \cdot 10^{-73}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.2799999999999999e-73Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
associate-/r*61.4%
+-commutative61.4%
Simplified61.4%
if 1.2799999999999999e-73 < y Initial program 74.1%
associate-*l*74.1%
+-commutative74.1%
+-commutative74.1%
+-commutative74.1%
associate-*l*74.1%
*-commutative74.1%
associate-*r/84.1%
*-commutative84.1%
distribute-rgt1-in79.0%
fma-def84.1%
+-commutative84.1%
+-commutative84.1%
cube-unmult84.1%
+-commutative84.1%
Simplified84.1%
associate-*r/74.1%
*-commutative74.1%
fma-udef69.2%
cube-mult69.1%
distribute-rgt1-in74.1%
*-commutative74.1%
+-commutative74.1%
associate-+r+74.1%
frac-times90.9%
*-commutative90.9%
clear-num90.9%
associate-/r*99.8%
frac-times98.9%
*-un-lft-identity98.9%
associate-+r+98.9%
+-commutative98.9%
associate-+l+98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 68.5%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (/ 1.0 (* x (/ x y))) (if (<= x -5.4e-134) (- (/ y x) y) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (x * (x / y));
} else if (x <= -5.4e-134) {
tmp = (y / x) - y;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = 1.0d0 / (x * (x / y))
else if (x <= (-5.4d-134)) then
tmp = (y / x) - y
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (x * (x / y));
} else if (x <= -5.4e-134) {
tmp = (y / x) - y;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = 1.0 / (x * (x / y)) elif x <= -5.4e-134: tmp = (y / x) - y else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 / Float64(x * Float64(x / y))); elseif (x <= -5.4e-134) tmp = Float64(Float64(y / x) - y); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = 1.0 / (x * (x / y));
elseif (x <= -5.4e-134)
tmp = (y / x) - y;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 / N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.4e-134], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{x \cdot \frac{x}{y}}\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-134}:\\
\;\;\;\;\frac{y}{x} - y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 71.0%
times-frac86.9%
+-commutative86.9%
associate-+l+86.9%
Simplified86.9%
Taylor expanded in x around inf 76.5%
*-commutative76.5%
clear-num76.5%
associate-+r+76.5%
+-commutative76.5%
associate-+r+76.5%
frac-times76.4%
metadata-eval76.4%
Applied egg-rr76.4%
Taylor expanded in x around inf 73.7%
if -1 < x < -5.3999999999999996e-134Initial program 78.8%
times-frac99.7%
+-commutative99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in y around 0 51.3%
associate-/r*51.3%
+-commutative51.3%
Simplified51.3%
Taylor expanded in x around 0 51.3%
neg-mul-151.3%
+-commutative51.3%
unsub-neg51.3%
Simplified51.3%
if -5.3999999999999996e-134 < x Initial program 68.1%
associate-*l*68.1%
+-commutative68.1%
+-commutative68.1%
+-commutative68.1%
associate-*l*68.1%
*-commutative68.1%
associate-*r/83.3%
*-commutative83.3%
distribute-rgt1-in72.6%
fma-def83.3%
+-commutative83.3%
+-commutative83.3%
cube-unmult83.3%
+-commutative83.3%
Simplified83.3%
associate-*r/68.2%
*-commutative68.2%
fma-udef61.3%
cube-mult61.3%
distribute-rgt1-in68.1%
*-commutative68.1%
+-commutative68.1%
associate-+r+68.1%
frac-times87.0%
*-commutative87.0%
clear-num87.0%
associate-/r*99.7%
frac-times99.0%
*-un-lft-identity99.0%
associate-+r+99.0%
+-commutative99.0%
associate-+l+99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 78.5%
Taylor expanded in y around 0 57.9%
associate-+r+57.9%
+-commutative57.9%
Simplified57.9%
Taylor expanded in x around 0 35.5%
Final simplification46.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 4.6e-75) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 4.6e-75) {
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 <= 4.6d-75) 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 <= 4.6e-75) {
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 <= 4.6e-75: 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 <= 4.6e-75) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 4.6e-75)
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, 4.6e-75], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.6e-75Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
if 4.6e-75 < y Initial program 74.1%
times-frac90.9%
+-commutative90.9%
associate-+l+90.9%
Simplified90.9%
Taylor expanded in x around 0 66.1%
+-commutative66.1%
Simplified66.1%
Final simplification62.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.2e-73) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.2e-73) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.2d-73) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.2e-73) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.2e-73: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.2e-73) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.2e-73)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + 1.0)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.2e-73], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.20000000000000003e-73Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
if 1.20000000000000003e-73 < y Initial program 74.1%
times-frac90.9%
+-commutative90.9%
associate-+l+90.9%
Simplified90.9%
Taylor expanded in x around 0 66.1%
+-commutative66.1%
Simplified66.1%
*-un-lft-identity66.1%
times-frac68.1%
Applied egg-rr68.1%
associate-*l/68.2%
+-commutative68.2%
*-lft-identity68.2%
Simplified68.2%
Final simplification62.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.7e-76) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.7e-76) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.7d-76) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.7e-76) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.7e-76: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.7e-76) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.7e-76)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / (y + 1.0)) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.7e-76], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.7 \cdot 10^{-76}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.7e-76Initial program 68.5%
times-frac87.8%
+-commutative87.8%
associate-+l+87.8%
Simplified87.8%
Taylor expanded in y around 0 60.4%
associate-/r*61.4%
+-commutative61.4%
Simplified61.4%
if 1.7e-76 < y Initial program 74.1%
times-frac90.9%
+-commutative90.9%
associate-+l+90.9%
Simplified90.9%
Taylor expanded in x around 0 66.1%
+-commutative66.1%
Simplified66.1%
*-un-lft-identity66.1%
times-frac68.1%
Applied egg-rr68.1%
associate-*l/68.2%
+-commutative68.2%
*-lft-identity68.2%
Simplified68.2%
Final simplification63.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.45e-87) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.45e-87) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.45d-87) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.45e-87) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.45e-87: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.45e-87) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.45e-87)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.45e-87], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 1.45e-87Initial program 68.2%
times-frac87.7%
+-commutative87.7%
associate-+l+87.7%
Simplified87.7%
Taylor expanded in y around 0 60.5%
associate-/r*61.5%
+-commutative61.5%
Simplified61.5%
Taylor expanded in x around 0 40.4%
if 1.45e-87 < y Initial program 74.6%
associate-*l*74.6%
+-commutative74.6%
+-commutative74.6%
+-commutative74.6%
associate-*l*74.6%
*-commutative74.6%
associate-*r/84.5%
*-commutative84.5%
distribute-rgt1-in79.5%
fma-def84.5%
+-commutative84.5%
+-commutative84.5%
cube-unmult84.5%
+-commutative84.5%
Simplified84.5%
associate-*r/74.6%
*-commutative74.6%
fma-udef69.8%
cube-mult69.8%
distribute-rgt1-in74.6%
*-commutative74.6%
+-commutative74.6%
associate-+r+74.6%
frac-times91.1%
*-commutative91.1%
clear-num91.1%
associate-/r*99.8%
frac-times98.9%
*-un-lft-identity98.9%
associate-+r+98.9%
+-commutative98.9%
associate-+l+98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 71.2%
Taylor expanded in y around 0 36.6%
associate-+r+36.6%
+-commutative36.6%
Simplified36.6%
Taylor expanded in x around 0 32.7%
Final simplification37.9%
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%
times-frac88.8%
+-commutative88.8%
associate-+l+88.8%
Simplified88.8%
Taylor expanded in x around inf 52.7%
Taylor expanded in y around inf 4.2%
Final simplification4.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 70.3%
associate-*l*70.3%
+-commutative70.3%
+-commutative70.3%
+-commutative70.3%
associate-*l*70.3%
*-commutative70.3%
associate-*r/85.0%
*-commutative85.0%
distribute-rgt1-in66.3%
fma-def85.0%
+-commutative85.0%
+-commutative85.0%
cube-unmult85.0%
+-commutative85.0%
Simplified85.0%
associate-*r/70.3%
*-commutative70.3%
fma-udef54.9%
cube-mult54.9%
distribute-rgt1-in70.3%
*-commutative70.3%
+-commutative70.3%
associate-+r+70.3%
frac-times88.8%
*-commutative88.8%
clear-num88.7%
associate-/r*99.7%
frac-times99.2%
*-un-lft-identity99.2%
associate-+r+99.2%
+-commutative99.2%
associate-+l+99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 76.8%
Taylor expanded in y around 0 55.3%
associate-+r+55.3%
+-commutative55.3%
Simplified55.3%
Taylor expanded in x around 0 27.1%
Final simplification27.1%
(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 2023318
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))