
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ x (+ x y)) (* (/ (+ x y) y) (+ y (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) / (((x + y) / y) * (y + (x + 1.0)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x + y)) / (((x + y) / y) * (y + (x + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) / (((x + y) / y) * (y + (x + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) / (((x + y) / y) * (y + (x + 1.0)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) / Float64(Float64(Float64(x + y) / y) * Float64(y + Float64(x + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) / (((x + y) / y) * (y + (x + 1.0)));
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[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(y + \left(x + 1\right)\right)}
\end{array}
Initial program 70.6%
*-commutative70.6%
associate-*l*70.7%
times-frac93.3%
+-commutative93.3%
+-commutative93.3%
associate-+r+93.3%
+-commutative93.3%
associate-+l+93.3%
Applied egg-rr93.3%
clear-num93.3%
associate-/r*99.8%
+-commutative99.8%
frac-times99.3%
*-un-lft-identity99.3%
+-commutative99.3%
+-commutative99.3%
Applied egg-rr99.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 1.0))) (t_1 (* (/ (+ x y) y) t_0)))
(if (<= y -3.3e-92)
(/ 1.0 t_1)
(if (<= y 1.5e+147)
(* (/ y (+ x y)) (/ x (* (+ x y) t_0)))
(/ (/ x y) t_1)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = ((x + y) / y) * t_0;
double tmp;
if (y <= -3.3e-92) {
tmp = 1.0 / t_1;
} else if (y <= 1.5e+147) {
tmp = (y / (x + y)) * (x / ((x + y) * t_0));
} else {
tmp = (x / y) / t_1;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y + (x + 1.0d0)
t_1 = ((x + y) / y) * t_0
if (y <= (-3.3d-92)) then
tmp = 1.0d0 / t_1
else if (y <= 1.5d+147) then
tmp = (y / (x + y)) * (x / ((x + y) * t_0))
else
tmp = (x / y) / t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = ((x + y) / y) * t_0;
double tmp;
if (y <= -3.3e-92) {
tmp = 1.0 / t_1;
} else if (y <= 1.5e+147) {
tmp = (y / (x + y)) * (x / ((x + y) * t_0));
} else {
tmp = (x / y) / t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) t_1 = ((x + y) / y) * t_0 tmp = 0 if y <= -3.3e-92: tmp = 1.0 / t_1 elif y <= 1.5e+147: tmp = (y / (x + y)) * (x / ((x + y) * t_0)) else: tmp = (x / y) / t_1 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) t_1 = Float64(Float64(Float64(x + y) / y) * t_0) tmp = 0.0 if (y <= -3.3e-92) tmp = Float64(1.0 / t_1); elseif (y <= 1.5e+147) tmp = Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(x + y) * t_0))); else tmp = Float64(Float64(x / y) / t_1); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
t_1 = ((x + y) / y) * t_0;
tmp = 0.0;
if (y <= -3.3e-92)
tmp = 1.0 / t_1;
elseif (y <= 1.5e+147)
tmp = (y / (x + y)) * (x / ((x + y) * t_0));
else
tmp = (x / y) / t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[y, -3.3e-92], N[(1.0 / t$95$1), $MachinePrecision], If[LessEqual[y, 1.5e+147], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
t_1 := \frac{x + y}{y} \cdot t\_0\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{-92}:\\
\;\;\;\;\frac{1}{t\_1}\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+147}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_1}\\
\end{array}
\end{array}
if y < -3.29999999999999998e-92Initial program 59.8%
*-commutative59.8%
associate-*l*59.8%
times-frac86.3%
+-commutative86.3%
+-commutative86.3%
associate-+r+86.3%
+-commutative86.3%
associate-+l+86.3%
Applied egg-rr86.3%
clear-num86.3%
associate-/r*99.7%
+-commutative99.7%
frac-times98.3%
*-un-lft-identity98.3%
+-commutative98.3%
+-commutative98.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 36.9%
if -3.29999999999999998e-92 < y < 1.49999999999999997e147Initial program 78.4%
*-commutative78.4%
associate-*l*78.4%
times-frac99.2%
+-commutative99.2%
+-commutative99.2%
associate-+r+99.2%
+-commutative99.2%
associate-+l+99.2%
Applied egg-rr99.2%
if 1.49999999999999997e147 < y Initial program 63.5%
*-commutative63.5%
associate-*l*63.5%
times-frac83.8%
+-commutative83.8%
+-commutative83.8%
associate-+r+83.8%
+-commutative83.8%
associate-+l+83.8%
Applied egg-rr83.8%
clear-num83.8%
associate-/r*100.0%
+-commutative100.0%
frac-times99.5%
*-un-lft-identity99.5%
+-commutative99.5%
+-commutative99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 92.8%
Final simplification77.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.2e+32)
(/ (/ (/ x t_0) (+ x y)) (/ x y))
(if (<= x -5e-165)
(* x (/ y (* (* (+ x y) (+ x y)) (+ x (+ y 1.0)))))
(/ (/ x y) (* (/ (+ x y) y) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.2e+32) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else if (x <= -5e-165) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = (x / y) / (((x + y) / y) * t_0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.2d+32)) then
tmp = ((x / t_0) / (x + y)) / (x / y)
else if (x <= (-5d-165)) then
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0d0))))
else
tmp = (x / y) / (((x + y) / y) * t_0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.2e+32) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else if (x <= -5e-165) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = (x / y) / (((x + y) / y) * t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.2e+32: tmp = ((x / t_0) / (x + y)) / (x / y) elif x <= -5e-165: tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0)))) else: tmp = (x / y) / (((x + y) / y) * t_0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.2e+32) tmp = Float64(Float64(Float64(x / t_0) / Float64(x + y)) / Float64(x / y)); elseif (x <= -5e-165) tmp = Float64(x * Float64(y / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -1.2e+32)
tmp = ((x / t_0) / (x + y)) / (x / y);
elseif (x <= -5e-165)
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
else
tmp = (x / y) / (((x + y) / y) * t_0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.2e+32], N[(N[(N[(x / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-165], N[(x * N[(y / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{\frac{\frac{x}{t\_0}}{x + y}}{\frac{x}{y}}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-165}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot t\_0}\\
\end{array}
\end{array}
if x < -1.19999999999999996e32Initial program 65.0%
*-commutative65.0%
associate-*l*65.0%
times-frac88.1%
+-commutative88.1%
+-commutative88.1%
associate-+r+88.1%
+-commutative88.1%
associate-+l+88.1%
Applied egg-rr88.1%
Taylor expanded in y around 0 87.7%
clear-num87.7%
frac-times82.9%
*-un-lft-identity82.9%
*-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Applied egg-rr82.9%
associate-/l/87.7%
associate-/r*88.7%
Simplified88.7%
if -1.19999999999999996e32 < x < -4.99999999999999981e-165Initial program 77.7%
associate-/l*93.3%
associate-+l+93.3%
Simplified93.3%
if -4.99999999999999981e-165 < x Initial program 71.0%
*-commutative71.0%
associate-*l*71.0%
times-frac93.7%
+-commutative93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
Applied egg-rr93.7%
clear-num93.6%
associate-/r*99.8%
+-commutative99.8%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 56.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ x y) y)))
(if (<= x -7.2e-6)
(* (/ y x) (/ 1.0 x))
(if (<= x -9.2e-44)
t_0
(if (<= x -2.5e-91) (/ y x) (if (<= x 8.5e-129) (/ x y) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = (x / y) / y;
double tmp;
if (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -9.2e-44) {
tmp = t_0;
} else if (x <= -2.5e-91) {
tmp = y / x;
} else if (x <= 8.5e-129) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x / y) / y
if (x <= (-7.2d-6)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-9.2d-44)) then
tmp = t_0
else if (x <= (-2.5d-91)) then
tmp = y / x
else if (x <= 8.5d-129) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = (x / y) / y;
double tmp;
if (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -9.2e-44) {
tmp = t_0;
} else if (x <= -2.5e-91) {
tmp = y / x;
} else if (x <= 8.5e-129) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = (x / y) / y tmp = 0 if x <= -7.2e-6: tmp = (y / x) * (1.0 / x) elif x <= -9.2e-44: tmp = t_0 elif x <= -2.5e-91: tmp = y / x elif x <= 8.5e-129: tmp = x / y else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(Float64(x / y) / y) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -9.2e-44) tmp = t_0; elseif (x <= -2.5e-91) tmp = Float64(y / x); elseif (x <= 8.5e-129) tmp = Float64(x / y); else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = (x / y) / y;
tmp = 0.0;
if (x <= -7.2e-6)
tmp = (y / x) * (1.0 / x);
elseif (x <= -9.2e-44)
tmp = t_0;
elseif (x <= -2.5e-91)
tmp = y / x;
elseif (x <= 8.5e-129)
tmp = x / y;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -7.2e-6], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.2e-44], t$95$0, If[LessEqual[x, -2.5e-91], N[(y / x), $MachinePrecision], If[LessEqual[x, 8.5e-129], N[(x / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y}}{y}\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-91}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 65.6%
*-commutative65.6%
associate-*l*65.7%
times-frac89.3%
+-commutative89.3%
+-commutative89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+l+89.3%
Applied egg-rr89.3%
Taylor expanded in y around 0 87.6%
Taylor expanded in x around inf 77.0%
if -7.19999999999999967e-6 < x < -9.19999999999999992e-44 or 8.49999999999999937e-129 < x Initial program 76.1%
*-commutative76.1%
associate-*l*76.1%
times-frac91.6%
+-commutative91.6%
+-commutative91.6%
associate-+r+91.6%
+-commutative91.6%
associate-+l+91.6%
Applied egg-rr91.6%
clear-num91.5%
associate-/r*99.7%
+-commutative99.7%
frac-times98.6%
*-un-lft-identity98.6%
+-commutative98.6%
+-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around 0 49.1%
Taylor expanded in y around inf 33.7%
if -9.19999999999999992e-44 < x < -2.49999999999999999e-91Initial program 72.8%
associate-/l*92.7%
associate-+l+92.7%
Simplified92.7%
Taylor expanded in y around 0 65.0%
Taylor expanded in x around 0 65.0%
if -2.49999999999999999e-91 < x < 8.49999999999999937e-129Initial program 64.8%
associate-/l*72.0%
associate-+l+72.0%
Simplified72.0%
Taylor expanded in x around 0 78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in y around 0 61.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 1.0))))
(if (<= x -8e+192)
(/ 1.0 (* (/ (+ x y) y) t_0))
(if (<= x -1.52e-90)
(* (/ x (* (+ x y) t_0)) (/ y x))
(/ (/ x (+ y 1.0)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -8e+192) {
tmp = 1.0 / (((x + y) / y) * t_0);
} else if (x <= -1.52e-90) {
tmp = (x / ((x + y) * t_0)) * (y / x);
} else {
tmp = (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 = y + (x + 1.0d0)
if (x <= (-8d+192)) then
tmp = 1.0d0 / (((x + y) / y) * t_0)
else if (x <= (-1.52d-90)) then
tmp = (x / ((x + y) * t_0)) * (y / x)
else
tmp = (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 = y + (x + 1.0);
double tmp;
if (x <= -8e+192) {
tmp = 1.0 / (((x + y) / y) * t_0);
} else if (x <= -1.52e-90) {
tmp = (x / ((x + y) * t_0)) * (y / x);
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -8e+192: tmp = 1.0 / (((x + y) / y) * t_0) elif x <= -1.52e-90: tmp = (x / ((x + y) * t_0)) * (y / x) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -8e+192) tmp = Float64(1.0 / Float64(Float64(Float64(x + y) / y) * t_0)); elseif (x <= -1.52e-90) tmp = Float64(Float64(x / Float64(Float64(x + y) * t_0)) * Float64(y / x)); else tmp = Float64(Float64(x / 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 + 1.0);
tmp = 0.0;
if (x <= -8e+192)
tmp = 1.0 / (((x + y) / y) * t_0);
elseif (x <= -1.52e-90)
tmp = (x / ((x + y) * t_0)) * (y / x);
else
tmp = (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[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8e+192], N[(1.0 / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.52e-90], N[(N[(x / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -8 \cdot 10^{+192}:\\
\;\;\;\;\frac{1}{\frac{x + y}{y} \cdot t\_0}\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{-90}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot t\_0} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -8.00000000000000033e192Initial program 61.7%
*-commutative61.7%
associate-*l*61.7%
times-frac86.4%
+-commutative86.4%
+-commutative86.4%
associate-+r+86.4%
+-commutative86.4%
associate-+l+86.4%
Applied egg-rr86.4%
clear-num86.4%
associate-/r*99.9%
+-commutative99.9%
frac-times99.9%
*-un-lft-identity99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 85.5%
if -8.00000000000000033e192 < x < -1.51999999999999991e-90Initial program 73.6%
*-commutative73.6%
associate-*l*73.6%
times-frac95.2%
+-commutative95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l+95.2%
Applied egg-rr95.2%
Taylor expanded in y around 0 81.1%
if -1.51999999999999991e-90 < x Initial program 71.3%
associate-/l*79.9%
associate-+l+79.9%
Simplified79.9%
*-un-lft-identity79.9%
associate-+r+79.9%
associate-*l*79.9%
times-frac91.8%
+-commutative91.8%
+-commutative91.8%
associate-+r+91.8%
+-commutative91.8%
associate-+l+91.8%
Applied egg-rr91.8%
associate-*l/91.8%
*-lft-identity91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in x around 0 48.5%
+-commutative48.5%
Simplified48.5%
clear-num48.5%
un-div-inv48.5%
div-inv48.5%
+-commutative48.5%
clear-num48.5%
/-rgt-identity48.5%
Applied egg-rr48.5%
associate-/l/48.2%
Simplified48.2%
Final simplification60.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 1.0))))
(if (<= x -1.35e+32)
(/ (/ (/ x t_0) (+ x y)) (/ x y))
(* x (/ (/ y (* (+ x y) t_0)) (+ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+32) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.35d+32)) then
tmp = ((x / t_0) / (x + y)) / (x / y)
else
tmp = x * ((y / ((x + y) * t_0)) / (x + y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+32) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.35e+32: tmp = ((x / t_0) / (x + y)) / (x / y) else: tmp = x * ((y / ((x + y) * t_0)) / (x + y)) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.35e+32) tmp = Float64(Float64(Float64(x / t_0) / Float64(x + y)) / Float64(x / y)); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -1.35e+32)
tmp = ((x / t_0) / (x + y)) / (x / y);
else
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+32], N[(N[(N[(x / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+32}:\\
\;\;\;\;\frac{\frac{\frac{x}{t\_0}}{x + y}}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\end{array}
\end{array}
if x < -1.35000000000000006e32Initial program 65.0%
*-commutative65.0%
associate-*l*65.0%
times-frac88.1%
+-commutative88.1%
+-commutative88.1%
associate-+r+88.1%
+-commutative88.1%
associate-+l+88.1%
Applied egg-rr88.1%
Taylor expanded in y around 0 87.7%
clear-num87.7%
frac-times82.9%
*-un-lft-identity82.9%
*-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Applied egg-rr82.9%
associate-/l/87.7%
associate-/r*88.7%
Simplified88.7%
if -1.35000000000000006e32 < x Initial program 72.3%
associate-/l*82.0%
associate-+l+82.0%
Simplified82.0%
*-un-lft-identity82.0%
associate-+r+82.0%
associate-*l*82.0%
times-frac93.0%
+-commutative93.0%
+-commutative93.0%
associate-+r+93.0%
+-commutative93.0%
associate-+l+93.0%
Applied egg-rr93.0%
associate-*l/93.1%
*-lft-identity93.1%
+-commutative93.1%
Simplified93.1%
Final simplification92.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.52e-90)
(/ (/ (/ x t_0) (+ x y)) (/ x y))
(/ (/ x y) (* (/ (+ x y) y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.52e-90) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else {
tmp = (x / y) / (((x + y) / y) * t_0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (x <= (-1.52d-90)) then
tmp = ((x / t_0) / (x + y)) / (x / y)
else
tmp = (x / y) / (((x + y) / y) * t_0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.52e-90) {
tmp = ((x / t_0) / (x + y)) / (x / y);
} else {
tmp = (x / y) / (((x + y) / y) * t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.52e-90: tmp = ((x / t_0) / (x + y)) / (x / y) else: tmp = (x / y) / (((x + y) / y) * t_0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.52e-90) tmp = Float64(Float64(Float64(x / t_0) / Float64(x + y)) / Float64(x / y)); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y + (x + 1.0);
tmp = 0.0;
if (x <= -1.52e-90)
tmp = ((x / t_0) / (x + y)) / (x / y);
else
tmp = (x / y) / (((x + y) / y) * t_0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.52e-90], N[(N[(N[(x / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.52 \cdot 10^{-90}:\\
\;\;\;\;\frac{\frac{\frac{x}{t\_0}}{x + y}}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot t\_0}\\
\end{array}
\end{array}
if x < -1.51999999999999991e-90Initial program 69.5%
*-commutative69.5%
associate-*l*69.5%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l+92.1%
Applied egg-rr92.1%
Taylor expanded in y around 0 82.9%
clear-num82.8%
frac-times78.6%
*-un-lft-identity78.6%
*-commutative78.6%
+-commutative78.6%
+-commutative78.6%
Applied egg-rr78.6%
associate-/l/82.9%
associate-/r*83.5%
Simplified83.5%
if -1.51999999999999991e-90 < x Initial program 71.3%
*-commutative71.3%
associate-*l*71.3%
times-frac94.0%
+-commutative94.0%
+-commutative94.0%
associate-+r+94.0%
+-commutative94.0%
associate-+l+94.0%
Applied egg-rr94.0%
clear-num93.9%
associate-/r*99.8%
+-commutative99.8%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 57.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.4e-50) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (* (/ (+ x y) y) (+ y (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.4e-50) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (((x + y) / y) * (y + (x + 1.0)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.4d-50) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (((x + y) / y) * (y + (x + 1.0d0)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.4e-50) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (((x + y) / y) * (y + (x + 1.0)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.4e-50: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (((x + y) / y) * (y + (x + 1.0))) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.4e-50) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(Float64(Float64(x + y) / y) * Float64(y + Float64(x + 1.0)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.4e-50)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (((x + y) / y) * (y + (x + 1.0)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.4e-50], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{x + y}{y} \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 3.40000000000000014e-50Initial program 69.5%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in y around 0 66.1%
associate-/r*66.6%
+-commutative66.6%
Simplified66.6%
if 3.40000000000000014e-50 < y Initial program 73.9%
*-commutative73.9%
associate-*l*73.9%
times-frac91.6%
+-commutative91.6%
+-commutative91.6%
associate-+r+91.6%
+-commutative91.6%
associate-+l+91.6%
Applied egg-rr91.6%
clear-num91.6%
associate-/r*99.8%
+-commutative99.8%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 78.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-229) (/ y x) (if (<= y 1.0) (/ x y) (/ (/ x y) y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-229) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x / y;
} 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 <= 3.1d-229) then
tmp = y / x
else if (y <= 1.0d0) then
tmp = x / y
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 <= 3.1e-229) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x / y;
} else {
tmp = (x / y) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-229: tmp = y / x elif y <= 1.0: tmp = x / y else: tmp = (x / y) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-229) tmp = Float64(y / x); elseif (y <= 1.0) tmp = Float64(x / y); else tmp = Float64(Float64(x / y) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-229)
tmp = y / x;
elseif (y <= 1.0)
tmp = x / y;
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, 3.1e-229], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-229}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 3.1000000000000001e-229Initial program 67.0%
associate-/l*80.1%
associate-+l+80.1%
Simplified80.1%
Taylor expanded in y around 0 62.4%
Taylor expanded in x around 0 39.8%
if 3.1000000000000001e-229 < y < 1Initial program 84.9%
associate-/l*85.2%
associate-+l+85.2%
Simplified85.2%
Taylor expanded in x around 0 22.5%
+-commutative22.5%
Simplified22.5%
Taylor expanded in y around 0 22.5%
if 1 < y Initial program 68.6%
*-commutative68.6%
associate-*l*68.6%
times-frac90.0%
+-commutative90.0%
+-commutative90.0%
associate-+r+90.0%
+-commutative90.0%
associate-+l+90.0%
Applied egg-rr90.0%
clear-num89.9%
associate-/r*99.9%
+-commutative99.9%
frac-times99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 85.5%
Taylor expanded in y around inf 69.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 6.5e-49) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) (+ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 6.5e-49) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (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) :: tmp
if (y <= 6.5d-49) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (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 (y <= 6.5e-49) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 6.5e-49: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 6.5e-49) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / 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 (y <= 6.5e-49)
tmp = (y / x) / (x + 1.0);
else
tmp = (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_] := If[LessEqual[y, 6.5e-49], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.5 \cdot 10^{-49}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if y < 6.49999999999999968e-49Initial program 69.7%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in y around 0 66.2%
associate-/r*66.8%
+-commutative66.8%
Simplified66.8%
if 6.49999999999999968e-49 < y Initial program 73.5%
associate-/l*85.4%
associate-+l+85.4%
Simplified85.4%
*-un-lft-identity85.4%
associate-+r+85.4%
associate-*l*85.5%
times-frac89.9%
+-commutative89.9%
+-commutative89.9%
associate-+r+89.9%
+-commutative89.9%
associate-+l+89.9%
Applied egg-rr89.9%
associate-*l/89.9%
*-lft-identity89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 68.6%
+-commutative68.6%
Simplified68.6%
clear-num67.3%
un-div-inv67.3%
div-inv67.2%
+-commutative67.2%
clear-num67.3%
/-rgt-identity67.3%
Applied egg-rr67.3%
associate-/l/65.3%
Simplified65.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.08e-47) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.08e-47) {
tmp = (y / x) / (x + 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.08d-47) then
tmp = (y / x) / (x + 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.08e-47) {
tmp = (y / x) / (x + 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.08e-47: tmp = (y / x) / (x + 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.08e-47) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 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.08e-47)
tmp = (y / x) / (x + 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.08e-47], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.08 \cdot 10^{-47}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if y < 1.08000000000000005e-47Initial program 69.7%
associate-/l*80.3%
associate-+l+80.3%
Simplified80.3%
Taylor expanded in y around 0 66.2%
associate-/r*66.8%
+-commutative66.8%
Simplified66.8%
if 1.08000000000000005e-47 < y Initial program 73.5%
associate-/l*85.4%
associate-+l+85.4%
Simplified85.4%
Taylor expanded in x around 0 62.3%
+-commutative62.3%
Simplified62.3%
associate-/r*64.8%
div-inv64.7%
Applied egg-rr64.7%
associate-*l/64.7%
un-div-inv64.8%
Applied egg-rr64.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.2e-6) (* (/ y x) (/ 1.0 x)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / 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 (x <= (-7.2d-6)) then
tmp = (y / x) * (1.0d0 / 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 (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.2e-6: tmp = (y / x) * (1.0 / x) else: tmp = (x / (y + 1.0)) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.2e-6)
tmp = (y / x) * (1.0 / 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[x, -7.2e-6], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 65.6%
*-commutative65.6%
associate-*l*65.7%
times-frac89.3%
+-commutative89.3%
+-commutative89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+l+89.3%
Applied egg-rr89.3%
Taylor expanded in y around 0 87.6%
Taylor expanded in x around inf 77.0%
if -7.19999999999999967e-6 < x Initial program 72.4%
associate-/l*81.4%
associate-+l+81.4%
Simplified81.4%
Taylor expanded in x around 0 47.6%
+-commutative47.6%
Simplified47.6%
associate-/r*48.8%
div-inv48.7%
Applied egg-rr48.7%
associate-*l/48.7%
un-div-inv48.8%
Applied egg-rr48.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.2e-6) (* (/ y x) (/ 1.0 x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.2d-6)) then
tmp = (y / x) * (1.0d0 / x)
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.2e-6) {
tmp = (y / x) * (1.0 / x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.2e-6: tmp = (y / x) * (1.0 / x) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.2e-6)
tmp = (y / x) * (1.0 / x);
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7.2e-6], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 65.6%
*-commutative65.6%
associate-*l*65.7%
times-frac89.3%
+-commutative89.3%
+-commutative89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+l+89.3%
Applied egg-rr89.3%
Taylor expanded in y around 0 87.6%
Taylor expanded in x around inf 77.0%
if -7.19999999999999967e-6 < x Initial program 72.4%
associate-/l*81.4%
associate-+l+81.4%
Simplified81.4%
Taylor expanded in x around 0 47.6%
+-commutative47.6%
Simplified47.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4e-93) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4e-93) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4d-93)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4e-93) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4e-93: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4e-93) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4e-93)
tmp = y / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4e-93], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-93}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.9999999999999996e-93Initial program 69.8%
associate-/l*84.8%
associate-+l+84.8%
Simplified84.8%
Taylor expanded in y around 0 70.0%
Taylor expanded in x around 0 34.8%
if -3.9999999999999996e-93 < x Initial program 71.1%
associate-/l*79.8%
associate-+l+79.8%
Simplified79.8%
Taylor expanded in x around 0 46.0%
+-commutative46.0%
Simplified46.0%
Taylor expanded in y around 0 25.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.2e-6) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.2e-6) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.2d-6)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.2e-6) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.2e-6: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.2e-6)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7.2e-6], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 65.6%
*-commutative65.6%
associate-*l*65.7%
times-frac89.3%
+-commutative89.3%
+-commutative89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+l+89.3%
Applied egg-rr89.3%
clear-num89.2%
associate-/r*99.8%
+-commutative99.8%
frac-times99.8%
*-un-lft-identity99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 5.9%
if -7.19999999999999967e-6 < x Initial program 72.4%
associate-/l*81.4%
associate-+l+81.4%
Simplified81.4%
Taylor expanded in x around 0 47.6%
+-commutative47.6%
Simplified47.6%
Taylor expanded in y around 0 23.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 70.6%
*-commutative70.6%
associate-*l*70.7%
times-frac93.3%
+-commutative93.3%
+-commutative93.3%
associate-+r+93.3%
+-commutative93.3%
associate-+l+93.3%
Applied egg-rr93.3%
clear-num93.3%
associate-/r*99.8%
+-commutative99.8%
frac-times99.3%
*-un-lft-identity99.3%
+-commutative99.3%
+-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 55.2%
Taylor expanded in x around inf 4.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
return 1.0;
}
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
end function
assert x < y;
public static double code(double x, double y) {
return 1.0;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0
x, y = sort([x, y]) function code(x, y) return 1.0 end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Initial program 70.6%
associate-/l*81.6%
associate-+l+81.6%
Simplified81.6%
*-un-lft-identity81.6%
associate-+r+81.6%
associate-*l*81.6%
times-frac90.8%
+-commutative90.8%
+-commutative90.8%
associate-+r+90.8%
+-commutative90.8%
associate-+l+90.8%
Applied egg-rr90.8%
associate-*l/90.8%
*-lft-identity90.8%
+-commutative90.8%
Simplified90.8%
Taylor expanded in x around 0 43.5%
+-commutative43.5%
Simplified43.5%
Taylor expanded in y around 0 3.4%
Taylor expanded in x around 0 3.4%
(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 2024085
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))