
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ y (+ y x)) (/ (/ x (+ y (+ x 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * ((x / (y + (x + 1.0d0))) / (y + x))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * ((x / (y + (x + 1.0))) / (y + x));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(x + 1\right)}}{y + x}
\end{array}
Initial program 67.9%
associate-+r+67.9%
*-commutative67.9%
frac-times87.0%
associate-*l/80.4%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= y 5.5e-280)
(* t_0 (/ 1.0 (+ x 1.0)))
(if (<= y 5.1e-17)
(* t_0 (/ x (+ y x)))
(* (* t_0 (/ 1.0 (+ y x))) (/ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (y <= 5.5e-280) {
tmp = t_0 * (1.0 / (x + 1.0));
} else if (y <= 5.1e-17) {
tmp = t_0 * (x / (y + x));
} else {
tmp = (t_0 * (1.0 / (y + x))) * (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 / (y + x)
if (y <= 5.5d-280) then
tmp = t_0 * (1.0d0 / (x + 1.0d0))
else if (y <= 5.1d-17) then
tmp = t_0 * (x / (y + x))
else
tmp = (t_0 * (1.0d0 / (y + x))) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (y <= 5.5e-280) {
tmp = t_0 * (1.0 / (x + 1.0));
} else if (y <= 5.1e-17) {
tmp = t_0 * (x / (y + x));
} else {
tmp = (t_0 * (1.0 / (y + x))) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if y <= 5.5e-280: tmp = t_0 * (1.0 / (x + 1.0)) elif y <= 5.1e-17: tmp = t_0 * (x / (y + x)) else: tmp = (t_0 * (1.0 / (y + x))) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (y <= 5.5e-280) tmp = Float64(t_0 * Float64(1.0 / Float64(x + 1.0))); elseif (y <= 5.1e-17) tmp = Float64(t_0 * Float64(x / Float64(y + x))); else tmp = Float64(Float64(t_0 * Float64(1.0 / Float64(y + x))) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (y <= 5.5e-280)
tmp = t_0 * (1.0 / (x + 1.0));
elseif (y <= 5.1e-17)
tmp = t_0 * (x / (y + x));
else
tmp = (t_0 * (1.0 / (y + x))) * (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[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.5e-280], N[(t$95$0 * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e-17], N[(t$95$0 * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;y \leq 5.5 \cdot 10^{-280}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{-17}:\\
\;\;\;\;t_0 \cdot \frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{1}{y + x}\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 5.50000000000000001e-280Initial program 70.1%
associate-+r+70.1%
*-commutative70.1%
frac-times85.6%
associate-*l/79.4%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 50.9%
+-commutative50.9%
Simplified50.9%
if 5.50000000000000001e-280 < y < 5.1000000000000003e-17Initial program 73.9%
associate-+r+73.9%
*-commutative73.9%
frac-times93.9%
associate-*l/77.6%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 75.0%
+-commutative75.0%
Simplified75.0%
Taylor expanded in y around 0 75.0%
if 5.1000000000000003e-17 < y Initial program 58.4%
associate-*l*58.4%
+-commutative58.4%
+-commutative58.4%
+-commutative58.4%
associate-*l*58.4%
*-commutative58.4%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in y around inf 76.3%
associate-/r*81.1%
div-inv81.1%
Applied egg-rr81.1%
Final simplification63.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))))
(if (<= y 5.6e-176)
(* t_0 (/ 1.0 (+ x 1.0)))
(if (<= y 13.0)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0)))
(* (* t_0 (/ 1.0 (+ y x))) (/ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (y <= 5.6e-176) {
tmp = t_0 * (1.0 / (x + 1.0));
} else if (y <= 13.0) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (t_0 * (1.0 / (y + x))) * (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 / (y + x)
if (y <= 5.6d-176) then
tmp = t_0 * (1.0d0 / (x + 1.0d0))
else if (y <= 13.0d0) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (t_0 * (1.0d0 / (y + x))) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double tmp;
if (y <= 5.6e-176) {
tmp = t_0 * (1.0 / (x + 1.0));
} else if (y <= 13.0) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (t_0 * (1.0 / (y + x))) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) tmp = 0 if y <= 5.6e-176: tmp = t_0 * (1.0 / (x + 1.0)) elif y <= 13.0: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (t_0 * (1.0 / (y + x))) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) tmp = 0.0 if (y <= 5.6e-176) tmp = Float64(t_0 * Float64(1.0 / Float64(x + 1.0))); elseif (y <= 13.0) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(t_0 * Float64(1.0 / Float64(y + x))) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
tmp = 0.0;
if (y <= 5.6e-176)
tmp = t_0 * (1.0 / (x + 1.0));
elseif (y <= 13.0)
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
else
tmp = (t_0 * (1.0 / (y + x))) * (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[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.6e-176], N[(t$95$0 * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 13.0], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
\mathbf{if}\;y \leq 5.6 \cdot 10^{-176}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;y \leq 13:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{1}{y + x}\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 5.6000000000000003e-176Initial program 71.3%
associate-+r+71.3%
*-commutative71.3%
frac-times86.6%
associate-*l/79.4%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 56.2%
+-commutative56.2%
Simplified56.2%
if 5.6000000000000003e-176 < y < 13Initial program 72.5%
associate-*l*72.5%
+-commutative72.5%
+-commutative72.5%
+-commutative72.5%
associate-*l*72.5%
*-commutative72.5%
times-frac92.9%
+-commutative92.9%
+-commutative92.9%
+-commutative92.9%
associate-+l+92.9%
Simplified92.9%
Taylor expanded in y around 0 90.9%
+-commutative90.9%
Simplified90.9%
if 13 < y Initial program 56.4%
associate-*l*56.4%
+-commutative56.4%
+-commutative56.4%
+-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
times-frac84.6%
+-commutative84.6%
+-commutative84.6%
+-commutative84.6%
associate-+l+84.6%
Simplified84.6%
Taylor expanded in y around inf 78.3%
associate-/r*84.3%
div-inv84.3%
Applied egg-rr84.3%
Final simplification67.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.6e-15) (* (/ y (* (+ y x) (+ y (+ x 1.0)))) (- 1.0 (/ y x))) (* (/ y (+ y x)) (/ (/ x (+ y 1.0)) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.6e-15) {
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (1.0 - (y / x));
} else {
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.6d-15)) then
tmp = (y / ((y + x) * (y + (x + 1.0d0)))) * (1.0d0 - (y / x))
else
tmp = (y / (y + x)) * ((x / (y + 1.0d0)) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.6e-15) {
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (1.0 - (y / x));
} else {
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.6e-15: tmp = (y / ((y + x) * (y + (x + 1.0)))) * (1.0 - (y / x)) else: tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.6e-15) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) * Float64(1.0 - Float64(y / x))); else tmp = Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.6e-15)
tmp = (y / ((y + x) * (y + (x + 1.0)))) * (1.0 - (y / x));
else
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.6e-15], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.6e-15Initial program 66.2%
associate-+r+66.2%
associate-*l*66.1%
times-frac88.8%
associate-+r+88.8%
+-commutative88.8%
associate-+l+88.8%
Applied egg-rr88.8%
Taylor expanded in x around inf 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
if -1.6e-15 < x Initial program 68.6%
associate-+r+68.6%
*-commutative68.6%
frac-times86.3%
associate-*l/77.2%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification84.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.4e+154) (* (/ x (+ y x)) (/ y (* (+ y x) (+ y (+ x 1.0))))) (* (* (/ y (+ y x)) (/ 1.0 (+ y x))) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.4e+154) {
tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
} else {
tmp = ((y / (y + x)) * (1.0 / (y + x))) * (x / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.4d+154) then
tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0d0))))
else
tmp = ((y / (y + x)) * (1.0d0 / (y + x))) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.4e+154) {
tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
} else {
tmp = ((y / (y + x)) * (1.0 / (y + x))) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.4e+154: tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0)))) else: tmp = ((y / (y + x)) * (1.0 / (y + x))) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.4e+154) tmp = Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))))); else tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(1.0 / Float64(y + x))) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.4e+154)
tmp = (x / (y + x)) * (y / ((y + x) * (y + (x + 1.0))));
else
tmp = ((y / (y + x)) * (1.0 / (y + x))) * (x / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.4e+154], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{y + x} \cdot \frac{1}{y + x}\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 1.4e154Initial program 71.5%
associate-+r+71.5%
associate-*l*71.4%
times-frac96.3%
associate-+r+96.3%
+-commutative96.3%
associate-+l+96.3%
Applied egg-rr96.3%
if 1.4e154 < y Initial program 44.6%
associate-*l*44.6%
+-commutative44.6%
+-commutative44.6%
+-commutative44.6%
associate-*l*44.6%
*-commutative44.6%
times-frac75.2%
+-commutative75.2%
+-commutative75.2%
+-commutative75.2%
associate-+l+75.2%
Simplified75.2%
Taylor expanded in y around inf 75.2%
associate-/r*85.9%
div-inv85.9%
Applied egg-rr85.9%
Final simplification95.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.6e-15) (* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0))) (* (/ y (+ y x)) (/ (/ x (+ y 1.0)) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.6e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.6d-15)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (y / (y + x)) * ((x / (y + 1.0d0)) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.6e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.6e-15: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.6e-15) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.6e-15)
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
else
tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.6e-15], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -1.6e-15Initial program 66.2%
associate-*l*66.1%
+-commutative66.1%
+-commutative66.1%
+-commutative66.1%
associate-*l*66.2%
*-commutative66.2%
times-frac88.8%
+-commutative88.8%
+-commutative88.8%
+-commutative88.8%
associate-+l+88.8%
Simplified88.8%
Taylor expanded in y around 0 80.2%
+-commutative80.2%
Simplified80.2%
if -1.6e-15 < x Initial program 68.6%
associate-+r+68.6%
*-commutative68.6%
frac-times86.3%
associate-*l/77.2%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification84.0%
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 (+ y x))))
(if (<= x -1.45e-15)
(/ t_1 (+ x 1.0))
(if (<= x -1.6e-279) (* t_1 t_0) (* t_0 (/ 1.0 (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = y / (y + x);
double tmp;
if (x <= -1.45e-15) {
tmp = t_1 / (x + 1.0);
} else if (x <= -1.6e-279) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * (1.0 / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y + x)
t_1 = y / (y + x)
if (x <= (-1.45d-15)) then
tmp = t_1 / (x + 1.0d0)
else if (x <= (-1.6d-279)) then
tmp = t_1 * t_0
else
tmp = t_0 * (1.0d0 / (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 + x);
double t_1 = y / (y + x);
double tmp;
if (x <= -1.45e-15) {
tmp = t_1 / (x + 1.0);
} else if (x <= -1.6e-279) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y + x) t_1 = y / (y + x) tmp = 0 if x <= -1.45e-15: tmp = t_1 / (x + 1.0) elif x <= -1.6e-279: tmp = t_1 * t_0 else: tmp = t_0 * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y + x)) t_1 = Float64(y / Float64(y + x)) tmp = 0.0 if (x <= -1.45e-15) tmp = Float64(t_1 / Float64(x + 1.0)); elseif (x <= -1.6e-279) tmp = Float64(t_1 * t_0); else tmp = Float64(t_0 * Float64(1.0 / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y + x);
t_1 = y / (y + x);
tmp = 0.0;
if (x <= -1.45e-15)
tmp = t_1 / (x + 1.0);
elseif (x <= -1.6e-279)
tmp = t_1 * t_0;
else
tmp = t_0 * (1.0 / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e-15], N[(t$95$1 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.6e-279], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$0 * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
t_1 := \frac{y}{y + x}\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-15}:\\
\;\;\;\;\frac{t_1}{x + 1}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-279}:\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if x < -1.45000000000000009e-15Initial program 66.2%
associate-+r+66.2%
*-commutative66.2%
frac-times88.8%
associate-*l/88.8%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 76.3%
+-commutative76.3%
Simplified76.3%
un-div-inv76.3%
+-commutative76.3%
Applied egg-rr76.3%
if -1.45000000000000009e-15 < x < -1.5999999999999999e-279Initial program 78.2%
associate-+r+78.2%
*-commutative78.2%
frac-times90.1%
associate-*l/79.6%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 74.9%
if -1.5999999999999999e-279 < x Initial program 63.8%
associate-+r+63.8%
associate-*l*63.8%
times-frac93.2%
associate-+r+93.2%
+-commutative93.2%
associate-+l+93.2%
Applied egg-rr93.2%
Taylor expanded in x around 0 56.8%
+-commutative56.8%
Simplified56.8%
Final simplification66.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.65e-102) (/ y (* x (+ x 1.0))) (if (<= y 1.25e+74) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.65e-102) {
tmp = y / (x * (x + 1.0));
} else if (y <= 1.25e+74) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.65d-102) then
tmp = y / (x * (x + 1.0d0))
else if (y <= 1.25d+74) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (x / y) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.65e-102) {
tmp = y / (x * (x + 1.0));
} else if (y <= 1.25e+74) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.65e-102: tmp = y / (x * (x + 1.0)) elif y <= 1.25e+74: tmp = x / (y * (y + 1.0)) else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.65e-102) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif (y <= 1.25e+74) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.65e-102)
tmp = y / (x * (x + 1.0));
elseif (y <= 1.25e+74)
tmp = x / (y * (y + 1.0));
else
tmp = (x / y) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.65e-102], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+74], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+74}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 1.65e-102Initial program 71.4%
associate-*l*71.3%
+-commutative71.3%
+-commutative71.3%
+-commutative71.3%
associate-*l*71.4%
*-commutative71.4%
times-frac86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l+86.3%
Simplified86.3%
Taylor expanded in y around 0 56.2%
+-commutative56.2%
Simplified56.2%
if 1.65e-102 < y < 1.24999999999999991e74Initial program 77.4%
associate-*l*77.3%
+-commutative77.3%
+-commutative77.3%
+-commutative77.3%
associate-*l*77.4%
*-commutative77.4%
times-frac98.5%
+-commutative98.5%
+-commutative98.5%
+-commutative98.5%
associate-+l+98.5%
Simplified98.5%
Taylor expanded in x around 0 58.1%
+-commutative58.1%
Simplified58.1%
if 1.24999999999999991e74 < y Initial program 47.6%
associate-*l*47.6%
+-commutative47.6%
+-commutative47.6%
+-commutative47.6%
associate-*l*47.6%
*-commutative47.6%
times-frac80.1%
+-commutative80.1%
+-commutative80.1%
+-commutative80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 75.6%
Final simplification60.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 2.15e-117) (/ y (* x (+ x 1.0))) (/ (/ x (+ y (+ x 1.0))) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 2.15e-117) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.15d-117) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + (x + 1.0d0))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 2.15e-117) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 2.15e-117: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + (x + 1.0))) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 2.15e-117) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 2.15e-117)
tmp = y / (x * (x + 1.0));
else
tmp = (x / (y + (x + 1.0))) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 2.15e-117], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{-117}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\
\end{array}
\end{array}
if y < 2.15e-117Initial program 71.4%
associate-*l*71.4%
+-commutative71.4%
+-commutative71.4%
+-commutative71.4%
associate-*l*71.4%
*-commutative71.4%
times-frac86.1%
+-commutative86.1%
+-commutative86.1%
+-commutative86.1%
associate-+l+86.1%
Simplified86.1%
Taylor expanded in y around 0 56.0%
+-commutative56.0%
Simplified56.0%
if 2.15e-117 < y Initial program 61.2%
associate-*l*61.1%
+-commutative61.1%
+-commutative61.1%
+-commutative61.1%
associate-*l*61.2%
*-commutative61.2%
times-frac88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
associate-+l+88.7%
Simplified88.7%
Taylor expanded in y around inf 67.1%
associate-*l/67.1%
*-un-lft-identity67.1%
associate-+r+67.1%
+-commutative67.1%
associate-+r+67.1%
Applied egg-rr67.1%
Final simplification59.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.3e-102) (/ (/ y (+ y x)) (+ x 1.0)) (/ (/ x (+ y (+ x 1.0))) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.3e-102) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.3d-102) then
tmp = (y / (y + x)) / (x + 1.0d0)
else
tmp = (x / (y + (x + 1.0d0))) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.3e-102) {
tmp = (y / (y + x)) / (x + 1.0);
} else {
tmp = (x / (y + (x + 1.0))) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.3e-102: tmp = (y / (y + x)) / (x + 1.0) else: tmp = (x / (y + (x + 1.0))) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.3e-102) tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.3e-102)
tmp = (y / (y + x)) / (x + 1.0);
else
tmp = (x / (y + (x + 1.0))) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.3e-102], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-102}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\
\end{array}
\end{array}
if y < 3.3e-102Initial program 71.4%
associate-+r+71.4%
*-commutative71.4%
frac-times86.3%
associate-*l/79.0%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 57.3%
+-commutative57.3%
Simplified57.3%
un-div-inv57.3%
+-commutative57.3%
Applied egg-rr57.3%
if 3.3e-102 < y Initial program 60.9%
associate-*l*60.9%
+-commutative60.9%
+-commutative60.9%
+-commutative60.9%
associate-*l*60.9%
*-commutative60.9%
times-frac88.3%
+-commutative88.3%
+-commutative88.3%
+-commutative88.3%
associate-+l+88.3%
Simplified88.3%
Taylor expanded in y around inf 68.1%
associate-*l/68.1%
*-un-lft-identity68.1%
associate-+r+68.1%
+-commutative68.1%
associate-+r+68.1%
Applied egg-rr68.1%
Final simplification60.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 0.76) (- (/ x y) x) (* (/ x y) (/ 1.0 y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.76d0) then
tmp = (x / y) - x
else
tmp = (x / y) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 0.76: tmp = (x / y) - x else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 0.76) tmp = Float64(Float64(x / y) - x); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 0.76)
tmp = (x / y) - x;
else
tmp = (x / y) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 0.76], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 0.76000000000000001Initial program 71.6%
associate-*l*71.5%
+-commutative71.5%
+-commutative71.5%
+-commutative71.5%
associate-*l*71.6%
*-commutative71.6%
times-frac87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
associate-+l+87.9%
Simplified87.9%
Taylor expanded in x around 0 44.7%
+-commutative44.7%
Simplified44.7%
Taylor expanded in y around 0 18.9%
neg-mul-118.9%
+-commutative18.9%
unsub-neg18.9%
Simplified18.9%
if 0.76000000000000001 < y Initial program 56.4%
associate-*l*56.4%
+-commutative56.4%
+-commutative56.4%
+-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
times-frac84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in y around inf 74.6%
Taylor expanded in y around inf 73.2%
Final simplification32.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 5e+55) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 5e+55) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5d+55) then
tmp = x / (y * (y + 1.0d0))
else
tmp = (x / y) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 5e+55) {
tmp = x / (y * (y + 1.0));
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 5e+55: tmp = x / (y * (y + 1.0)) else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 5e+55) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 5e+55)
tmp = x / (y * (y + 1.0));
else
tmp = (x / y) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 5e+55], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 5.00000000000000046e55Initial program 72.2%
associate-*l*72.2%
+-commutative72.2%
+-commutative72.2%
+-commutative72.2%
associate-*l*72.2%
*-commutative72.2%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in x around 0 46.0%
+-commutative46.0%
Simplified46.0%
if 5.00000000000000046e55 < y Initial program 49.8%
associate-*l*49.8%
+-commutative49.8%
+-commutative49.8%
+-commutative49.8%
associate-*l*49.8%
*-commutative49.8%
times-frac80.9%
+-commutative80.9%
+-commutative80.9%
+-commutative80.9%
associate-+l+80.9%
Simplified80.9%
Taylor expanded in y around inf 77.0%
Taylor expanded in y around inf 76.6%
Final simplification51.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.35e-102) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.35e-102) {
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 <= 3.35d-102) 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 <= 3.35e-102) {
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 <= 3.35e-102: 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 <= 3.35e-102) 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 <= 3.35e-102)
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, 3.35e-102], 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 3.35 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.35e-102Initial program 71.4%
associate-*l*71.3%
+-commutative71.3%
+-commutative71.3%
+-commutative71.3%
associate-*l*71.4%
*-commutative71.4%
times-frac86.3%
+-commutative86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l+86.3%
Simplified86.3%
Taylor expanded in y around 0 56.2%
+-commutative56.2%
Simplified56.2%
if 3.35e-102 < y Initial program 60.9%
associate-+r+60.9%
*-commutative60.9%
frac-times88.3%
associate-*l/83.3%
times-frac99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
div-inv99.6%
+-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 65.8%
associate-/r*67.7%
+-commutative67.7%
Simplified67.7%
Final simplification60.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.5e-6) (/ 1.0 (+ x 1.0)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.5e-6) {
tmp = 1.0 / (x + 1.0);
} 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 <= (-3.5d-6)) then
tmp = 1.0d0 / (x + 1.0d0)
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 <= -3.5e-6) {
tmp = 1.0 / (x + 1.0);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.5e-6: tmp = 1.0 / (x + 1.0) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.5e-6) tmp = Float64(1.0 / Float64(x + 1.0)); 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 <= -3.5e-6)
tmp = 1.0 / (x + 1.0);
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, -3.5e-6], N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.49999999999999995e-6Initial program 65.2%
associate-+r+65.2%
*-commutative65.2%
frac-times88.5%
associate-*l/88.5%
times-frac99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in y around inf 6.2%
+-commutative6.2%
Simplified6.2%
if -3.49999999999999995e-6 < x Initial program 68.9%
associate-*l*68.9%
+-commutative68.9%
+-commutative68.9%
+-commutative68.9%
associate-*l*68.9%
*-commutative68.9%
times-frac86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
associate-+l+86.4%
Simplified86.4%
Taylor expanded in x around 0 61.8%
+-commutative61.8%
Simplified61.8%
Taylor expanded in y around 0 36.8%
Final simplification28.5%
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.9%
associate-*l*67.9%
+-commutative67.9%
+-commutative67.9%
+-commutative67.9%
associate-*l*67.9%
*-commutative67.9%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
+-commutative87.0%
associate-+l+87.0%
Simplified87.0%
Taylor expanded in y around inf 52.0%
Taylor expanded in x 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.9%
associate-*l*67.9%
+-commutative67.9%
+-commutative67.9%
+-commutative67.9%
associate-*l*67.9%
*-commutative67.9%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
+-commutative87.0%
associate-+l+87.0%
Simplified87.0%
Taylor expanded in x around 0 51.2%
+-commutative51.2%
Simplified51.2%
Taylor expanded in y around 0 27.5%
Final simplification27.5%
(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 2023332
(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))))