
(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 15 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)) (+ y (+ x 1.0))) (/ x (+ y x))))
assert(x < y);
double code(double x, double y) {
return ((y / (y + x)) / (y + (x + 1.0))) * (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)) / (y + (x + 1.0d0))) * (x / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + x)) / (y + (x + 1.0))) * (x / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + x)) / (y + (x + 1.0))) * (x / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + Float64(x + 1.0))) * Float64(x / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + x)) / (y + (x + 1.0))) * (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 + x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{y + \left(x + 1\right)} \cdot \frac{x}{y + x}
\end{array}
Initial program 73.8%
associate-*l*73.8%
times-frac95.1%
+-commutative95.1%
+-commutative95.1%
associate-+r+95.1%
+-commutative95.1%
associate-+l+95.1%
Applied egg-rr95.1%
*-commutative95.1%
associate-/r*99.8%
clear-num99.7%
frac-times99.8%
+-commutative99.8%
Applied egg-rr99.8%
*-rgt-identity99.8%
associate-/l*99.7%
div-inv99.8%
times-frac99.7%
clear-num99.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 1.0))))
(if (<= y 1.15e-86)
(/ (/ y x) t_0)
(if (or (<= y 4.1e-25) (not (<= y 0.0066)))
(* (/ x (+ y x)) (/ 1.0 t_0))
(/ y (* x (+ x 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.15e-86) {
tmp = (y / x) / t_0;
} else if ((y <= 4.1e-25) || !(y <= 0.0066)) {
tmp = (x / (y + x)) * (1.0 / t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 1.15d-86) then
tmp = (y / x) / t_0
else if ((y <= 4.1d-25) .or. (.not. (y <= 0.0066d0))) then
tmp = (x / (y + x)) * (1.0d0 / t_0)
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 t_0 = y + (x + 1.0);
double tmp;
if (y <= 1.15e-86) {
tmp = (y / x) / t_0;
} else if ((y <= 4.1e-25) || !(y <= 0.0066)) {
tmp = (x / (y + x)) * (1.0 / t_0);
} else {
tmp = y / (x * (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 1.15e-86: tmp = (y / x) / t_0 elif (y <= 4.1e-25) or not (y <= 0.0066): tmp = (x / (y + x)) * (1.0 / t_0) else: tmp = y / (x * (x + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 1.15e-86) tmp = Float64(Float64(y / x) / t_0); elseif ((y <= 4.1e-25) || !(y <= 0.0066)) tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 / t_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)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 1.15e-86)
tmp = (y / x) / t_0;
elseif ((y <= 4.1e-25) || ~((y <= 0.0066)))
tmp = (x / (y + x)) * (1.0 / t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.15e-86], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[Or[LessEqual[y, 4.1e-25], N[Not[LessEqual[y, 0.0066]], $MachinePrecision]], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$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}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-25} \lor \neg \left(y \leq 0.0066\right):\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if y < 1.14999999999999998e-86Initial program 74.8%
associate-/l*85.6%
associate-+l+85.6%
Simplified85.6%
associate-*r/74.8%
associate-+r+74.8%
associate-/r*77.5%
clear-num77.2%
associate-+r+77.2%
+-commutative77.2%
associate-+l+77.2%
*-commutative77.2%
associate-/l*89.7%
pow289.7%
+-commutative89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 57.1%
*-un-lft-identity57.1%
clear-num57.4%
un-div-inv57.5%
+-commutative57.5%
Applied egg-rr57.5%
*-lft-identity57.5%
Simplified57.5%
if 1.14999999999999998e-86 < y < 4.09999999999999987e-25 or 0.0066 < y Initial program 72.2%
associate-*l*72.2%
times-frac94.7%
+-commutative94.7%
+-commutative94.7%
associate-+r+94.7%
+-commutative94.7%
associate-+l+94.7%
Applied egg-rr94.7%
*-commutative94.7%
associate-/r*99.8%
clear-num99.7%
frac-times99.7%
+-commutative99.7%
Applied egg-rr99.7%
*-rgt-identity99.7%
associate-/l*99.6%
div-inv99.7%
times-frac99.7%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 72.9%
if 4.09999999999999987e-25 < y < 0.0066Initial program 56.7%
associate-/l*56.7%
associate-+l+56.7%
Simplified56.7%
Taylor expanded in y around 0 100.0%
Final simplification62.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 3.8e-156)
(/ (/ y x) t_0)
(if (<= y 3.9e+112)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(* (/ x (+ y x)) (/ 1.0 t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 3.8e-156) {
tmp = (y / x) / t_0;
} else if (y <= 3.9e+112) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / (y + x)) * (1.0 / t_0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 3.8d-156) then
tmp = (y / x) / t_0
else if (y <= 3.9d+112) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = (x / (y + x)) * (1.0d0 / t_0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 3.8e-156) {
tmp = (y / x) / t_0;
} else if (y <= 3.9e+112) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / (y + x)) * (1.0 / t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 3.8e-156: tmp = (y / x) / t_0 elif y <= 3.9e+112: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = (x / (y + x)) * (1.0 / t_0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 3.8e-156) tmp = Float64(Float64(y / x) / t_0); elseif (y <= 3.9e+112) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 / t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 3.8e-156)
tmp = (y / x) / t_0;
elseif (y <= 3.9e+112)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = (x / (y + x)) * (1.0 / t_0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.8e-156], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 3.9e+112], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 3.8 \cdot 10^{-156}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+112}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{1}{t\_0}\\
\end{array}
\end{array}
if y < 3.80000000000000008e-156Initial program 74.0%
associate-/l*85.0%
associate-+l+85.0%
Simplified85.0%
associate-*r/74.0%
associate-+r+74.0%
associate-/r*76.7%
clear-num76.4%
associate-+r+76.4%
+-commutative76.4%
associate-+l+76.4%
*-commutative76.4%
associate-/l*89.2%
pow289.2%
+-commutative89.2%
Applied egg-rr89.2%
Taylor expanded in x around inf 55.7%
*-un-lft-identity55.7%
clear-num56.0%
un-div-inv56.1%
+-commutative56.1%
Applied egg-rr56.1%
*-lft-identity56.1%
Simplified56.1%
if 3.80000000000000008e-156 < y < 3.89999999999999968e112Initial program 75.9%
associate-/l*83.7%
associate-+l+83.7%
Simplified83.7%
if 3.89999999999999968e112 < y Initial program 69.9%
associate-*l*69.9%
times-frac94.6%
+-commutative94.6%
+-commutative94.6%
associate-+r+94.6%
+-commutative94.6%
associate-+l+94.6%
Applied egg-rr94.6%
*-commutative94.6%
associate-/r*99.9%
clear-num99.9%
frac-times99.9%
+-commutative99.9%
Applied egg-rr99.9%
*-rgt-identity99.9%
associate-/l*99.9%
div-inv99.9%
times-frac99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 89.6%
Final simplification66.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.1e-86)
(/ (/ y x) (+ y (+ x 1.0)))
(if (or (<= y 5e-25) (not (<= y 0.00052)))
(* (/ x (+ y x)) (/ 1.0 (+ y 1.0)))
(/ y (* x (+ x 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.1e-86) {
tmp = (y / x) / (y + (x + 1.0));
} else if ((y <= 5e-25) || !(y <= 0.00052)) {
tmp = (x / (y + x)) * (1.0 / (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 (y <= 1.1d-86) then
tmp = (y / x) / (y + (x + 1.0d0))
else if ((y <= 5d-25) .or. (.not. (y <= 0.00052d0))) then
tmp = (x / (y + x)) * (1.0d0 / (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 (y <= 1.1e-86) {
tmp = (y / x) / (y + (x + 1.0));
} else if ((y <= 5e-25) || !(y <= 0.00052)) {
tmp = (x / (y + x)) * (1.0 / (y + 1.0));
} else {
tmp = y / (x * (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.1e-86: tmp = (y / x) / (y + (x + 1.0)) elif (y <= 5e-25) or not (y <= 0.00052): tmp = (x / (y + x)) * (1.0 / (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 (y <= 1.1e-86) tmp = Float64(Float64(y / x) / Float64(y + Float64(x + 1.0))); elseif ((y <= 5e-25) || !(y <= 0.00052)) tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 / 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 (y <= 1.1e-86)
tmp = (y / x) / (y + (x + 1.0));
elseif ((y <= 5e-25) || ~((y <= 0.00052)))
tmp = (x / (y + x)) * (1.0 / (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[y, 1.1e-86], N[(N[(y / x), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5e-25], N[Not[LessEqual[y, 0.00052]], $MachinePrecision]], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $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}\;y \leq 1.1 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + \left(x + 1\right)}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-25} \lor \neg \left(y \leq 0.00052\right):\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{1}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if y < 1.1000000000000001e-86Initial program 74.8%
associate-/l*85.6%
associate-+l+85.6%
Simplified85.6%
associate-*r/74.8%
associate-+r+74.8%
associate-/r*77.5%
clear-num77.2%
associate-+r+77.2%
+-commutative77.2%
associate-+l+77.2%
*-commutative77.2%
associate-/l*89.7%
pow289.7%
+-commutative89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 57.1%
*-un-lft-identity57.1%
clear-num57.4%
un-div-inv57.5%
+-commutative57.5%
Applied egg-rr57.5%
*-lft-identity57.5%
Simplified57.5%
if 1.1000000000000001e-86 < y < 4.99999999999999962e-25 or 5.19999999999999954e-4 < y Initial program 71.4%
associate-*l*71.4%
times-frac94.8%
+-commutative94.8%
+-commutative94.8%
associate-+r+94.8%
+-commutative94.8%
associate-+l+94.8%
Applied egg-rr94.8%
Taylor expanded in x around 0 71.6%
+-commutative71.6%
Simplified71.6%
if 4.99999999999999962e-25 < y < 5.19999999999999954e-4Initial program 71.0%
associate-/l*71.0%
associate-+l+71.0%
Simplified71.0%
Taylor expanded in y around 0 100.0%
Final simplification62.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (+ x 1.0)))))
(if (<= y 4.8e-88)
t_0
(if (<= y 4.5e-25)
(/ x y)
(if (<= y 0.00062) t_0 (/ x (* y (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (y <= 4.8e-88) {
tmp = t_0;
} else if (y <= 4.5e-25) {
tmp = x / y;
} else if (y <= 0.00062) {
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 * (x + 1.0d0))
if (y <= 4.8d-88) then
tmp = t_0
else if (y <= 4.5d-25) then
tmp = x / y
else if (y <= 0.00062d0) 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 * (x + 1.0));
double tmp;
if (y <= 4.8e-88) {
tmp = t_0;
} else if (y <= 4.5e-25) {
tmp = x / y;
} else if (y <= 0.00062) {
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 * (x + 1.0)) tmp = 0 if y <= 4.8e-88: tmp = t_0 elif y <= 4.5e-25: tmp = x / y elif y <= 0.00062: tmp = t_0 else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * Float64(x + 1.0))) tmp = 0.0 if (y <= 4.8e-88) tmp = t_0; elseif (y <= 4.5e-25) tmp = Float64(x / y); elseif (y <= 0.00062) 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 * (x + 1.0));
tmp = 0.0;
if (y <= 4.8e-88)
tmp = t_0;
elseif (y <= 4.5e-25)
tmp = x / y;
elseif (y <= 0.00062)
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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.8e-88], t$95$0, If[LessEqual[y, 4.5e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.00062], 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 \left(x + 1\right)}\\
\mathbf{if}\;y \leq 4.8 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 0.00062:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.7999999999999999e-88 or 4.5000000000000001e-25 < y < 6.2e-4Initial program 74.8%
associate-/l*85.4%
associate-+l+85.4%
Simplified85.4%
Taylor expanded in y around 0 56.8%
if 4.7999999999999999e-88 < y < 4.5000000000000001e-25Initial program 85.7%
associate-/l*91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in y around 0 62.5%
if 6.2e-4 < y Initial program 69.1%
associate-/l*82.9%
associate-+l+82.9%
Simplified82.9%
Taylor expanded in x around 0 72.6%
+-commutative72.6%
Simplified72.6%
Final simplification61.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (+ x 1.0)))))
(if (<= y 1.15e-86)
t_0
(if (<= y 3.8e-25)
(/ x y)
(if (<= y 0.000125) t_0 (/ (/ x y) (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (y <= 1.15e-86) {
tmp = t_0;
} else if (y <= 3.8e-25) {
tmp = x / y;
} else if (y <= 0.000125) {
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 * (x + 1.0d0))
if (y <= 1.15d-86) then
tmp = t_0
else if (y <= 3.8d-25) then
tmp = x / y
else if (y <= 0.000125d0) 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 * (x + 1.0));
double tmp;
if (y <= 1.15e-86) {
tmp = t_0;
} else if (y <= 3.8e-25) {
tmp = x / y;
} else if (y <= 0.000125) {
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 * (x + 1.0)) tmp = 0 if y <= 1.15e-86: tmp = t_0 elif y <= 3.8e-25: tmp = x / y elif y <= 0.000125: tmp = t_0 else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * Float64(x + 1.0))) tmp = 0.0 if (y <= 1.15e-86) tmp = t_0; elseif (y <= 3.8e-25) tmp = Float64(x / y); elseif (y <= 0.000125) tmp = t_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)
t_0 = y / (x * (x + 1.0));
tmp = 0.0;
if (y <= 1.15e-86)
tmp = t_0;
elseif (y <= 3.8e-25)
tmp = x / y;
elseif (y <= 0.000125)
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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.15e-86], t$95$0, If[LessEqual[y, 3.8e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.000125], t$95$0, 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 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 0.000125:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.14999999999999998e-86 or 3.7999999999999998e-25 < y < 1.25e-4Initial program 74.8%
associate-/l*85.4%
associate-+l+85.4%
Simplified85.4%
Taylor expanded in y around 0 56.8%
if 1.14999999999999998e-86 < y < 3.7999999999999998e-25Initial program 85.7%
associate-/l*91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in y around 0 62.5%
if 1.25e-4 < y Initial program 69.1%
associate-/l*82.9%
associate-+l+82.9%
Simplified82.9%
Taylor expanded in x around 0 72.5%
associate-/r*72.5%
+-commutative72.5%
Simplified72.5%
associate-*r/72.6%
un-div-inv72.7%
Applied egg-rr72.7%
Final simplification61.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.15e-86)
(/ (/ y x) (+ x 1.0))
(if (<= y 4e-25)
(/ x y)
(if (<= y 0.00078) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.15e-86) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4e-25) {
tmp = x / y;
} else if (y <= 0.00078) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.15d-86) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 4d-25) then
tmp = x / y
else if (y <= 0.00078d0) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.15e-86) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4e-25) {
tmp = x / y;
} else if (y <= 0.00078) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.15e-86: tmp = (y / x) / (x + 1.0) elif y <= 4e-25: tmp = x / y elif y <= 0.00078: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.15e-86) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 4e-25) tmp = Float64(x / y); elseif (y <= 0.00078) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.15e-86)
tmp = (y / x) / (x + 1.0);
elseif (y <= 4e-25)
tmp = x / y;
elseif (y <= 0.00078)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.15e-86], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.00078], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 0.00078:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.14999999999999998e-86Initial program 74.8%
associate-/l*85.6%
associate-+l+85.6%
Simplified85.6%
Taylor expanded in y around 0 56.1%
associate-/r*57.3%
+-commutative57.3%
Simplified57.3%
if 1.14999999999999998e-86 < y < 4.00000000000000015e-25Initial program 85.7%
associate-/l*91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in y around 0 62.5%
if 4.00000000000000015e-25 < y < 7.79999999999999986e-4Initial program 71.0%
associate-/l*71.0%
associate-+l+71.0%
Simplified71.0%
Taylor expanded in y around 0 100.0%
if 7.79999999999999986e-4 < y Initial program 69.1%
associate-/l*82.9%
associate-+l+82.9%
Simplified82.9%
Taylor expanded in x around 0 72.5%
associate-/r*72.5%
+-commutative72.5%
Simplified72.5%
associate-*r/72.6%
un-div-inv72.7%
Applied egg-rr72.7%
Final simplification61.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 8e-87)
(/ (/ y x) (+ y (+ x 1.0)))
(if (<= y 3.8e-25)
(/ x y)
(if (<= y 0.0038) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 8e-87) {
tmp = (y / x) / (y + (x + 1.0));
} else if (y <= 3.8e-25) {
tmp = x / y;
} else if (y <= 0.0038) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 8d-87) then
tmp = (y / x) / (y + (x + 1.0d0))
else if (y <= 3.8d-25) then
tmp = x / y
else if (y <= 0.0038d0) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 8e-87) {
tmp = (y / x) / (y + (x + 1.0));
} else if (y <= 3.8e-25) {
tmp = x / y;
} else if (y <= 0.0038) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 8e-87: tmp = (y / x) / (y + (x + 1.0)) elif y <= 3.8e-25: tmp = x / y elif y <= 0.0038: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 8e-87) tmp = Float64(Float64(y / x) / Float64(y + Float64(x + 1.0))); elseif (y <= 3.8e-25) tmp = Float64(x / y); elseif (y <= 0.0038) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 8e-87)
tmp = (y / x) / (y + (x + 1.0));
elseif (y <= 3.8e-25)
tmp = x / y;
elseif (y <= 0.0038)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 8e-87], N[(N[(y / x), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.0038], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + \left(x + 1\right)}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 0.0038:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 8.00000000000000014e-87Initial program 74.8%
associate-/l*85.6%
associate-+l+85.6%
Simplified85.6%
associate-*r/74.8%
associate-+r+74.8%
associate-/r*77.5%
clear-num77.2%
associate-+r+77.2%
+-commutative77.2%
associate-+l+77.2%
*-commutative77.2%
associate-/l*89.7%
pow289.7%
+-commutative89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 57.1%
*-un-lft-identity57.1%
clear-num57.4%
un-div-inv57.5%
+-commutative57.5%
Applied egg-rr57.5%
*-lft-identity57.5%
Simplified57.5%
if 8.00000000000000014e-87 < y < 3.7999999999999998e-25Initial program 85.7%
associate-/l*91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in y around 0 62.5%
if 3.7999999999999998e-25 < y < 0.00379999999999999999Initial program 56.7%
associate-/l*56.7%
associate-+l+56.7%
Simplified56.7%
Taylor expanded in y around 0 100.0%
if 0.00379999999999999999 < y Initial program 69.9%
associate-/l*83.9%
associate-+l+83.9%
Simplified83.9%
Taylor expanded in x around 0 73.6%
associate-/r*73.6%
+-commutative73.6%
Simplified73.6%
associate-*r/73.7%
un-div-inv73.7%
Applied egg-rr73.7%
Final simplification62.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (let* ((t_0 (/ x (+ y x))) (t_1 (+ y (+ x 1.0)))) (if (<= x -9e+157) (* t_0 (/ (/ y x) t_1)) (* t_0 (/ y (* (+ y x) t_1))))))
assert(x < y);
double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = y + (x + 1.0);
double tmp;
if (x <= -9e+157) {
tmp = t_0 * ((y / x) / t_1);
} else {
tmp = t_0 * (y / ((y + x) * t_1));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y + x)
t_1 = y + (x + 1.0d0)
if (x <= (-9d+157)) then
tmp = t_0 * ((y / x) / t_1)
else
tmp = t_0 * (y / ((y + x) * t_1))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = y + (x + 1.0);
double tmp;
if (x <= -9e+157) {
tmp = t_0 * ((y / x) / t_1);
} else {
tmp = t_0 * (y / ((y + x) * t_1));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y + x) t_1 = y + (x + 1.0) tmp = 0 if x <= -9e+157: tmp = t_0 * ((y / x) / t_1) else: tmp = t_0 * (y / ((y + x) * t_1)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y + x)) t_1 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -9e+157) tmp = Float64(t_0 * Float64(Float64(y / x) / t_1)); else tmp = Float64(t_0 * Float64(y / Float64(Float64(y + x) * t_1))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y + x);
t_1 = y + (x + 1.0);
tmp = 0.0;
if (x <= -9e+157)
tmp = t_0 * ((y / x) / t_1);
else
tmp = t_0 * (y / ((y + x) * t_1));
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 + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+157], N[(t$95$0 * N[(N[(y / x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(y / N[(N[(y + x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
t_1 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+157}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y}{x}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(y + x\right) \cdot t\_1}\\
\end{array}
\end{array}
if x < -8.9999999999999997e157Initial program 55.3%
associate-*l*55.3%
times-frac82.1%
+-commutative82.1%
+-commutative82.1%
associate-+r+82.1%
+-commutative82.1%
associate-+l+82.1%
Applied egg-rr82.1%
*-commutative82.1%
associate-/r*99.9%
clear-num99.9%
frac-times99.9%
+-commutative99.9%
Applied egg-rr99.9%
*-rgt-identity99.9%
associate-/l*99.8%
div-inv99.9%
times-frac99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 89.4%
if -8.9999999999999997e157 < x Initial program 76.3%
associate-*l*76.3%
times-frac96.9%
+-commutative96.9%
+-commutative96.9%
associate-+r+96.9%
+-commutative96.9%
associate-+l+96.9%
Applied egg-rr96.9%
Final simplification96.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)))) (if (<= y 5.2e-87) (/ (/ y x) t_0) (* (/ y (* (+ y x) t_0)) (/ x y)))))
assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 5.2e-87) {
tmp = (y / x) / t_0;
} else {
tmp = (y / ((y + x) * t_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) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 5.2d-87) then
tmp = (y / x) / t_0
else
tmp = (y / ((y + x) * t_0)) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 5.2e-87) {
tmp = (y / x) / t_0;
} else {
tmp = (y / ((y + x) * t_0)) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 5.2e-87: tmp = (y / x) / t_0 else: tmp = (y / ((y + x) * t_0)) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 5.2e-87) tmp = Float64(Float64(y / x) / t_0); else tmp = Float64(Float64(y / Float64(Float64(y + x) * t_0)) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (y <= 5.2e-87)
tmp = (y / x) / t_0;
else
tmp = (y / ((y + x) * t_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_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.2e-87], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot t\_0} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 5.20000000000000005e-87Initial program 74.8%
associate-/l*85.6%
associate-+l+85.6%
Simplified85.6%
associate-*r/74.8%
associate-+r+74.8%
associate-/r*77.5%
clear-num77.2%
associate-+r+77.2%
+-commutative77.2%
associate-+l+77.2%
*-commutative77.2%
associate-/l*89.7%
pow289.7%
+-commutative89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 57.1%
*-un-lft-identity57.1%
clear-num57.4%
un-div-inv57.5%
+-commutative57.5%
Applied egg-rr57.5%
*-lft-identity57.5%
Simplified57.5%
if 5.20000000000000005e-87 < y Initial program 71.4%
associate-*l*71.4%
times-frac95.0%
+-commutative95.0%
+-commutative95.0%
associate-+r+95.0%
+-commutative95.0%
associate-+l+95.0%
Applied egg-rr95.0%
Taylor expanded in x around 0 78.7%
Final simplification64.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 6.2e-130) (/ y x) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 6.2e-130) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 6.2d-130) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 6.2e-130) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 6.2e-130: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 6.2e-130) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 6.2e-130)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 6.2e-130], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 6.20000000000000021e-130Initial program 74.6%
associate-/l*85.3%
associate-+l+85.3%
Simplified85.3%
Taylor expanded in y around 0 55.6%
associate-/r*56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in x around 0 35.8%
if 6.20000000000000021e-130 < y Initial program 72.2%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in x around 0 66.6%
+-commutative66.6%
Simplified66.6%
Final simplification45.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.1e-129) (/ y x) (/ 1.0 (/ y x))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.1e-129) {
tmp = y / x;
} 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 <= 2.1d-129) then
tmp = y / x
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 <= 2.1e-129) {
tmp = y / x;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.1e-129: tmp = y / x else: tmp = 1.0 / (y / x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.1e-129) tmp = Float64(y / x); 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 <= 2.1e-129)
tmp = y / x;
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, 2.1e-129], N[(y / x), $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 2.1 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < 2.1e-129Initial program 74.6%
associate-/l*85.3%
associate-+l+85.3%
Simplified85.3%
Taylor expanded in y around 0 55.6%
associate-/r*56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in x around 0 35.8%
if 2.1e-129 < y Initial program 72.2%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
associate-*r/72.2%
associate-+r+72.2%
associate-/r*82.0%
clear-num81.9%
associate-+r+81.9%
+-commutative81.9%
associate-+l+81.9%
*-commutative81.9%
associate-/l*95.1%
pow295.1%
+-commutative95.1%
Applied egg-rr95.1%
Taylor expanded in x around 0 66.4%
Taylor expanded in y around 0 31.0%
Final simplification34.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3300000.0) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3300000.0) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3300000.0d0)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3300000.0) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3300000.0: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3300000.0) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3300000.0)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -3300000.0], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3300000:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.3e6Initial program 64.9%
associate-/l*75.2%
associate-+l+75.2%
Simplified75.2%
associate-*r/64.9%
associate-+r+64.9%
associate-/r*73.6%
clear-num73.5%
associate-+r+73.5%
+-commutative73.5%
associate-+l+73.5%
*-commutative73.5%
associate-/l*87.3%
pow287.3%
+-commutative87.3%
Applied egg-rr87.3%
Taylor expanded in x around inf 73.9%
Taylor expanded in y around inf 5.6%
if -3.3e6 < x Initial program 77.4%
associate-/l*89.0%
associate-+l+89.0%
Simplified89.0%
Taylor expanded in x around 0 62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around 0 35.4%
Final simplification26.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.3e-129) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.3e-129) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.3d-129) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.3e-129) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.3e-129: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.3e-129) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.3e-129)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.3e-129], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 1.3e-129Initial program 74.6%
associate-/l*85.3%
associate-+l+85.3%
Simplified85.3%
Taylor expanded in y around 0 55.6%
associate-/r*56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in x around 0 35.8%
if 1.3e-129 < y Initial program 72.2%
associate-/l*84.3%
associate-+l+84.3%
Simplified84.3%
Taylor expanded in x around 0 66.6%
+-commutative66.6%
Simplified66.6%
Taylor expanded in y around 0 30.4%
Final simplification34.0%
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 73.8%
associate-/l*85.0%
associate-+l+85.0%
Simplified85.0%
associate-*r/73.8%
associate-+r+73.8%
associate-/r*78.8%
clear-num78.6%
associate-+r+78.6%
+-commutative78.6%
associate-+l+78.6%
*-commutative78.6%
associate-/l*91.3%
pow291.3%
+-commutative91.3%
Applied egg-rr91.3%
Taylor expanded in x around inf 49.4%
Taylor expanded in y around inf 4.1%
Final simplification4.1%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024095
(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))))