
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ (/ x (+ x y)) (+ x (+ y 1.0))) (/ y (+ x y))))
assert(x < y);
double code(double x, double y) {
return ((x / (x + y)) / (x + (y + 1.0))) * (y / (x + y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / (x + y)) / (x + (y + 1.0d0))) * (y / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return ((x / (x + y)) / (x + (y + 1.0))) * (y / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return ((x / (x + y)) / (x + (y + 1.0))) * (y / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + Float64(y + 1.0))) * Float64(y / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{x + \left(y + 1\right)} \cdot \frac{y}{x + y}
\end{array}
Initial program 67.0%
*-commutative67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
frac-times67.0%
*-commutative67.0%
+-commutative67.0%
+-commutative67.0%
associate-+r+67.0%
+-commutative67.0%
Applied egg-rr67.0%
*-commutative67.0%
times-frac94.3%
associate-/r*99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= x -1.45e+30)
(* (/ (/ x (+ x y)) t_0) (/ y x))
(if (<= x -7.4e-181)
(* x (/ y (* t_0 (* (+ x y) (+ x y)))))
(/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.45e+30) {
tmp = ((x / (x + y)) / t_0) * (y / x);
} else if (x <= -7.4e-181) {
tmp = x * (y / (t_0 * ((x + 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) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (x <= (-1.45d+30)) then
tmp = ((x / (x + y)) / t_0) * (y / x)
else if (x <= (-7.4d-181)) then
tmp = x * (y / (t_0 * ((x + 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 t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.45e+30) {
tmp = ((x / (x + y)) / t_0) * (y / x);
} else if (x <= -7.4e-181) {
tmp = x * (y / (t_0 * ((x + y) * (x + y))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if x <= -1.45e+30: tmp = ((x / (x + y)) / t_0) * (y / x) elif x <= -7.4e-181: tmp = x * (y / (t_0 * ((x + y) * (x + y)))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (x <= -1.45e+30) tmp = Float64(Float64(Float64(x / Float64(x + y)) / t_0) * Float64(y / x)); elseif (x <= -7.4e-181) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(x + y) * Float64(x + y))))); 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)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (x <= -1.45e+30)
tmp = ((x / (x + y)) / t_0) * (y / x);
elseif (x <= -7.4e-181)
tmp = x * (y / (t_0 * ((x + 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_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e+30], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.4e-181], N[(x * N[(y / N[(t$95$0 * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{+30}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{t\_0} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -7.4 \cdot 10^{-181}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.4499999999999999e30Initial program 55.3%
*-commutative55.3%
associate-*l*55.3%
times-frac85.3%
+-commutative85.3%
+-commutative85.3%
associate-+r+85.3%
+-commutative85.3%
associate-+l+85.3%
Applied egg-rr85.3%
frac-times55.3%
*-commutative55.3%
+-commutative55.3%
+-commutative55.3%
associate-+r+55.3%
+-commutative55.3%
Applied egg-rr55.3%
*-commutative55.3%
times-frac85.3%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around 0 84.4%
if -1.4499999999999999e30 < x < -7.39999999999999968e-181Initial program 76.6%
associate-/l*96.5%
associate-+l+96.5%
Simplified96.5%
if -7.39999999999999968e-181 < x Initial program 68.5%
associate-/l*84.5%
associate-+l+84.5%
Simplified84.5%
Taylor expanded in x around 0 63.1%
associate-/r*64.5%
+-commutative64.5%
Simplified64.5%
Final simplification72.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.4e+49) (* (/ (/ x (+ x y)) (+ x (+ y 1.0))) (/ y x)) (* x (/ (/ y (* (+ x y) (+ y (+ x 1.0)))) (+ x y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.4e+49) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.4d+49)) then
tmp = ((x / (x + y)) / (x + (y + 1.0d0))) * (y / x)
else
tmp = x * ((y / ((x + y) * (y + (x + 1.0d0)))) / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.4e+49) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.4e+49: tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x) else: tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.4e+49) tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + Float64(y + 1.0))) * Float64(y / x)); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))) / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.4e+49)
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
else
tmp = x * ((y / ((x + y) * (y + (x + 1.0)))) / (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.4e+49], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+49}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + 1\right)} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}}{x + y}\\
\end{array}
\end{array}
if x < -1.3999999999999999e49Initial program 54.5%
*-commutative54.5%
associate-*l*54.5%
times-frac85.7%
+-commutative85.7%
+-commutative85.7%
associate-+r+85.7%
+-commutative85.7%
associate-+l+85.7%
Applied egg-rr85.7%
frac-times54.5%
*-commutative54.5%
+-commutative54.5%
+-commutative54.5%
associate-+r+54.5%
+-commutative54.5%
Applied egg-rr54.5%
*-commutative54.5%
times-frac85.7%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around 0 86.9%
if -1.3999999999999999e49 < x Initial program 69.7%
associate-/l*86.0%
associate-+l+86.0%
Simplified86.0%
*-un-lft-identity86.0%
associate-+r+86.0%
associate-*l*86.0%
times-frac95.6%
+-commutative95.6%
+-commutative95.6%
associate-+r+95.6%
+-commutative95.6%
associate-+l+95.6%
Applied egg-rr95.6%
associate-*l/95.7%
*-lft-identity95.7%
+-commutative95.7%
Simplified95.7%
Final simplification94.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.35e+154) (* (/ (/ x (+ x y)) (+ x (+ y 1.0))) (/ y x)) (* (/ y (+ x y)) (/ x (* (+ x y) (+ y (+ x 1.0)))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.35d+154)) then
tmp = ((x / (x + y)) / (x + (y + 1.0d0))) * (y / x)
else
tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0d0))))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.35e+154: tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x) else: tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0)))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + Float64(y + 1.0))) * Float64(y / x)); else tmp = Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0))))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.35e+154)
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
else
tmp = (y / (x + y)) * (x / ((x + y) * (y + (x + 1.0))));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.35e+154], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + 1\right)} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 52.0%
*-commutative52.0%
associate-*l*52.0%
times-frac87.2%
+-commutative87.2%
+-commutative87.2%
associate-+r+87.2%
+-commutative87.2%
associate-+l+87.2%
Applied egg-rr87.2%
frac-times52.0%
*-commutative52.0%
+-commutative52.0%
+-commutative52.0%
associate-+r+52.0%
+-commutative52.0%
Applied egg-rr52.0%
*-commutative52.0%
times-frac87.2%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around 0 92.4%
if -1.35000000000000003e154 < x Initial program 68.9%
*-commutative68.9%
associate-*l*68.9%
times-frac95.3%
+-commutative95.3%
+-commutative95.3%
associate-+r+95.3%
+-commutative95.3%
associate-+l+95.3%
Applied egg-rr95.3%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (* (/ y x) (/ x (* (+ x y) (+ y (+ x 1.0))))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) * (x / ((x + y) * (y + (x + 1.0))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = (y / x) * (x / ((x + y) * (y + (x + 1.0d0))))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) * (x / ((x + y) * (y + (x + 1.0))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = (y / x) * (x / ((x + y) * (y + (x + 1.0)))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(Float64(y / x) * Float64(x / Float64(Float64(x + y) * Float64(y + 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 <= -1.75e-154)
tmp = (y / x) * (x / ((x + y) * (y + (x + 1.0))));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(N[(y / x), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $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 -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
Taylor expanded in y around 0 73.7%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
associate-/r*65.1%
+-commutative65.1%
Simplified65.1%
Final simplification67.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.6e-154) (* (/ (/ x (+ x y)) (+ x (+ y 1.0))) (/ y x)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.6e-154) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.6d-154)) then
tmp = ((x / (x + y)) / (x + (y + 1.0d0))) * (y / x)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.6e-154) {
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.6e-154: tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / 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.6e-154) tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + Float64(y + 1.0))) * Float64(y / x)); 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 <= -1.6e-154)
tmp = ((x / (x + y)) / (x + (y + 1.0))) * (y / x);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.6e-154], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $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 -1.6 \cdot 10^{-154}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + 1\right)} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.60000000000000002e-154Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
frac-times62.7%
*-commutative62.7%
+-commutative62.7%
+-commutative62.7%
associate-+r+62.7%
+-commutative62.7%
Applied egg-rr62.7%
*-commutative62.7%
times-frac90.9%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around 0 75.5%
if -1.60000000000000002e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
associate-/r*65.1%
+-commutative65.1%
Simplified65.1%
Final simplification68.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (* (/ y (+ x y)) (/ 1.0 (+ x (+ y 1.0)))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / (x + y)) * (1.0 / (x + (y + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = (y / (x + y)) * (1.0d0 / (x + (y + 1.0d0)))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / (x + y)) * (1.0 / (x + (y + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = (y / (x + y)) * (1.0 / (x + (y + 1.0))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / Float64(x + Float64(y + 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 <= -1.75e-154)
tmp = (y / (x + y)) * (1.0 / (x + (y + 1.0)));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + N[(y + 1.0), $MachinePrecision]), $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 -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
frac-times62.7%
*-commutative62.7%
+-commutative62.7%
+-commutative62.7%
associate-+r+62.7%
+-commutative62.7%
Applied egg-rr62.7%
*-commutative62.7%
times-frac90.9%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in x around inf 66.6%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
associate-/r*65.1%
+-commutative65.1%
Simplified65.1%
Final simplification65.6%
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)) (if (<= x -1.75e-154) (* y (/ 1.0 (+ x y))) (/ 1.0 (/ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -1.75e-154) {
tmp = y * (1.0 / (x + y));
} else {
tmp = 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.0d0)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-1.75d-154)) then
tmp = y * (1.0d0 / (x + y))
else
tmp = 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.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -1.75e-154) {
tmp = y * (1.0 / (x + y));
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) * (1.0 / x) elif x <= -1.75e-154: tmp = y * (1.0 / (x + y)) else: tmp = 1.0 / (y / x) 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)); elseif (x <= -1.75e-154) tmp = Float64(y * Float64(1.0 / Float64(x + y))); else tmp = Float64(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.0)
tmp = (y / x) * (1.0 / x);
elseif (x <= -1.75e-154)
tmp = y * (1.0 / (x + y));
else
tmp = 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.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.75e-154], N[(y * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $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{elif}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;y \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < -1Initial program 56.0%
*-commutative56.0%
associate-*l*56.0%
times-frac86.1%
+-commutative86.1%
+-commutative86.1%
associate-+r+86.1%
+-commutative86.1%
associate-+l+86.1%
Applied egg-rr86.1%
Taylor expanded in x around inf 74.2%
Taylor expanded in y around 0 73.8%
if -1 < x < -1.75e-154Initial program 75.1%
*-un-lft-identity75.1%
associate-*l*75.2%
times-frac75.5%
+-commutative75.5%
*-commutative75.5%
+-commutative75.5%
associate-+r+75.5%
+-commutative75.5%
associate-+l+75.5%
Applied egg-rr75.5%
Taylor expanded in y around 0 25.8%
+-commutative25.8%
Simplified25.8%
Taylor expanded in x around 0 46.2%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.6%
associate-/r*64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in y around 0 39.9%
un-div-inv39.9%
clear-num40.5%
Applied egg-rr40.5%
Final simplification48.2%
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)) (if (<= x -1.75e-154) (* y (/ 1.0 (+ x y))) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -1.75e-154) {
tmp = y * (1.0 / (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 = (y / x) * (1.0d0 / x)
else if (x <= (-1.75d-154)) then
tmp = y * (1.0d0 / (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 = (y / x) * (1.0 / x);
} else if (x <= -1.75e-154) {
tmp = y * (1.0 / (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 = (y / x) * (1.0 / x) elif x <= -1.75e-154: tmp = y * (1.0 / (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(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -1.75e-154) tmp = Float64(y * Float64(1.0 / Float64(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 = (y / x) * (1.0 / x);
elseif (x <= -1.75e-154)
tmp = y * (1.0 / (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[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.75e-154], N[(y * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;y \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 56.0%
*-commutative56.0%
associate-*l*56.0%
times-frac86.1%
+-commutative86.1%
+-commutative86.1%
associate-+r+86.1%
+-commutative86.1%
associate-+l+86.1%
Applied egg-rr86.1%
Taylor expanded in x around inf 74.2%
Taylor expanded in y around 0 73.8%
if -1 < x < -1.75e-154Initial program 75.1%
*-un-lft-identity75.1%
associate-*l*75.2%
times-frac75.5%
+-commutative75.5%
*-commutative75.5%
+-commutative75.5%
associate-+r+75.5%
+-commutative75.5%
associate-+l+75.5%
Applied egg-rr75.5%
Taylor expanded in y around 0 25.8%
+-commutative25.8%
Simplified25.8%
Taylor expanded in x around 0 46.2%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
Final simplification63.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.3e-190) (* y (/ 1.0 (+ x y))) (/ 1.0 (/ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.3e-190) {
tmp = y * (1.0 / (x + y));
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.3d-190) then
tmp = y * (1.0d0 / (x + y))
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.3e-190) {
tmp = y * (1.0 / (x + y));
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.3e-190: tmp = y * (1.0 / (x + y)) else: tmp = 1.0 / (y / x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.3e-190) tmp = Float64(y * Float64(1.0 / Float64(x + y))); else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.3e-190)
tmp = y * (1.0 / (x + y));
else
tmp = 1.0 / (y / x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.3e-190], N[(y * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-190}:\\
\;\;\;\;y \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < 3.30000000000000019e-190Initial program 64.8%
*-un-lft-identity64.8%
associate-*l*64.8%
times-frac68.4%
+-commutative68.4%
*-commutative68.4%
+-commutative68.4%
associate-+r+68.4%
+-commutative68.4%
associate-+l+68.4%
Applied egg-rr68.4%
Taylor expanded in y around 0 37.9%
+-commutative37.9%
Simplified37.9%
Taylor expanded in x around 0 33.3%
if 3.30000000000000019e-190 < y Initial program 69.9%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 62.2%
associate-/r*63.5%
+-commutative63.5%
Simplified63.5%
Taylor expanded in y around 0 34.5%
un-div-inv34.5%
clear-num35.5%
Applied egg-rr35.5%
Final simplification34.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\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.75e-154Initial program 62.7%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 67.5%
+-commutative67.5%
Simplified67.5%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) 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 <= -1.75e-154)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], 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 -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 67.5%
+-commutative67.5%
Simplified67.5%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
associate-/r*65.1%
+-commutative65.1%
Simplified65.1%
Final simplification65.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-154) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-154)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-154) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-154: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-154) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-154)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-154], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.75e-154Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac90.9%
+-commutative90.9%
+-commutative90.9%
associate-+r+90.9%
+-commutative90.9%
associate-+l+90.9%
Applied egg-rr90.9%
frac-times62.7%
*-commutative62.7%
+-commutative62.7%
+-commutative62.7%
associate-+r+62.7%
+-commutative62.7%
Applied egg-rr62.7%
*-commutative62.7%
times-frac90.9%
associate-/r*99.7%
Simplified99.7%
log1p-expm1-u99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 67.5%
associate-/r*65.9%
+-commutative65.9%
Simplified65.9%
if -1.75e-154 < x Initial program 69.0%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in x around 0 63.7%
associate-/r*65.1%
+-commutative65.1%
Simplified65.1%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 (/ y x)))
assert(x < y);
double code(double x, double y) {
return 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 = 1.0d0 / (y / x)
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / (y / x);
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / (y / x)
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / Float64(y / x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / (y / x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 67.0%
associate-/l*84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in x around 0 53.9%
associate-/r*54.6%
+-commutative54.6%
Simplified54.6%
Taylor expanded in y around 0 29.2%
un-div-inv29.2%
clear-num29.6%
Applied egg-rr29.6%
Final simplification29.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 y))
assert(x < y);
double code(double x, double y) {
return 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 = 1.0d0 / y
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / y;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / y
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y}
\end{array}
Initial program 67.0%
*-commutative67.0%
associate-*l*67.0%
times-frac94.3%
+-commutative94.3%
+-commutative94.3%
associate-+r+94.3%
+-commutative94.3%
associate-+l+94.3%
Applied egg-rr94.3%
frac-times67.0%
*-commutative67.0%
+-commutative67.0%
+-commutative67.0%
associate-+r+67.0%
+-commutative67.0%
Applied egg-rr67.0%
*-commutative67.0%
times-frac94.3%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 55.0%
Taylor expanded in y around inf 4.1%
Final simplification4.1%
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 67.0%
associate-/l*84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in x around 0 54.0%
Taylor expanded in y around 0 29.2%
Final simplification29.2%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024067
(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))))