
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (* (/ y (+ y (+ x 1.0))) (/ x (+ y x))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return ((y / (y + (x + 1.0))) * (x / (y + x))) / (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 + 1.0d0))) * (x / (y + x))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + (x + 1.0))) * (x / (y + x))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + (x + 1.0))) * (x / (y + x))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(y + Float64(x + 1.0))) * Float64(x / Float64(y + x))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + (x + 1.0))) * (x / (y + x))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{y + x}}{y + x}
\end{array}
Initial program 70.6%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
associate-*r/70.6%
associate-+r+70.6%
times-frac90.0%
associate-*l/83.3%
associate-+r+83.3%
+-commutative83.3%
associate-+l+83.3%
pow283.3%
+-commutative83.3%
Applied egg-rr83.3%
*-commutative83.3%
unpow283.3%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (+ y x) (+ y x))))
(if (<= x -5.8e+163)
(/ (/ y x) (+ y x))
(if (<= x -5e+24)
(/ y t_0)
(if (<= x -8.2e-14)
(* x (/ y (* t_0 (+ x (+ y 1.0)))))
(* (/ x (+ y x)) (/ (/ y (+ y 1.0)) (+ y x))))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y + x) * (y + x);
double tmp;
if (x <= -5.8e+163) {
tmp = (y / x) / (y + x);
} else if (x <= -5e+24) {
tmp = y / t_0;
} else if (x <= -8.2e-14) {
tmp = x * (y / (t_0 * (x + (y + 1.0))));
} else {
tmp = (x / (y + x)) * ((y / (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 + x) * (y + x)
if (x <= (-5.8d+163)) then
tmp = (y / x) / (y + x)
else if (x <= (-5d+24)) then
tmp = y / t_0
else if (x <= (-8.2d-14)) then
tmp = x * (y / (t_0 * (x + (y + 1.0d0))))
else
tmp = (x / (y + x)) * ((y / (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 + x) * (y + x);
double tmp;
if (x <= -5.8e+163) {
tmp = (y / x) / (y + x);
} else if (x <= -5e+24) {
tmp = y / t_0;
} else if (x <= -8.2e-14) {
tmp = x * (y / (t_0 * (x + (y + 1.0))));
} else {
tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y + x) * (y + x) tmp = 0 if x <= -5.8e+163: tmp = (y / x) / (y + x) elif x <= -5e+24: tmp = y / t_0 elif x <= -8.2e-14: tmp = x * (y / (t_0 * (x + (y + 1.0)))) else: tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y + x) * Float64(y + x)) tmp = 0.0 if (x <= -5.8e+163) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -5e+24) tmp = Float64(y / t_0); elseif (x <= -8.2e-14) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / 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 + x) * (y + x);
tmp = 0.0;
if (x <= -5.8e+163)
tmp = (y / x) / (y + x);
elseif (x <= -5e+24)
tmp = y / t_0;
elseif (x <= -8.2e-14)
tmp = x * (y / (t_0 * (x + (y + 1.0))));
else
tmp = (x / (y + x)) * ((y / (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[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.8e+163], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e+24], N[(y / t$95$0), $MachinePrecision], If[LessEqual[x, -8.2e-14], N[(x * N[(y / N[(t$95$0 * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / 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 := \left(y + x\right) \cdot \left(y + x\right)\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+163}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{+24}:\\
\;\;\;\;\frac{y}{t\_0}\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{\frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -5.79999999999999996e163Initial program 63.0%
associate-/l*83.2%
associate-+l+83.2%
Simplified83.2%
associate-*r/63.0%
associate-+r+63.0%
times-frac83.2%
associate-*l/83.2%
associate-+r+83.2%
+-commutative83.2%
associate-+l+83.2%
pow283.2%
+-commutative83.2%
Applied egg-rr83.2%
*-commutative83.2%
unpow283.2%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 96.4%
if -5.79999999999999996e163 < x < -5.00000000000000045e24Initial program 43.5%
associate-/l*55.3%
associate-+l+55.3%
Simplified55.3%
associate-*r/43.5%
associate-+r+43.5%
times-frac93.1%
associate-*l/93.0%
associate-+r+93.0%
+-commutative93.0%
associate-+l+93.0%
pow293.0%
+-commutative93.0%
Applied egg-rr93.0%
unpow293.0%
Applied egg-rr93.0%
Taylor expanded in x around inf 86.5%
if -5.00000000000000045e24 < x < -8.2000000000000004e-14Initial program 99.2%
associate-/l*99.2%
associate-+l+99.2%
Simplified99.2%
if -8.2000000000000004e-14 < x Initial program 74.5%
associate-/l*85.9%
associate-+l+85.9%
Simplified85.9%
associate-*r/74.5%
associate-+r+74.5%
times-frac90.2%
associate-*l/81.5%
associate-+r+81.5%
+-commutative81.5%
associate-+l+81.5%
pow281.5%
+-commutative81.5%
Applied egg-rr81.5%
*-commutative81.5%
unpow281.5%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 84.2%
+-commutative84.2%
Simplified84.2%
Final simplification86.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ 1.0 x))))
(if (<= x -1.7e+100)
t_0
(if (<= x -3.6e+93)
(/ x (* y (+ y x)))
(if (<= x -5e+74)
t_0
(if (<= x -6.5e-24) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / x) * (1.0 / x);
double tmp;
if (x <= -1.7e+100) {
tmp = t_0;
} else if (x <= -3.6e+93) {
tmp = x / (y * (y + x));
} else if (x <= -5e+74) {
tmp = t_0;
} else if (x <= -6.5e-24) {
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) :: t_0
real(8) :: tmp
t_0 = (y / x) * (1.0d0 / x)
if (x <= (-1.7d+100)) then
tmp = t_0
else if (x <= (-3.6d+93)) then
tmp = x / (y * (y + x))
else if (x <= (-5d+74)) then
tmp = t_0
else if (x <= (-6.5d-24)) 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 t_0 = (y / x) * (1.0 / x);
double tmp;
if (x <= -1.7e+100) {
tmp = t_0;
} else if (x <= -3.6e+93) {
tmp = x / (y * (y + x));
} else if (x <= -5e+74) {
tmp = t_0;
} else if (x <= -6.5e-24) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / x) * (1.0 / x) tmp = 0 if x <= -1.7e+100: tmp = t_0 elif x <= -3.6e+93: tmp = x / (y * (y + x)) elif x <= -5e+74: tmp = t_0 elif x <= -6.5e-24: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / x) * Float64(1.0 / x)) tmp = 0.0 if (x <= -1.7e+100) tmp = t_0; elseif (x <= -3.6e+93) tmp = Float64(x / Float64(y * Float64(y + x))); elseif (x <= -5e+74) tmp = t_0; elseif (x <= -6.5e-24) 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)
t_0 = (y / x) * (1.0 / x);
tmp = 0.0;
if (x <= -1.7e+100)
tmp = t_0;
elseif (x <= -3.6e+93)
tmp = x / (y * (y + x));
elseif (x <= -5e+74)
tmp = t_0;
elseif (x <= -6.5e-24)
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_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e+100], t$95$0, If[LessEqual[x, -3.6e+93], N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e+74], t$95$0, If[LessEqual[x, -6.5e-24], 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}
t_0 := \frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.69999999999999997e100 or -3.5999999999999999e93 < x < -4.99999999999999963e74Initial program 53.6%
*-un-lft-identity53.6%
associate-*l*53.6%
times-frac70.3%
+-commutative70.3%
*-commutative70.3%
+-commutative70.3%
associate-+r+70.3%
+-commutative70.3%
associate-+l+70.3%
Applied egg-rr70.3%
Taylor expanded in x around inf 87.0%
Taylor expanded in y around 0 86.8%
if -1.69999999999999997e100 < x < -3.5999999999999999e93Initial program 4.2%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
*-un-lft-identity79.2%
associate-+r+79.2%
associate-*l*79.2%
times-frac79.2%
+-commutative79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
Applied egg-rr79.2%
associate-*l/79.2%
*-lft-identity79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in y around inf 79.2%
associate-/l/79.2%
un-div-inv79.2%
Applied egg-rr79.2%
if -4.99999999999999963e74 < x < -6.5e-24Initial program 88.8%
associate-/l*88.6%
associate-+l+88.6%
Simplified88.6%
Taylor expanded in y around 0 73.5%
+-commutative73.5%
Simplified73.5%
if -6.5e-24 < x Initial program 74.5%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 60.3%
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.4e+158)
(/ (/ y x) (+ y x))
(if (<= x -8.5e+26)
(/ y (* (+ y x) (+ y x)))
(* x (/ (/ y (* (+ y (+ x 1.0)) (+ y x))) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.4e+158) {
tmp = (y / x) / (y + x);
} else if (x <= -8.5e+26) {
tmp = y / ((y + x) * (y + x));
} else {
tmp = x * ((y / ((y + (x + 1.0)) * (y + x))) / (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 (x <= (-2.4d+158)) then
tmp = (y / x) / (y + x)
else if (x <= (-8.5d+26)) then
tmp = y / ((y + x) * (y + x))
else
tmp = x * ((y / ((y + (x + 1.0d0)) * (y + x))) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.4e+158) {
tmp = (y / x) / (y + x);
} else if (x <= -8.5e+26) {
tmp = y / ((y + x) * (y + x));
} else {
tmp = x * ((y / ((y + (x + 1.0)) * (y + x))) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.4e+158: tmp = (y / x) / (y + x) elif x <= -8.5e+26: tmp = y / ((y + x) * (y + x)) else: tmp = x * ((y / ((y + (x + 1.0)) * (y + x))) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.4e+158) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -8.5e+26) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + Float64(x + 1.0)) * Float64(y + x))) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.4e+158)
tmp = (y / x) / (y + x);
elseif (x <= -8.5e+26)
tmp = y / ((y + x) * (y + x));
else
tmp = x * ((y / ((y + (x + 1.0)) * (y + x))) / (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[x, -2.4e+158], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e+26], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+158}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + \left(x + 1\right)\right) \cdot \left(y + x\right)}}{y + x}\\
\end{array}
\end{array}
if x < -2.40000000000000008e158Initial program 60.7%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
associate-*r/60.7%
associate-+r+60.7%
times-frac80.4%
associate-*l/80.4%
associate-+r+80.4%
+-commutative80.4%
associate-+l+80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
*-commutative80.4%
unpow280.4%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.1%
if -2.40000000000000008e158 < x < -8.5e26Initial program 45.1%
associate-/l*57.2%
associate-+l+57.2%
Simplified57.2%
associate-*r/45.1%
associate-+r+45.1%
times-frac96.5%
associate-*l/96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
pow296.3%
+-commutative96.3%
Applied egg-rr96.3%
unpow296.3%
Applied egg-rr96.3%
Taylor expanded in x around inf 89.5%
if -8.5e26 < x Initial program 75.3%
associate-/l*86.3%
associate-+l+86.3%
Simplified86.3%
*-un-lft-identity86.3%
associate-+r+86.3%
associate-*l*86.3%
times-frac95.8%
+-commutative95.8%
+-commutative95.8%
associate-+r+95.8%
+-commutative95.8%
associate-+l+95.8%
Applied egg-rr95.8%
associate-*l/95.8%
*-lft-identity95.8%
+-commutative95.8%
Simplified95.8%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -5.4e+163)
(/ (/ y x) (+ y x))
(if (<= x -5000000.0)
(/ y (* (+ y x) (+ y x)))
(* (/ x (+ y x)) (/ (/ y (+ y 1.0)) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -5.4e+163) {
tmp = (y / x) / (y + x);
} else if (x <= -5000000.0) {
tmp = y / ((y + x) * (y + x));
} else {
tmp = (x / (y + x)) * ((y / (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 (x <= (-5.4d+163)) then
tmp = (y / x) / (y + x)
else if (x <= (-5000000.0d0)) then
tmp = y / ((y + x) * (y + x))
else
tmp = (x / (y + x)) * ((y / (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 (x <= -5.4e+163) {
tmp = (y / x) / (y + x);
} else if (x <= -5000000.0) {
tmp = y / ((y + x) * (y + x));
} else {
tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -5.4e+163: tmp = (y / x) / (y + x) elif x <= -5000000.0: tmp = y / ((y + x) * (y + x)) else: tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -5.4e+163) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -5000000.0) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / 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 (x <= -5.4e+163)
tmp = (y / x) / (y + x);
elseif (x <= -5000000.0)
tmp = y / ((y + x) * (y + x));
else
tmp = (x / (y + x)) * ((y / (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[x, -5.4e+163], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5000000.0], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+163}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -5000000:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{\frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -5.39999999999999998e163Initial program 63.0%
associate-/l*83.2%
associate-+l+83.2%
Simplified83.2%
associate-*r/63.0%
associate-+r+63.0%
times-frac83.2%
associate-*l/83.2%
associate-+r+83.2%
+-commutative83.2%
associate-+l+83.2%
pow283.2%
+-commutative83.2%
Applied egg-rr83.2%
*-commutative83.2%
unpow283.2%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 96.4%
if -5.39999999999999998e163 < x < -5e6Initial program 52.2%
associate-/l*62.2%
associate-+l+62.2%
Simplified62.2%
associate-*r/52.2%
associate-+r+52.2%
times-frac94.0%
associate-*l/94.0%
associate-+r+94.0%
+-commutative94.0%
associate-+l+94.0%
pow294.0%
+-commutative94.0%
Applied egg-rr94.0%
unpow294.0%
Applied egg-rr94.0%
Taylor expanded in x around inf 86.8%
if -5e6 < x Initial program 74.7%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
associate-*r/74.7%
associate-+r+74.7%
times-frac90.3%
associate-*l/81.6%
associate-+r+81.6%
+-commutative81.6%
associate-+l+81.6%
pow281.6%
+-commutative81.6%
Applied egg-rr81.6%
*-commutative81.6%
unpow281.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.8%
+-commutative83.8%
Simplified83.8%
Final simplification85.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.4e+158)
(/ (/ y x) (+ y x))
(if (<= x -1350.0)
(/ (* y (/ x (+ x 1.0))) (* (+ y x) (+ y x)))
(* (/ x (+ y x)) (/ (/ y (+ y 1.0)) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.4e+158) {
tmp = (y / x) / (y + x);
} else if (x <= -1350.0) {
tmp = (y * (x / (x + 1.0))) / ((y + x) * (y + x));
} else {
tmp = (x / (y + x)) * ((y / (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 (x <= (-2.4d+158)) then
tmp = (y / x) / (y + x)
else if (x <= (-1350.0d0)) then
tmp = (y * (x / (x + 1.0d0))) / ((y + x) * (y + x))
else
tmp = (x / (y + x)) * ((y / (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 (x <= -2.4e+158) {
tmp = (y / x) / (y + x);
} else if (x <= -1350.0) {
tmp = (y * (x / (x + 1.0))) / ((y + x) * (y + x));
} else {
tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.4e+158: tmp = (y / x) / (y + x) elif x <= -1350.0: tmp = (y * (x / (x + 1.0))) / ((y + x) * (y + x)) else: tmp = (x / (y + x)) * ((y / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.4e+158) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -1350.0) tmp = Float64(Float64(y * Float64(x / Float64(x + 1.0))) / Float64(Float64(y + x) * Float64(y + x))); else tmp = Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / 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 (x <= -2.4e+158)
tmp = (y / x) / (y + x);
elseif (x <= -1350.0)
tmp = (y * (x / (x + 1.0))) / ((y + x) * (y + x));
else
tmp = (x / (y + x)) * ((y / (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[x, -2.4e+158], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1350.0], N[(N[(y * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+158}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -1350:\\
\;\;\;\;\frac{y \cdot \frac{x}{x + 1}}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{\frac{y}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -2.40000000000000008e158Initial program 60.7%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
associate-*r/60.7%
associate-+r+60.7%
times-frac80.4%
associate-*l/80.4%
associate-+r+80.4%
+-commutative80.4%
associate-+l+80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
*-commutative80.4%
unpow280.4%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.1%
if -2.40000000000000008e158 < x < -1350Initial program 53.9%
associate-/l*64.0%
associate-+l+64.0%
Simplified64.0%
associate-*r/53.9%
associate-+r+53.9%
times-frac96.9%
associate-*l/96.9%
associate-+r+96.9%
+-commutative96.9%
associate-+l+96.9%
pow296.9%
+-commutative96.9%
Applied egg-rr96.9%
unpow296.9%
Applied egg-rr96.9%
Taylor expanded in y around 0 71.8%
div-inv71.8%
*-commutative71.8%
associate-*l*91.1%
+-commutative91.1%
Applied egg-rr91.1%
associate-*r*71.8%
associate-*r/71.8%
*-rgt-identity71.8%
associate-*r/91.2%
Simplified91.2%
if -1350 < x Initial program 74.7%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
associate-*r/74.7%
associate-+r+74.7%
times-frac90.3%
associate-*l/81.6%
associate-+r+81.6%
+-commutative81.6%
associate-+l+81.6%
pow281.6%
+-commutative81.6%
Applied egg-rr81.6%
*-commutative81.6%
unpow281.6%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.8%
+-commutative83.8%
Simplified83.8%
Final simplification85.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.18e+160)
(/ (/ y x) (+ y x))
(if (<= x -9e+26)
(/ y (* (+ y x) (+ y x)))
(if (<= x -6.2e-48)
(/ (/ y (+ x 1.0)) (+ y x))
(/ (/ x (+ y 1.0)) (+ y x))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.18e+160) {
tmp = (y / x) / (y + x);
} else if (x <= -9e+26) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -6.2e-48) {
tmp = (y / (x + 1.0)) / (y + x);
} 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 (x <= (-1.18d+160)) then
tmp = (y / x) / (y + x)
else if (x <= (-9d+26)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-6.2d-48)) then
tmp = (y / (x + 1.0d0)) / (y + x)
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 (x <= -1.18e+160) {
tmp = (y / x) / (y + x);
} else if (x <= -9e+26) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -6.2e-48) {
tmp = (y / (x + 1.0)) / (y + x);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.18e+160: tmp = (y / x) / (y + x) elif x <= -9e+26: tmp = y / ((y + x) * (y + x)) elif x <= -6.2e-48: tmp = (y / (x + 1.0)) / (y + x) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.18e+160) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -9e+26) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -6.2e-48) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(y + x)); 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 (x <= -1.18e+160)
tmp = (y / x) / (y + x);
elseif (x <= -9e+26)
tmp = y / ((y + x) * (y + x));
elseif (x <= -6.2e-48)
tmp = (y / (x + 1.0)) / (y + x);
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[x, -1.18e+160], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9e+26], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.2e-48], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $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}\;x \leq -1.18 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -9 \cdot 10^{+26}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.17999999999999999e160Initial program 60.7%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
associate-*r/60.7%
associate-+r+60.7%
times-frac80.4%
associate-*l/80.4%
associate-+r+80.4%
+-commutative80.4%
associate-+l+80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
*-commutative80.4%
unpow280.4%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.1%
if -1.17999999999999999e160 < x < -8.99999999999999957e26Initial program 45.1%
associate-/l*57.2%
associate-+l+57.2%
Simplified57.2%
associate-*r/45.1%
associate-+r+45.1%
times-frac96.5%
associate-*l/96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
pow296.3%
+-commutative96.3%
Applied egg-rr96.3%
unpow296.3%
Applied egg-rr96.3%
Taylor expanded in x around inf 89.5%
if -8.99999999999999957e26 < x < -6.20000000000000033e-48Initial program 91.1%
associate-/l*94.6%
associate-+l+94.6%
Simplified94.6%
associate-*r/91.1%
associate-+r+91.1%
times-frac99.4%
associate-*l/96.1%
associate-+r+96.1%
+-commutative96.1%
associate-+l+96.1%
pow296.1%
+-commutative96.1%
Applied egg-rr96.1%
*-commutative96.1%
unpow296.1%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 62.4%
+-commutative62.4%
Simplified62.4%
if -6.20000000000000033e-48 < x Initial program 74.2%
*-un-lft-identity74.2%
associate-*l*74.2%
times-frac77.8%
+-commutative77.8%
*-commutative77.8%
+-commutative77.8%
associate-+r+77.8%
+-commutative77.8%
associate-+l+77.8%
Applied egg-rr77.8%
Taylor expanded in x around 0 61.9%
+-commutative61.9%
Simplified61.9%
associate-*l/62.1%
*-un-lft-identity62.1%
Applied egg-rr62.1%
Final simplification68.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (or (<= x -1.7e+100) (and (not (<= x -3.6e+93)) (<= x -820000000.0))) (* (/ y x) (/ 1.0 x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if ((x <= -1.7e+100) || (!(x <= -3.6e+93) && (x <= -820000000.0))) {
tmp = (y / x) * (1.0 / 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 ((x <= (-1.7d+100)) .or. (.not. (x <= (-3.6d+93))) .and. (x <= (-820000000.0d0))) then
tmp = (y / x) * (1.0d0 / 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 ((x <= -1.7e+100) || (!(x <= -3.6e+93) && (x <= -820000000.0))) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if (x <= -1.7e+100) or (not (x <= -3.6e+93) and (x <= -820000000.0)): tmp = (y / x) * (1.0 / x) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if ((x <= -1.7e+100) || (!(x <= -3.6e+93) && (x <= -820000000.0))) tmp = Float64(Float64(y / x) * Float64(1.0 / 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 ((x <= -1.7e+100) || (~((x <= -3.6e+93)) && (x <= -820000000.0)))
tmp = (y / x) * (1.0 / 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[Or[LessEqual[x, -1.7e+100], And[N[Not[LessEqual[x, -3.6e+93]], $MachinePrecision], LessEqual[x, -820000000.0]]], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100} \lor \neg \left(x \leq -3.6 \cdot 10^{+93}\right) \land x \leq -820000000:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.69999999999999997e100 or -3.5999999999999999e93 < x < -8.2e8Initial program 61.0%
*-un-lft-identity61.0%
associate-*l*61.0%
times-frac74.3%
+-commutative74.3%
*-commutative74.3%
+-commutative74.3%
associate-+r+74.3%
+-commutative74.3%
associate-+l+74.3%
Applied egg-rr74.3%
Taylor expanded in x around inf 83.3%
Taylor expanded in y around 0 83.1%
if -1.69999999999999997e100 < x < -3.5999999999999999e93 or -8.2e8 < x Initial program 73.3%
associate-/l*85.8%
associate-+l+85.8%
Simplified85.8%
Taylor expanded in x around 0 60.1%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.7e+100)
(* (/ y x) (/ 1.0 x))
(if (or (<= x -4.5e+92) (not (<= x -1.55e-23)))
(/ (/ x y) (+ y 1.0))
(/ y (* x (+ x 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.7e+100) {
tmp = (y / x) * (1.0 / x);
} else if ((x <= -4.5e+92) || !(x <= -1.55e-23)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = 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 (x <= (-1.7d+100)) then
tmp = (y / x) * (1.0d0 / x)
else if ((x <= (-4.5d+92)) .or. (.not. (x <= (-1.55d-23)))) then
tmp = (x / y) / (y + 1.0d0)
else
tmp = 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 (x <= -1.7e+100) {
tmp = (y / x) * (1.0 / x);
} else if ((x <= -4.5e+92) || !(x <= -1.55e-23)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.7e+100: tmp = (y / x) * (1.0 / x) elif (x <= -4.5e+92) or not (x <= -1.55e-23): tmp = (x / y) / (y + 1.0) else: tmp = y / (x * (x + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.7e+100) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif ((x <= -4.5e+92) || !(x <= -1.55e-23)) tmp = Float64(Float64(x / y) / Float64(y + 1.0)); else tmp = 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 (x <= -1.7e+100)
tmp = (y / x) * (1.0 / x);
elseif ((x <= -4.5e+92) || ~((x <= -1.55e-23)))
tmp = (x / y) / (y + 1.0);
else
tmp = 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[x, -1.7e+100], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4.5e+92], N[Not[LessEqual[x, -1.55e-23]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{+92} \lor \neg \left(x \leq -1.55 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -1.69999999999999997e100Initial program 50.2%
*-un-lft-identity50.2%
associate-*l*50.2%
times-frac68.2%
+-commutative68.2%
*-commutative68.2%
+-commutative68.2%
associate-+r+68.2%
+-commutative68.2%
associate-+l+68.2%
Applied egg-rr68.2%
Taylor expanded in x around inf 86.1%
Taylor expanded in y around 0 85.9%
if -1.69999999999999997e100 < x < -4.4999999999999999e92 or -1.5499999999999999e-23 < x Initial program 73.0%
associate-/l*85.9%
associate-+l+85.9%
Simplified85.9%
Taylor expanded in x around 0 60.7%
associate-/r*62.6%
+-commutative62.6%
Simplified62.6%
if -4.4999999999999999e92 < x < -1.5499999999999999e-23Initial program 90.6%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in y around 0 77.7%
+-commutative77.7%
Simplified77.7%
Final simplification67.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.7e+100)
(/ (/ y x) (+ y x))
(if (or (<= x -5.8e+91) (not (<= x -1.75e-25)))
(/ (/ x y) (+ y 1.0))
(/ y (* x (+ x 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.7e+100) {
tmp = (y / x) / (y + x);
} else if ((x <= -5.8e+91) || !(x <= -1.75e-25)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = 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 (x <= (-1.7d+100)) then
tmp = (y / x) / (y + x)
else if ((x <= (-5.8d+91)) .or. (.not. (x <= (-1.75d-25)))) then
tmp = (x / y) / (y + 1.0d0)
else
tmp = 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 (x <= -1.7e+100) {
tmp = (y / x) / (y + x);
} else if ((x <= -5.8e+91) || !(x <= -1.75e-25)) {
tmp = (x / y) / (y + 1.0);
} else {
tmp = y / (x * (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.7e+100: tmp = (y / x) / (y + x) elif (x <= -5.8e+91) or not (x <= -1.75e-25): tmp = (x / y) / (y + 1.0) else: tmp = y / (x * (x + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.7e+100) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif ((x <= -5.8e+91) || !(x <= -1.75e-25)) tmp = Float64(Float64(x / y) / Float64(y + 1.0)); else tmp = 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 (x <= -1.7e+100)
tmp = (y / x) / (y + x);
elseif ((x <= -5.8e+91) || ~((x <= -1.75e-25)))
tmp = (x / y) / (y + 1.0);
else
tmp = 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[x, -1.7e+100], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.8e+91], N[Not[LessEqual[x, -1.75e-25]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{+91} \lor \neg \left(x \leq -1.75 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -1.69999999999999997e100Initial program 50.2%
associate-/l*68.6%
associate-+l+68.6%
Simplified68.6%
associate-*r/50.2%
associate-+r+50.2%
times-frac86.5%
associate-*l/86.5%
associate-+r+86.5%
+-commutative86.5%
associate-+l+86.5%
pow286.5%
+-commutative86.5%
Applied egg-rr86.5%
*-commutative86.5%
unpow286.5%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 86.1%
if -1.69999999999999997e100 < x < -5.80000000000000028e91 or -1.7500000000000001e-25 < x Initial program 73.0%
associate-/l*85.9%
associate-+l+85.9%
Simplified85.9%
Taylor expanded in x around 0 60.7%
associate-/r*62.6%
+-commutative62.6%
Simplified62.6%
if -5.80000000000000028e91 < x < -1.7500000000000001e-25Initial program 90.6%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in y around 0 77.7%
+-commutative77.7%
Simplified77.7%
Final simplification67.4%
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 x))))
(if (<= x -1.95e+100)
t_0
(if (<= x -1.25e+93)
(/ x (* y (+ y x)))
(if (<= x -3200000.0) t_0 (/ x (* y (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / x) * (1.0 / x);
double tmp;
if (x <= -1.95e+100) {
tmp = t_0;
} else if (x <= -1.25e+93) {
tmp = x / (y * (y + x));
} else if (x <= -3200000.0) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (y / x) * (1.0d0 / x)
if (x <= (-1.95d+100)) then
tmp = t_0
else if (x <= (-1.25d+93)) then
tmp = x / (y * (y + x))
else if (x <= (-3200000.0d0)) then
tmp = t_0
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 t_0 = (y / x) * (1.0 / x);
double tmp;
if (x <= -1.95e+100) {
tmp = t_0;
} else if (x <= -1.25e+93) {
tmp = x / (y * (y + x));
} else if (x <= -3200000.0) {
tmp = t_0;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / x) * (1.0 / x) tmp = 0 if x <= -1.95e+100: tmp = t_0 elif x <= -1.25e+93: tmp = x / (y * (y + x)) elif x <= -3200000.0: tmp = t_0 else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / x) * Float64(1.0 / x)) tmp = 0.0 if (x <= -1.95e+100) tmp = t_0; elseif (x <= -1.25e+93) tmp = Float64(x / Float64(y * Float64(y + x))); elseif (x <= -3200000.0) tmp = t_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)
t_0 = (y / x) * (1.0 / x);
tmp = 0.0;
if (x <= -1.95e+100)
tmp = t_0;
elseif (x <= -1.25e+93)
tmp = x / (y * (y + x));
elseif (x <= -3200000.0)
tmp = t_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_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e+100], t$95$0, If[LessEqual[x, -1.25e+93], N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3200000.0], t$95$0, N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -3200000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.95e100 or -1.25e93 < x < -3.2e6Initial program 61.0%
*-un-lft-identity61.0%
associate-*l*61.0%
times-frac74.3%
+-commutative74.3%
*-commutative74.3%
+-commutative74.3%
associate-+r+74.3%
+-commutative74.3%
associate-+l+74.3%
Applied egg-rr74.3%
Taylor expanded in x around inf 83.3%
Taylor expanded in y around 0 83.1%
if -1.95e100 < x < -1.25e93Initial program 4.2%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
*-un-lft-identity79.2%
associate-+r+79.2%
associate-*l*79.2%
times-frac79.2%
+-commutative79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
Applied egg-rr79.2%
associate-*l/79.2%
*-lft-identity79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in y around inf 79.2%
associate-/l/79.2%
un-div-inv79.2%
Applied egg-rr79.2%
if -3.2e6 < x Initial program 74.7%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 59.7%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -9e+148)
(/ (/ y x) (+ y x))
(if (<= x -9.5e+26)
(/ 1.0 (/ (* x (+ y x)) y))
(if (<= x -1.16e-23) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9e+148) {
tmp = (y / x) / (y + x);
} else if (x <= -9.5e+26) {
tmp = 1.0 / ((x * (y + x)) / y);
} else if (x <= -1.16e-23) {
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 <= (-9d+148)) then
tmp = (y / x) / (y + x)
else if (x <= (-9.5d+26)) then
tmp = 1.0d0 / ((x * (y + x)) / y)
else if (x <= (-1.16d-23)) 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 <= -9e+148) {
tmp = (y / x) / (y + x);
} else if (x <= -9.5e+26) {
tmp = 1.0 / ((x * (y + x)) / y);
} else if (x <= -1.16e-23) {
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 <= -9e+148: tmp = (y / x) / (y + x) elif x <= -9.5e+26: tmp = 1.0 / ((x * (y + x)) / y) elif x <= -1.16e-23: 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 <= -9e+148) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -9.5e+26) tmp = Float64(1.0 / Float64(Float64(x * Float64(y + x)) / y)); elseif (x <= -1.16e-23) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9e+148)
tmp = (y / x) / (y + x);
elseif (x <= -9.5e+26)
tmp = 1.0 / ((x * (y + x)) / y);
elseif (x <= -1.16e-23)
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, -9e+148], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.5e+26], N[(1.0 / N[(N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.16e-23], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+148}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{1}{\frac{x \cdot \left(y + x\right)}{y}}\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-23}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -8.99999999999999987e148Initial program 60.2%
associate-/l*78.6%
associate-+l+78.6%
Simplified78.6%
associate-*r/60.2%
associate-+r+60.2%
times-frac81.8%
associate-*l/81.8%
associate-+r+81.8%
+-commutative81.8%
associate-+l+81.8%
pow281.8%
+-commutative81.8%
Applied egg-rr81.8%
*-commutative81.8%
unpow281.8%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.6%
if -8.99999999999999987e148 < x < -9.50000000000000054e26Initial program 44.5%
*-un-lft-identity44.5%
associate-*l*44.5%
times-frac71.2%
+-commutative71.2%
*-commutative71.2%
+-commutative71.2%
associate-+r+71.2%
+-commutative71.2%
associate-+l+71.2%
Applied egg-rr71.2%
Taylor expanded in x around inf 60.1%
frac-times84.0%
*-un-lft-identity84.0%
clear-num83.4%
Applied egg-rr83.4%
if -9.50000000000000054e26 < x < -1.1599999999999999e-23Initial program 92.6%
associate-/l*92.4%
associate-+l+92.4%
Simplified92.4%
Taylor expanded in y around 0 78.0%
+-commutative78.0%
Simplified78.0%
if -1.1599999999999999e-23 < x Initial program 74.5%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 60.3%
associate-/r*61.8%
+-commutative61.8%
Simplified61.8%
Final simplification68.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.8e+161)
(/ (/ y x) (+ y x))
(if (<= x -1550000000000.0)
(/ y (* (+ y x) (+ y x)))
(if (<= x -1.3e-22) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.8e+161) {
tmp = (y / x) / (y + x);
} else if (x <= -1550000000000.0) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -1.3e-22) {
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 <= (-2.8d+161)) then
tmp = (y / x) / (y + x)
else if (x <= (-1550000000000.0d0)) then
tmp = y / ((y + x) * (y + x))
else if (x <= (-1.3d-22)) 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 <= -2.8e+161) {
tmp = (y / x) / (y + x);
} else if (x <= -1550000000000.0) {
tmp = y / ((y + x) * (y + x));
} else if (x <= -1.3e-22) {
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 <= -2.8e+161: tmp = (y / x) / (y + x) elif x <= -1550000000000.0: tmp = y / ((y + x) * (y + x)) elif x <= -1.3e-22: 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 <= -2.8e+161) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -1550000000000.0) tmp = Float64(y / Float64(Float64(y + x) * Float64(y + x))); elseif (x <= -1.3e-22) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.8e+161)
tmp = (y / x) / (y + x);
elseif (x <= -1550000000000.0)
tmp = y / ((y + x) * (y + x));
elseif (x <= -1.3e-22)
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, -2.8e+161], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1550000000000.0], N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-22], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+161}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -1550000000000:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-22}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.80000000000000021e161Initial program 60.7%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
associate-*r/60.7%
associate-+r+60.7%
times-frac80.4%
associate-*l/80.4%
associate-+r+80.4%
+-commutative80.4%
associate-+l+80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
*-commutative80.4%
unpow280.4%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.1%
if -2.80000000000000021e161 < x < -1.55e12Initial program 50.8%
associate-/l*61.6%
associate-+l+61.6%
Simplified61.6%
associate-*r/50.8%
associate-+r+50.8%
times-frac96.8%
associate-*l/96.7%
associate-+r+96.7%
+-commutative96.7%
associate-+l+96.7%
pow296.7%
+-commutative96.7%
Applied egg-rr96.7%
unpow296.7%
Applied egg-rr96.7%
Taylor expanded in x around inf 90.6%
if -1.55e12 < x < -1.3e-22Initial program 89.2%
associate-/l*88.9%
associate-+l+88.9%
Simplified88.9%
Taylor expanded in y around 0 83.4%
+-commutative83.4%
Simplified83.4%
if -1.3e-22 < x Initial program 74.5%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
Taylor expanded in x around 0 60.3%
associate-/r*61.8%
+-commutative61.8%
Simplified61.8%
Final simplification69.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ y x)) (/ (/ y (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (x / (y + x)) * ((y / (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 = (x / (y + x)) * ((y / (y + (x + 1.0d0))) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (y + x)) * ((y / (y + (x + 1.0))) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (y + x)) * ((y / (y + (x + 1.0))) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (y + x)) * ((y / (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[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / 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{x}{y + x} \cdot \frac{\frac{y}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 70.6%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
associate-*r/70.6%
associate-+r+70.6%
times-frac90.0%
associate-*l/83.3%
associate-+r+83.3%
+-commutative83.3%
associate-+l+83.3%
pow283.3%
+-commutative83.3%
Applied egg-rr83.3%
*-commutative83.3%
unpow283.3%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (* (/ y x) (/ 1.0 x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) * (1.0d0 / x)
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) * (1.0 / x) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) * (1.0 / x);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 57.8%
*-un-lft-identity57.8%
associate-*l*57.8%
times-frac70.1%
+-commutative70.1%
*-commutative70.1%
+-commutative70.1%
associate-+r+70.1%
+-commutative70.1%
associate-+l+70.1%
Applied egg-rr70.1%
Taylor expanded in x around inf 77.0%
Taylor expanded in y around 0 76.8%
if -1 < x Initial program 74.5%
associate-/l*85.9%
associate-+l+85.9%
Simplified85.9%
Taylor expanded in x around 0 60.0%
Taylor expanded in y around 0 37.6%
Final simplification46.8%
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.6%
*-un-lft-identity70.6%
associate-*l*70.6%
times-frac76.4%
+-commutative76.4%
*-commutative76.4%
+-commutative76.4%
associate-+r+76.4%
+-commutative76.4%
associate-+l+76.4%
Applied egg-rr76.4%
Taylor expanded in x around inf 37.1%
Taylor expanded in y around inf 4.0%
Final simplification4.0%
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.6%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in y around 0 29.3%
Final simplification29.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (- x))
assert(x < y);
double code(double x, double y) {
return -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 = -x
end function
assert x < y;
public static double code(double x, double y) {
return -x;
}
[x, y] = sort([x, y]) def code(x, y): return -x
x, y = sort([x, y]) function code(x, y) return Float64(-x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = -x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := (-x)
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-x
\end{array}
Initial program 70.6%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in y around 0 16.6%
+-commutative16.6%
neg-mul-116.6%
unsub-neg16.6%
Simplified16.6%
Taylor expanded in y around inf 3.8%
neg-mul-13.8%
Simplified3.8%
Final simplification3.8%
(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 2024053
(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))))