
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ x y)) (/ (/ y (+ x (+ y 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) * ((y / (x + (y + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}
\end{array}
Initial program 74.1%
times-frac89.3%
associate-+r+89.3%
associate-*l/86.0%
times-frac99.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 (/ x (* (+ x y) (+ y (+ x (+ x 1.0)))))))
(if (<= y 3.4e-74)
(/ (/ y (+ x (+ y 1.0))) (+ x y))
(if (<= y 1.4e-7)
t_0
(if (<= y 0.29)
(/ y (* x x))
(if (<= y 2.25e+136) t_0 (* (/ x (+ x y)) (/ 1.0 (+ x y)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
double tmp;
if (y <= 3.4e-74) {
tmp = (y / (x + (y + 1.0))) / (x + y);
} else if (y <= 1.4e-7) {
tmp = t_0;
} else if (y <= 0.29) {
tmp = y / (x * x);
} else if (y <= 2.25e+136) {
tmp = t_0;
} else {
tmp = (x / (x + y)) * (1.0 / (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / ((x + y) * (y + (x + (x + 1.0d0))))
if (y <= 3.4d-74) then
tmp = (y / (x + (y + 1.0d0))) / (x + y)
else if (y <= 1.4d-7) then
tmp = t_0
else if (y <= 0.29d0) then
tmp = y / (x * x)
else if (y <= 2.25d+136) then
tmp = t_0
else
tmp = (x / (x + y)) * (1.0d0 / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
double tmp;
if (y <= 3.4e-74) {
tmp = (y / (x + (y + 1.0))) / (x + y);
} else if (y <= 1.4e-7) {
tmp = t_0;
} else if (y <= 0.29) {
tmp = y / (x * x);
} else if (y <= 2.25e+136) {
tmp = t_0;
} else {
tmp = (x / (x + y)) * (1.0 / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / ((x + y) * (y + (x + (x + 1.0)))) tmp = 0 if y <= 3.4e-74: tmp = (y / (x + (y + 1.0))) / (x + y) elif y <= 1.4e-7: tmp = t_0 elif y <= 0.29: tmp = y / (x * x) elif y <= 2.25e+136: tmp = t_0 else: tmp = (x / (x + y)) * (1.0 / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + Float64(x + 1.0))))) tmp = 0.0 if (y <= 3.4e-74) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y)); elseif (y <= 1.4e-7) tmp = t_0; elseif (y <= 0.29) tmp = Float64(y / Float64(x * x)); elseif (y <= 2.25e+136) tmp = t_0; else tmp = Float64(Float64(x / Float64(x + y)) * Float64(1.0 / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
tmp = 0.0;
if (y <= 3.4e-74)
tmp = (y / (x + (y + 1.0))) / (x + y);
elseif (y <= 1.4e-7)
tmp = t_0;
elseif (y <= 0.29)
tmp = y / (x * x);
elseif (y <= 2.25e+136)
tmp = t_0;
else
tmp = (x / (x + y)) * (1.0 / (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.4e-74], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-7], t$95$0, If[LessEqual[y, 0.29], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+136], t$95$0, N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{-74}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 0.29:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+136}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{1}{x + y}\\
\end{array}
\end{array}
if y < 3.4000000000000001e-74Initial program 75.6%
times-frac90.0%
/-rgt-identity90.0%
associate-/l/90.0%
*-lft-identity90.0%
associate-+l+90.0%
Simplified90.0%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 69.0%
*-commutative69.0%
div-inv69.0%
+-commutative69.0%
Applied egg-rr69.0%
if 3.4000000000000001e-74 < y < 1.4000000000000001e-7 or 0.28999999999999998 < y < 2.25e136Initial program 84.3%
times-frac96.7%
associate-+r+96.7%
associate-*l/96.7%
times-frac99.7%
Applied egg-rr99.7%
clear-num99.4%
frac-times92.0%
*-rgt-identity92.0%
+-commutative92.0%
div-inv91.9%
clear-num92.0%
+-commutative92.0%
+-commutative92.0%
associate-+l+92.0%
+-commutative92.0%
Applied egg-rr92.0%
Taylor expanded in y around -inf 84.5%
mul-1-neg84.5%
unsub-neg84.5%
neg-mul-184.5%
unsub-neg84.5%
distribute-lft-in84.5%
metadata-eval84.5%
neg-mul-184.5%
unsub-neg84.5%
Simplified84.5%
if 1.4000000000000001e-7 < y < 0.28999999999999998Initial program 37.1%
associate-*r/37.1%
*-commutative37.1%
distribute-rgt1-in37.1%
fma-def37.1%
cube-unmult37.6%
Simplified37.6%
Taylor expanded in x around inf 100.0%
unpow2100.0%
Simplified100.0%
if 2.25e136 < y Initial program 61.7%
times-frac79.3%
associate-+r+79.3%
associate-*l/79.3%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 86.9%
Final simplification74.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 (+ y 1.0))) (+ x y))))
(if (<= y 6.6e-73)
t_0
(if (<= y 2.9e-7)
(/ x (* (+ x y) (+ y (+ x (+ x 1.0)))))
(if (<= y 0.142) (/ y (* x x)) (* t_0 (/ x y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = (y / (x + (y + 1.0))) / (x + y);
double tmp;
if (y <= 6.6e-73) {
tmp = t_0;
} else if (y <= 2.9e-7) {
tmp = x / ((x + y) * (y + (x + (x + 1.0))));
} else if (y <= 0.142) {
tmp = y / (x * x);
} else {
tmp = 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 + (y + 1.0d0))) / (x + y)
if (y <= 6.6d-73) then
tmp = t_0
else if (y <= 2.9d-7) then
tmp = x / ((x + y) * (y + (x + (x + 1.0d0))))
else if (y <= 0.142d0) then
tmp = y / (x * x)
else
tmp = 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 + (y + 1.0))) / (x + y);
double tmp;
if (y <= 6.6e-73) {
tmp = t_0;
} else if (y <= 2.9e-7) {
tmp = x / ((x + y) * (y + (x + (x + 1.0))));
} else if (y <= 0.142) {
tmp = y / (x * x);
} else {
tmp = t_0 * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (y / (x + (y + 1.0))) / (x + y) tmp = 0 if y <= 6.6e-73: tmp = t_0 elif y <= 2.9e-7: tmp = x / ((x + y) * (y + (x + (x + 1.0)))) elif y <= 0.142: tmp = y / (x * x) else: tmp = t_0 * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y)) tmp = 0.0 if (y <= 6.6e-73) tmp = t_0; elseif (y <= 2.9e-7) tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + Float64(x + 1.0))))); elseif (y <= 0.142) tmp = Float64(y / Float64(x * x)); else tmp = Float64(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 + (y + 1.0))) / (x + y);
tmp = 0.0;
if (y <= 6.6e-73)
tmp = t_0;
elseif (y <= 2.9e-7)
tmp = x / ((x + y) * (y + (x + (x + 1.0))));
elseif (y <= 0.142)
tmp = y / (x * x);
else
tmp = 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[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.6e-73], t$95$0, If[LessEqual[y, 2.9e-7], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.142], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\
\mathbf{if}\;y \leq 6.6 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\
\mathbf{elif}\;y \leq 0.142:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 6.60000000000000007e-73Initial program 75.6%
times-frac90.0%
/-rgt-identity90.0%
associate-/l/90.0%
*-lft-identity90.0%
associate-+l+90.0%
Simplified90.0%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 69.0%
*-commutative69.0%
div-inv69.0%
+-commutative69.0%
Applied egg-rr69.0%
if 6.60000000000000007e-73 < y < 2.8999999999999998e-7Initial program 99.5%
times-frac99.3%
associate-+r+99.3%
associate-*l/99.5%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.7%
frac-times99.7%
*-rgt-identity99.7%
+-commutative99.7%
div-inv99.6%
clear-num99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around -inf 90.4%
mul-1-neg90.4%
unsub-neg90.4%
neg-mul-190.4%
unsub-neg90.4%
distribute-lft-in90.4%
metadata-eval90.4%
neg-mul-190.4%
unsub-neg90.4%
Simplified90.4%
if 2.8999999999999998e-7 < y < 0.141999999999999987Initial program 37.1%
associate-*r/37.1%
*-commutative37.1%
distribute-rgt1-in37.1%
fma-def37.1%
cube-unmult37.6%
Simplified37.6%
Taylor expanded in x around inf 100.0%
unpow2100.0%
Simplified100.0%
if 0.141999999999999987 < y Initial program 63.4%
times-frac83.6%
associate-+r+83.6%
associate-*l/83.5%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.9%
Final simplification74.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x (+ y 1.0)))))
(if (<= x -1.32e+154)
(* t_0 (/ 1.0 (+ x y)))
(if (<= x -1e-16)
(* t_0 (/ x (* (+ x y) (+ x y))))
(* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x + (y + 1.0));
double tmp;
if (x <= -1.32e+154) {
tmp = t_0 * (1.0 / (x + y));
} else if (x <= -1e-16) {
tmp = t_0 * (x / ((x + y) * (x + y)));
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (x + (y + 1.0d0))
if (x <= (-1.32d+154)) then
tmp = t_0 * (1.0d0 / (x + y))
else if (x <= (-1d-16)) then
tmp = t_0 * (x / ((x + y) * (x + y)))
else
tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (x + (y + 1.0));
double tmp;
if (x <= -1.32e+154) {
tmp = t_0 * (1.0 / (x + y));
} else if (x <= -1e-16) {
tmp = t_0 * (x / ((x + y) * (x + y)));
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x + (y + 1.0)) tmp = 0 if x <= -1.32e+154: tmp = t_0 * (1.0 / (x + y)) elif x <= -1e-16: tmp = t_0 * (x / ((x + y) * (x + y))) else: tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x + Float64(y + 1.0))) tmp = 0.0 if (x <= -1.32e+154) tmp = Float64(t_0 * Float64(1.0 / Float64(x + y))); elseif (x <= -1e-16) tmp = Float64(t_0 * Float64(x / Float64(Float64(x + y) * Float64(x + y)))); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (x + (y + 1.0));
tmp = 0.0;
if (x <= -1.32e+154)
tmp = t_0 * (1.0 / (x + y));
elseif (x <= -1e-16)
tmp = t_0 * (x / ((x + y) * (x + y)));
else
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+154], N[(t$95$0 * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1e-16], N[(t$95$0 * N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + \left(y + 1\right)}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + y}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-16}:\\
\;\;\;\;t_0 \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -1.31999999999999998e154Initial program 68.3%
times-frac86.3%
/-rgt-identity86.3%
associate-/l/86.3%
*-lft-identity86.3%
associate-+l+86.3%
Simplified86.3%
associate-/r*99.9%
div-inv99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-*r/99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 91.7%
if -1.31999999999999998e154 < x < -9.9999999999999998e-17Initial program 78.0%
times-frac92.2%
/-rgt-identity92.2%
associate-/l/92.2%
*-lft-identity92.2%
associate-+l+92.2%
Simplified92.2%
if -9.9999999999999998e-17 < x Initial program 74.7%
times-frac89.4%
associate-+r+89.4%
associate-*l/84.4%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 80.4%
+-commutative77.2%
Simplified80.4%
Final simplification84.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -30000000000.0)
(* (/ y (+ x (+ y 1.0))) (/ 1.0 x))
(if (<= x -3.3e-168)
(* (/ x (* (+ x y) (+ x y))) (/ y (+ y 1.0)))
(/ (/ x y) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -30000000000.0) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else if (x <= -3.3e-168) {
tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-30000000000.0d0)) then
tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
else if (x <= (-3.3d-168)) then
tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -30000000000.0) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else if (x <= -3.3e-168) {
tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -30000000000.0: tmp = (y / (x + (y + 1.0))) * (1.0 / x) elif x <= -3.3e-168: tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -30000000000.0) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x)); elseif (x <= -3.3e-168) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / Float64(y + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -30000000000.0)
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
elseif (x <= -3.3e-168)
tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -30000000000.0], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.3e-168], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -30000000000:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -3e10Initial program 72.1%
times-frac89.5%
/-rgt-identity89.5%
associate-/l/89.5%
*-lft-identity89.5%
associate-+l+89.5%
Simplified89.5%
Taylor expanded in x around inf 83.6%
if -3e10 < x < -3.3000000000000001e-168Initial program 86.7%
times-frac97.0%
/-rgt-identity97.0%
associate-/l/97.0%
*-lft-identity97.0%
associate-+l+97.0%
Simplified97.0%
Taylor expanded in x around 0 96.2%
+-commutative96.2%
Simplified96.2%
if -3.3000000000000001e-168 < x Initial program 72.0%
times-frac87.2%
associate-+r+87.2%
associate-*l/83.9%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times90.4%
*-rgt-identity90.4%
+-commutative90.4%
div-inv90.3%
clear-num90.4%
+-commutative90.4%
+-commutative90.4%
associate-+l+90.4%
+-commutative90.4%
Applied egg-rr90.4%
Taylor expanded in x around 0 54.1%
associate-/r*56.1%
+-commutative56.1%
Simplified56.1%
Final simplification70.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))))
(if (<= y -3.25e-202)
t_0
(if (<= y 8.6e-179)
(/ y x)
(if (<= y 1.75e-84)
t_0
(if (<= y 5.5e-10)
(- (/ x y) x)
(if (<= y 22500000000.0) t_0 (* (/ x y) (/ 1.0 y)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * x);
double tmp;
if (y <= -3.25e-202) {
tmp = t_0;
} else if (y <= 8.6e-179) {
tmp = y / x;
} else if (y <= 1.75e-84) {
tmp = t_0;
} else if (y <= 5.5e-10) {
tmp = (x / y) - x;
} else if (y <= 22500000000.0) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = y / (x * x)
if (y <= (-3.25d-202)) then
tmp = t_0
else if (y <= 8.6d-179) then
tmp = y / x
else if (y <= 1.75d-84) then
tmp = t_0
else if (y <= 5.5d-10) then
tmp = (x / y) - x
else if (y <= 22500000000.0d0) then
tmp = t_0
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 t_0 = y / (x * x);
double tmp;
if (y <= -3.25e-202) {
tmp = t_0;
} else if (y <= 8.6e-179) {
tmp = y / x;
} else if (y <= 1.75e-84) {
tmp = t_0;
} else if (y <= 5.5e-10) {
tmp = (x / y) - x;
} else if (y <= 22500000000.0) {
tmp = t_0;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x * x) tmp = 0 if y <= -3.25e-202: tmp = t_0 elif y <= 8.6e-179: tmp = y / x elif y <= 1.75e-84: tmp = t_0 elif y <= 5.5e-10: tmp = (x / y) - x elif y <= 22500000000.0: tmp = t_0 else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * x)) tmp = 0.0 if (y <= -3.25e-202) tmp = t_0; elseif (y <= 8.6e-179) tmp = Float64(y / x); elseif (y <= 1.75e-84) tmp = t_0; elseif (y <= 5.5e-10) tmp = Float64(Float64(x / y) - x); elseif (y <= 22500000000.0) tmp = t_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)
t_0 = y / (x * x);
tmp = 0.0;
if (y <= -3.25e-202)
tmp = t_0;
elseif (y <= 8.6e-179)
tmp = y / x;
elseif (y <= 1.75e-84)
tmp = t_0;
elseif (y <= 5.5e-10)
tmp = (x / y) - x;
elseif (y <= 22500000000.0)
tmp = t_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_] := Block[{t$95$0 = N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.25e-202], t$95$0, If[LessEqual[y, 8.6e-179], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.75e-84], t$95$0, If[LessEqual[y, 5.5e-10], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 22500000000.0], t$95$0, N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot x}\\
\mathbf{if}\;y \leq -3.25 \cdot 10^{-202}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-179}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{y} - x\\
\mathbf{elif}\;y \leq 22500000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < -3.24999999999999978e-202 or 8.60000000000000052e-179 < y < 1.7500000000000001e-84 or 5.4999999999999996e-10 < y < 2.25e10Initial program 76.9%
associate-*r/82.5%
*-commutative82.5%
distribute-rgt1-in52.3%
fma-def82.5%
cube-unmult82.6%
Simplified82.6%
Taylor expanded in x around inf 51.1%
unpow251.1%
Simplified51.1%
if -3.24999999999999978e-202 < y < 8.60000000000000052e-179Initial program 71.7%
times-frac84.1%
/-rgt-identity84.1%
associate-/l/84.1%
*-lft-identity84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in y around 0 89.7%
Taylor expanded in x around 0 69.9%
if 1.7500000000000001e-84 < y < 5.4999999999999996e-10Initial program 99.5%
times-frac99.2%
/-rgt-identity99.2%
associate-/l/99.2%
*-lft-identity99.2%
associate-+l+99.2%
Simplified99.2%
Taylor expanded in x around 0 49.2%
distribute-rgt-in49.2%
*-lft-identity49.2%
Simplified49.2%
Taylor expanded in y around 0 49.2%
neg-mul-149.2%
unsub-neg49.2%
Simplified49.2%
if 2.25e10 < y Initial program 62.2%
associate-*r/78.3%
*-commutative78.3%
distribute-rgt1-in72.8%
fma-def78.2%
cube-unmult78.3%
Simplified78.3%
Taylor expanded in y around inf 73.7%
unpow273.7%
Simplified73.7%
associate-/r*79.1%
div-inv79.1%
Applied egg-rr79.1%
Final simplification61.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x (+ y 1.0)))))
(if (<= x -1.32e+154)
(* t_0 (/ 1.0 (+ x y)))
(if (<= x -1.9)
(* (/ x (* (+ x y) (+ x y))) (/ y x))
(if (<= x -2.45e-55) (/ t_0 (+ x y)) (/ (/ x y) (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x + (y + 1.0));
double tmp;
if (x <= -1.32e+154) {
tmp = t_0 * (1.0 / (x + y));
} else if (x <= -1.9) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -2.45e-55) {
tmp = t_0 / (x + y);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (x + (y + 1.0d0))
if (x <= (-1.32d+154)) then
tmp = t_0 * (1.0d0 / (x + y))
else if (x <= (-1.9d0)) then
tmp = (x / ((x + y) * (x + y))) * (y / x)
else if (x <= (-2.45d-55)) then
tmp = t_0 / (x + y)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (x + (y + 1.0));
double tmp;
if (x <= -1.32e+154) {
tmp = t_0 * (1.0 / (x + y));
} else if (x <= -1.9) {
tmp = (x / ((x + y) * (x + y))) * (y / x);
} else if (x <= -2.45e-55) {
tmp = t_0 / (x + y);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x + (y + 1.0)) tmp = 0 if x <= -1.32e+154: tmp = t_0 * (1.0 / (x + y)) elif x <= -1.9: tmp = (x / ((x + y) * (x + y))) * (y / x) elif x <= -2.45e-55: tmp = t_0 / (x + y) 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(y + 1.0))) tmp = 0.0 if (x <= -1.32e+154) tmp = Float64(t_0 * Float64(1.0 / Float64(x + y))); elseif (x <= -1.9) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x)); elseif (x <= -2.45e-55) tmp = Float64(t_0 / Float64(x + y)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (x + (y + 1.0));
tmp = 0.0;
if (x <= -1.32e+154)
tmp = t_0 * (1.0 / (x + y));
elseif (x <= -1.9)
tmp = (x / ((x + y) * (x + y))) * (y / x);
elseif (x <= -2.45e-55)
tmp = t_0 / (x + y);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+154], N[(t$95$0 * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.9], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.45e-55], N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + \left(y + 1\right)}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + y}\\
\mathbf{elif}\;x \leq -1.9:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -2.45 \cdot 10^{-55}:\\
\;\;\;\;\frac{t_0}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.31999999999999998e154Initial program 68.3%
times-frac86.3%
/-rgt-identity86.3%
associate-/l/86.3%
*-lft-identity86.3%
associate-+l+86.3%
Simplified86.3%
associate-/r*99.9%
div-inv99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-*r/99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 91.7%
if -1.31999999999999998e154 < x < -1.8999999999999999Initial program 76.3%
times-frac91.7%
/-rgt-identity91.7%
associate-/l/91.7%
*-lft-identity91.7%
associate-+l+91.7%
Simplified91.7%
Taylor expanded in x around inf 82.1%
if -1.8999999999999999 < x < -2.45000000000000018e-55Initial program 91.2%
times-frac99.5%
/-rgt-identity99.5%
associate-/l/99.5%
*-lft-identity99.5%
associate-+l+99.5%
Simplified99.5%
associate-/r*99.3%
div-inv99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*r/99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in y around 0 65.2%
*-commutative65.2%
div-inv65.3%
+-commutative65.3%
Applied egg-rr65.3%
if -2.45000000000000018e-55 < x Initial program 74.0%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.2%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.7%
*-rgt-identity91.7%
+-commutative91.7%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 56.2%
associate-/r*57.9%
+-commutative57.9%
Simplified57.9%
Final simplification67.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -90000000000000.0) (* (/ y (+ x (+ y 1.0))) (/ 1.0 x)) (* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -90000000000000.0) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-90000000000000.0d0)) then
tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
else
tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -90000000000000.0) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -90000000000000.0: tmp = (y / (x + (y + 1.0))) * (1.0 / x) else: tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -90000000000000.0) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x)); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -90000000000000.0)
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
else
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -90000000000000.0], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -90000000000000:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -9e13Initial program 72.1%
times-frac89.5%
/-rgt-identity89.5%
associate-/l/89.5%
*-lft-identity89.5%
associate-+l+89.5%
Simplified89.5%
Taylor expanded in x around inf 83.6%
if -9e13 < x Initial program 75.0%
times-frac89.2%
associate-+r+89.2%
associate-*l/84.4%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 80.9%
+-commutative77.3%
Simplified80.9%
Final simplification81.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -9.5e-56) (* (/ y (+ x (+ y 1.0))) (/ 1.0 (+ x y))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -9.5e-56) {
tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9.5d-56)) then
tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / (x + y))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -9.5e-56) {
tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -9.5e-56: tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -9.5e-56) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / Float64(x + y))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -9.5e-56)
tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -9.5e-56], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-56}:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -9.4999999999999991e-56Initial program 74.6%
times-frac90.2%
/-rgt-identity90.2%
associate-/l/90.2%
*-lft-identity90.2%
associate-+l+90.2%
Simplified90.2%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 78.2%
if -9.4999999999999991e-56 < x Initial program 73.8%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.1%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.6%
*-rgt-identity91.6%
+-commutative91.6%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 55.9%
associate-/r*57.7%
+-commutative57.7%
Simplified57.7%
Final simplification65.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.8e-55) (* (/ y (+ x (+ y 1.0))) (/ 1.0 x)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.8e-55) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.8d-55)) then
tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.8e-55) {
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.8e-55: tmp = (y / (x + (y + 1.0))) * (1.0 / x) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.8e-55) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.8e-55)
tmp = (y / (x + (y + 1.0))) * (1.0 / x);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.8e-55], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.8e-55Initial program 74.6%
times-frac90.2%
/-rgt-identity90.2%
associate-/l/90.2%
*-lft-identity90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in x around inf 77.9%
if -1.8e-55 < x Initial program 73.8%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.1%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.6%
*-rgt-identity91.6%
+-commutative91.6%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 55.9%
associate-/r*57.7%
+-commutative57.7%
Simplified57.7%
Final simplification65.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.2e+14) (/ y (* x x)) (if (<= x 10500000000000.0) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.2e+14) {
tmp = y / (x * x);
} else if (x <= 10500000000000.0) {
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 (x <= (-2.2d+14)) then
tmp = y / (x * x)
else if (x <= 10500000000000.0d0) 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 (x <= -2.2e+14) {
tmp = y / (x * x);
} else if (x <= 10500000000000.0) {
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 x <= -2.2e+14: tmp = y / (x * x) elif x <= 10500000000000.0: 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 (x <= -2.2e+14) tmp = Float64(y / Float64(x * x)); elseif (x <= 10500000000000.0) 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 (x <= -2.2e+14)
tmp = y / (x * x);
elseif (x <= 10500000000000.0)
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[x, -2.2e+14], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 10500000000000.0], 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}\;x \leq -2.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq 10500000000000:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if x < -2.2e14Initial program 72.1%
associate-*r/80.2%
*-commutative80.2%
distribute-rgt1-in32.7%
fma-def80.2%
cube-unmult80.2%
Simplified80.2%
Taylor expanded in x around inf 80.4%
unpow280.4%
Simplified80.4%
if -2.2e14 < x < 1.05e13Initial program 81.4%
times-frac90.6%
/-rgt-identity90.6%
associate-/l/90.6%
*-lft-identity90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around 0 73.2%
+-commutative73.2%
Simplified73.2%
if 1.05e13 < x Initial program 64.1%
associate-*r/76.5%
*-commutative76.5%
distribute-rgt1-in73.2%
fma-def76.5%
cube-unmult76.5%
Simplified76.5%
Taylor expanded in y around inf 24.9%
unpow224.9%
Simplified24.9%
associate-/r*29.3%
div-inv29.2%
Applied egg-rr29.2%
Final simplification64.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.95e-55) (/ y (* x (+ x 1.0))) (if (<= x 2e+16) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.95e-55) {
tmp = y / (x * (x + 1.0));
} else if (x <= 2e+16) {
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 (x <= (-2.95d-55)) then
tmp = y / (x * (x + 1.0d0))
else if (x <= 2d+16) 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 (x <= -2.95e-55) {
tmp = y / (x * (x + 1.0));
} else if (x <= 2e+16) {
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 x <= -2.95e-55: tmp = y / (x * (x + 1.0)) elif x <= 2e+16: 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 (x <= -2.95e-55) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif (x <= 2e+16) 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 (x <= -2.95e-55)
tmp = y / (x * (x + 1.0));
elseif (x <= 2e+16)
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[x, -2.95e-55], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+16], 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}\;x \leq -2.95 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if x < -2.9499999999999999e-55Initial program 74.3%
times-frac90.1%
/-rgt-identity90.1%
associate-/l/90.1%
*-lft-identity90.1%
associate-+l+90.1%
Simplified90.1%
Taylor expanded in y around 0 75.9%
if -2.9499999999999999e-55 < x < 2e16Initial program 80.8%
times-frac90.3%
/-rgt-identity90.3%
associate-/l/90.3%
*-lft-identity90.3%
associate-+l+90.3%
Simplified90.3%
Taylor expanded in x around 0 76.4%
+-commutative76.4%
Simplified76.4%
if 2e16 < x Initial program 63.5%
associate-*r/76.1%
*-commutative76.1%
distribute-rgt1-in72.8%
fma-def76.1%
cube-unmult76.2%
Simplified76.2%
Taylor expanded in y around inf 25.2%
unpow225.2%
Simplified25.2%
associate-/r*29.6%
div-inv29.6%
Applied egg-rr29.6%
Final simplification64.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.9e-55) (* (/ 1.0 x) (/ y (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.9e-55) {
tmp = (1.0 / x) * (y / (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.9d-55)) then
tmp = (1.0d0 / x) * (y / (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.9e-55) {
tmp = (1.0 / x) * (y / (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.9e-55: tmp = (1.0 / x) * (y / (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.9e-55) tmp = Float64(Float64(1.0 / x) * Float64(y / Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.9e-55)
tmp = (1.0 / x) * (y / (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.9e-55], N[(N[(1.0 / x), $MachinePrecision] * N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-55}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.8999999999999998e-55Initial program 74.6%
times-frac90.2%
/-rgt-identity90.2%
associate-/l/90.2%
*-lft-identity90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in y around 0 75.1%
associate-/r*77.4%
div-inv77.4%
+-commutative77.4%
Applied egg-rr77.4%
if -1.8999999999999998e-55 < x Initial program 73.8%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.1%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.6%
*-rgt-identity91.6%
+-commutative91.6%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 55.9%
associate-/r*57.7%
+-commutative57.7%
Simplified57.7%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.28e-79) (/ y x) (if (<= y 0.75) (- (/ x y) x) (/ x (* y y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.28e-79) {
tmp = y / x;
} else if (y <= 0.75) {
tmp = (x / y) - x;
} else {
tmp = x / (y * 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.28d-79) then
tmp = y / x
else if (y <= 0.75d0) then
tmp = (x / y) - x
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.28e-79) {
tmp = y / x;
} else if (y <= 0.75) {
tmp = (x / y) - x;
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.28e-79: tmp = y / x elif y <= 0.75: tmp = (x / y) - x else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.28e-79) tmp = Float64(y / x); elseif (y <= 0.75) tmp = Float64(Float64(x / y) - x); else tmp = Float64(x / Float64(y * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.28e-79)
tmp = y / x;
elseif (y <= 0.75)
tmp = (x / y) - x;
else
tmp = x / (y * 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.28e-79], N[(y / x), $MachinePrecision], If[LessEqual[y, 0.75], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.28 \cdot 10^{-79}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;\frac{x}{y} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 1.28e-79Initial program 75.6%
times-frac90.0%
/-rgt-identity90.0%
associate-/l/90.0%
*-lft-identity90.0%
associate-+l+90.0%
Simplified90.0%
Taylor expanded in y around 0 67.6%
Taylor expanded in x around 0 35.7%
if 1.28e-79 < y < 0.75Initial program 91.3%
times-frac99.4%
/-rgt-identity99.4%
associate-/l/99.4%
*-lft-identity99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in x around 0 44.9%
distribute-rgt-in44.9%
*-lft-identity44.9%
Simplified44.9%
Taylor expanded in y around 0 44.6%
neg-mul-144.6%
unsub-neg44.6%
Simplified44.6%
if 0.75 < y Initial program 63.4%
associate-*r/78.9%
*-commutative78.9%
distribute-rgt1-in72.0%
fma-def78.9%
cube-unmult78.9%
Simplified78.9%
Taylor expanded in y around inf 71.7%
unpow271.7%
Simplified71.7%
Final simplification45.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4.7e-56) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.7e-56) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.7d-56)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4.7e-56) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.7e-56: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.7e-56) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4.7e-56)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4.7e-56], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{-56}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.7e-56Initial program 74.6%
times-frac90.2%
/-rgt-identity90.2%
associate-/l/90.2%
*-lft-identity90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in y around 0 75.1%
if -4.7e-56 < x Initial program 73.8%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.1%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.6%
*-rgt-identity91.6%
+-commutative91.6%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 55.9%
associate-/r*57.7%
+-commutative57.7%
Simplified57.7%
Final simplification64.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.65e-55) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.65e-55) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.65d-55)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.65e-55) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.65e-55: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.65e-55) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.65e-55)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.65e-55], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.65e-55Initial program 74.6%
times-frac90.2%
/-rgt-identity90.2%
associate-/l/90.2%
*-lft-identity90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in y around 0 75.1%
*-un-lft-identity75.1%
times-frac77.4%
+-commutative77.4%
Applied egg-rr77.4%
associate-*l/77.4%
*-lft-identity77.4%
+-commutative77.4%
Simplified77.4%
if -1.65e-55 < x Initial program 73.8%
times-frac88.8%
associate-+r+88.8%
associate-*l/84.1%
times-frac99.8%
Applied egg-rr99.8%
clear-num99.6%
frac-times91.6%
*-rgt-identity91.6%
+-commutative91.6%
div-inv91.6%
clear-num91.6%
+-commutative91.6%
+-commutative91.6%
associate-+l+91.6%
+-commutative91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 55.9%
associate-/r*57.7%
+-commutative57.7%
Simplified57.7%
Final simplification65.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.8e-252) (/ y x) (- (/ x y) x)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.8e-252) {
tmp = y / x;
} else {
tmp = (x / y) - x;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.8d-252)) then
tmp = y / x
else
tmp = (x / y) - x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.8e-252) {
tmp = y / x;
} else {
tmp = (x / y) - x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.8e-252: tmp = y / x else: tmp = (x / y) - x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.8e-252) tmp = Float64(y / x); else tmp = Float64(Float64(x / y) - x); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.8e-252)
tmp = y / x;
else
tmp = (x / y) - x;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7.8e-252], N[(y / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-252}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - x\\
\end{array}
\end{array}
if x < -7.7999999999999998e-252Initial program 77.2%
times-frac91.3%
/-rgt-identity91.3%
associate-/l/91.3%
*-lft-identity91.3%
associate-+l+91.3%
Simplified91.3%
Taylor expanded in y around 0 60.5%
Taylor expanded in x around 0 28.6%
if -7.7999999999999998e-252 < x Initial program 70.8%
times-frac87.2%
/-rgt-identity87.2%
associate-/l/87.2%
*-lft-identity87.2%
associate-+l+87.2%
Simplified87.2%
Taylor expanded in x around 0 49.0%
distribute-rgt-in49.0%
*-lft-identity49.0%
Simplified49.0%
Taylor expanded in y around 0 13.3%
neg-mul-113.3%
unsub-neg13.3%
Simplified13.3%
Final simplification21.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2400000000000.0) (/ y (* x x)) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2400000000000.0) {
tmp = y / (x * x);
} else {
tmp = x / (y * 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 <= (-2400000000000.0d0)) then
tmp = y / (x * x)
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2400000000000.0) {
tmp = y / (x * x);
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2400000000000.0: tmp = y / (x * x) else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2400000000000.0) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / Float64(y * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2400000000000.0)
tmp = y / (x * x);
else
tmp = x / (y * 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, -2400000000000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2400000000000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if x < -2.4e12Initial program 72.1%
associate-*r/80.2%
*-commutative80.2%
distribute-rgt1-in32.7%
fma-def80.2%
cube-unmult80.2%
Simplified80.2%
Taylor expanded in x around inf 80.4%
unpow280.4%
Simplified80.4%
if -2.4e12 < x Initial program 75.0%
associate-*r/84.4%
*-commutative84.4%
distribute-rgt1-in75.1%
fma-def84.4%
cube-unmult84.4%
Simplified84.4%
Taylor expanded in y around inf 43.1%
unpow243.1%
Simplified43.1%
Final simplification54.7%
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 74.1%
times-frac89.3%
associate-+r+89.3%
associate-*l/86.0%
times-frac99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 38.1%
Taylor expanded in x around inf 4.3%
Final simplification4.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ y x))
assert(x < y);
double code(double x, double y) {
return 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 / x
end function
assert x < y;
public static double code(double x, double y) {
return y / x;
}
[x, y] = sort([x, y]) def code(x, y): return y / x
x, y = sort([x, y]) function code(x, y) return Float64(y / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = y / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(y / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x}
\end{array}
Initial program 74.1%
times-frac89.3%
/-rgt-identity89.3%
associate-/l/89.3%
*-lft-identity89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 55.0%
Taylor expanded in x around 0 26.2%
Final simplification26.2%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2023195
(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))))