
(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 14 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 (/ (* (pow (cbrt y) 2.0) (/ (cbrt y) (+ y x))) (* (/ (+ x (+ y 1.0)) x) (+ y x))))
assert(x < y);
double code(double x, double y) {
return (pow(cbrt(y), 2.0) * (cbrt(y) / (y + x))) / (((x + (y + 1.0)) / x) * (y + x));
}
assert x < y;
public static double code(double x, double y) {
return (Math.pow(Math.cbrt(y), 2.0) * (Math.cbrt(y) / (y + x))) / (((x + (y + 1.0)) / x) * (y + x));
}
x, y = sort([x, y]) function code(x, y) return Float64(Float64((cbrt(y) ^ 2.0) * Float64(cbrt(y) / Float64(y + x))) / Float64(Float64(Float64(x + Float64(y + 1.0)) / x) * Float64(y + x))) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[Power[N[Power[y, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}
\end{array}
Initial program 64.2%
associate-*l*64.2%
*-commutative64.2%
times-frac93.9%
+-commutative93.9%
+-commutative93.9%
distribute-lft-in93.9%
*-rgt-identity93.9%
+-commutative93.9%
pow293.9%
+-commutative93.9%
Applied egg-rr93.9%
*-commutative93.9%
clear-num93.2%
frac-times90.7%
*-un-lft-identity90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Applied egg-rr90.7%
add-cube-cbrt89.9%
times-frac92.4%
pow292.4%
pow292.4%
+-commutative92.4%
*-un-lft-identity92.4%
distribute-rgt-out92.4%
Applied egg-rr92.4%
associate-*l/92.4%
+-commutative92.4%
associate-/l*97.6%
+-commutative97.6%
associate-+l+97.6%
Simplified97.6%
Final simplification97.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= x -1.65e+26)
(/ (/ y x) (* (/ t_0 x) (+ y x)))
(if (<= x -6.6e-156)
(* x (/ y (* t_0 (* (+ y x) (+ y x)))))
(if (<= x -6.5e-208)
(/ (* y (/ x (* (+ y x) (+ 1.0 (+ y x))))) x)
(/ (/ x y) (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.65e+26) {
tmp = (y / x) / ((t_0 / x) * (y + x));
} else if (x <= -6.6e-156) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else if (x <= -6.5e-208) {
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / 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) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (x <= (-1.65d+26)) then
tmp = (y / x) / ((t_0 / x) * (y + x))
else if (x <= (-6.6d-156)) then
tmp = x * (y / (t_0 * ((y + x) * (y + x))))
else if (x <= (-6.5d-208)) then
tmp = (y * (x / ((y + x) * (1.0d0 + (y + x))))) / 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 t_0 = x + (y + 1.0);
double tmp;
if (x <= -1.65e+26) {
tmp = (y / x) / ((t_0 / x) * (y + x));
} else if (x <= -6.6e-156) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else if (x <= -6.5e-208) {
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if x <= -1.65e+26: tmp = (y / x) / ((t_0 / x) * (y + x)) elif x <= -6.6e-156: tmp = x * (y / (t_0 * ((y + x) * (y + x)))) elif x <= -6.5e-208: tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (x <= -1.65e+26) tmp = Float64(Float64(y / x) / Float64(Float64(t_0 / x) * Float64(y + x))); elseif (x <= -6.6e-156) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x))))); elseif (x <= -6.5e-208) tmp = Float64(Float64(y * Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x))))) / 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)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (x <= -1.65e+26)
tmp = (y / x) / ((t_0 / x) * (y + x));
elseif (x <= -6.6e-156)
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
elseif (x <= -6.5e-208)
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / 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_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+26], N[(N[(y / x), $MachinePrecision] / N[(N[(t$95$0 / x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.6e-156], N[(x * N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.5e-208], N[(N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{y}{x}}{\frac{t\_0}{x} \cdot \left(y + x\right)}\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-156}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-208}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.64999999999999997e26Initial program 45.8%
associate-*l*45.8%
*-commutative45.8%
times-frac78.3%
+-commutative78.3%
+-commutative78.3%
distribute-lft-in78.3%
*-rgt-identity78.3%
+-commutative78.3%
pow278.3%
+-commutative78.3%
Applied egg-rr78.3%
unpow278.3%
+-commutative78.3%
+-commutative78.3%
Applied egg-rr78.3%
Taylor expanded in y around 0 70.7%
clear-num70.8%
+-commutative70.8%
pow270.8%
frac-times70.7%
*-rgt-identity70.7%
pow270.7%
+-commutative70.7%
*-un-lft-identity70.7%
distribute-rgt-out70.7%
Applied egg-rr70.7%
associate-/r*70.8%
associate-/l*76.3%
+-commutative76.3%
associate-+l+76.3%
Simplified76.3%
if -1.64999999999999997e26 < x < -6.5999999999999997e-156Initial program 81.2%
associate-/l*96.5%
associate-+l+96.5%
Simplified96.5%
if -6.5999999999999997e-156 < x < -6.4999999999999998e-208Initial program 67.2%
associate-*l*67.2%
*-commutative67.2%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
+-commutative99.8%
pow299.8%
+-commutative99.8%
Applied egg-rr99.8%
unpow299.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 34.5%
associate-*l/67.8%
+-commutative67.8%
+-commutative67.8%
*-un-lft-identity67.8%
distribute-rgt-out67.8%
Applied egg-rr67.8%
if -6.4999999999999998e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 55.9%
associate-/r*56.3%
+-commutative56.3%
Simplified56.3%
associate-*r/56.7%
div-inv56.7%
Applied egg-rr56.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.2e+117)
(/ (/ 1.0 x) (/ (+ y x) y))
(if (<= x -7e-208)
(/ (* y (/ x (* (+ y x) (+ 1.0 (+ y x))))) x)
(/ (/ x y) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.2e+117) {
tmp = (1.0 / x) / ((y + x) / y);
} else if (x <= -7e-208) {
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / 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.2d+117)) then
tmp = (1.0d0 / x) / ((y + x) / y)
else if (x <= (-7d-208)) then
tmp = (y * (x / ((y + x) * (1.0d0 + (y + x))))) / 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.2e+117) {
tmp = (1.0 / x) / ((y + x) / y);
} else if (x <= -7e-208) {
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.2e+117: tmp = (1.0 / x) / ((y + x) / y) elif x <= -7e-208: tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / 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.2e+117) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + x) / y)); elseif (x <= -7e-208) tmp = Float64(Float64(y * Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x))))) / 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.2e+117)
tmp = (1.0 / x) / ((y + x) / y);
elseif (x <= -7e-208)
tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / 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.2e+117], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-208], N[(N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $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.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.1999999999999999e117Initial program 39.6%
associate-*l*39.6%
*-commutative39.6%
times-frac71.3%
+-commutative71.3%
+-commutative71.3%
distribute-lft-in71.3%
*-rgt-identity71.3%
+-commutative71.3%
pow271.3%
+-commutative71.3%
Applied egg-rr71.3%
Taylor expanded in x around inf 64.5%
*-commutative64.5%
clear-num64.5%
un-div-inv64.5%
+-commutative64.5%
Applied egg-rr64.5%
if -1.1999999999999999e117 < x < -6.99999999999999982e-208Initial program 75.1%
associate-*l*75.0%
*-commutative75.0%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
distribute-lft-in99.7%
*-rgt-identity99.7%
+-commutative99.7%
pow299.7%
+-commutative99.7%
Applied egg-rr99.7%
unpow299.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 65.9%
associate-*l/75.8%
+-commutative75.8%
+-commutative75.8%
*-un-lft-identity75.8%
distribute-rgt-out75.9%
Applied egg-rr75.9%
if -6.99999999999999982e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 55.9%
associate-/r*56.3%
+-commutative56.3%
Simplified56.3%
associate-*r/56.7%
div-inv56.7%
Applied egg-rr56.7%
Final simplification61.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 5.5e+150) (* (/ y (+ y x)) (/ x (+ (+ y x) (* (+ y x) (+ y x))))) (* (/ x y) (/ 1.0 (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 5.5e+150) {
tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
} else {
tmp = (x / y) * (1.0 / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5.5d+150) then
tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))))
else
tmp = (x / y) * (1.0d0 / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 5.5e+150) {
tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
} else {
tmp = (x / y) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 5.5e+150: tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x)))) else: tmp = (x / y) * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 5.5e+150) tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(y + x) + Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / y) * Float64(1.0 / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 5.5e+150)
tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
else
tmp = (x / y) * (1.0 / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 5.5e+150], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(y + x), $MachinePrecision] + N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) + \left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if y < 5.50000000000000017e150Initial program 66.8%
associate-*l*66.8%
*-commutative66.8%
times-frac96.2%
+-commutative96.2%
+-commutative96.2%
distribute-lft-in96.1%
*-rgt-identity96.1%
+-commutative96.1%
pow296.1%
+-commutative96.1%
Applied egg-rr96.1%
unpow296.1%
+-commutative96.1%
+-commutative96.1%
Applied egg-rr96.1%
if 5.50000000000000017e150 < y Initial program 47.1%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in x around 0 79.0%
+-commutative79.0%
Simplified79.0%
*-un-lft-identity79.0%
*-commutative79.0%
times-frac88.8%
Applied egg-rr88.8%
*-commutative88.8%
Simplified88.8%
Final simplification95.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.8e+144) (* y (/ (/ x (* (+ y x) (+ 1.0 (+ y x)))) (+ y x))) (* (/ x y) (/ 1.0 (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.8e+144) {
tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
} else {
tmp = (x / y) * (1.0 / (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.8d+144) then
tmp = y * ((x / ((y + x) * (1.0d0 + (y + x)))) / (y + x))
else
tmp = (x / y) * (1.0d0 / (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.8e+144) {
tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
} else {
tmp = (x / y) * (1.0 / (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.8e+144: tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x)) else: tmp = (x / y) * (1.0 / (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.8e+144) tmp = Float64(y * Float64(Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x)))) / Float64(y + x))); else tmp = Float64(Float64(x / y) * Float64(1.0 / Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.8e+144)
tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
else
tmp = (x / y) * (1.0 / (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.8e+144], N[(y * N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+144}:\\
\;\;\;\;y \cdot \frac{\frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y + 1}\\
\end{array}
\end{array}
if y < 1.7999999999999999e144Initial program 67.0%
associate-*l*67.0%
*-commutative67.0%
times-frac96.1%
+-commutative96.1%
+-commutative96.1%
distribute-lft-in96.1%
*-rgt-identity96.1%
+-commutative96.1%
pow296.1%
+-commutative96.1%
Applied egg-rr96.1%
*-commutative96.1%
clear-num95.4%
frac-times92.8%
*-un-lft-identity92.8%
+-commutative92.8%
+-commutative92.8%
+-commutative92.8%
Applied egg-rr92.8%
clear-num92.7%
associate-/r/92.7%
associate-/r*93.6%
+-commutative93.6%
pow293.6%
clear-num93.7%
+-commutative93.7%
+-commutative93.7%
*-un-lft-identity93.7%
distribute-rgt-out93.7%
Applied egg-rr93.7%
if 1.7999999999999999e144 < y Initial program 47.4%
associate-/l*77.5%
associate-+l+77.5%
Simplified77.5%
Taylor expanded in x around 0 80.2%
+-commutative80.2%
Simplified80.2%
*-un-lft-identity80.2%
*-commutative80.2%
times-frac89.4%
Applied egg-rr89.4%
*-commutative89.4%
Simplified89.4%
Final simplification93.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.2e+117)
(/ (/ 1.0 x) (/ (+ y x) y))
(if (<= x -6.8e-208)
(/ y (* (+ x (+ y 1.0)) (+ y x)))
(/ (/ x y) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.2e+117) {
tmp = (1.0 / x) / ((y + x) / y);
} else if (x <= -6.8e-208) {
tmp = y / ((x + (y + 1.0)) * (y + x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.2d+117)) then
tmp = (1.0d0 / x) / ((y + x) / y)
else if (x <= (-6.8d-208)) then
tmp = y / ((x + (y + 1.0d0)) * (y + x))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.2e+117) {
tmp = (1.0 / x) / ((y + x) / y);
} else if (x <= -6.8e-208) {
tmp = y / ((x + (y + 1.0)) * (y + x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.2e+117: tmp = (1.0 / x) / ((y + x) / y) elif x <= -6.8e-208: tmp = y / ((x + (y + 1.0)) * (y + x)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.2e+117) tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + x) / y)); elseif (x <= -6.8e-208) tmp = Float64(y / Float64(Float64(x + Float64(y + 1.0)) * Float64(y + x))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.2e+117)
tmp = (1.0 / x) / ((y + x) / y);
elseif (x <= -6.8e-208)
tmp = y / ((x + (y + 1.0)) * (y + x));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.2e+117], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.8e-208], N[(y / N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y + x), $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.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.1999999999999999e117Initial program 39.6%
associate-*l*39.6%
*-commutative39.6%
times-frac71.3%
+-commutative71.3%
+-commutative71.3%
distribute-lft-in71.3%
*-rgt-identity71.3%
+-commutative71.3%
pow271.3%
+-commutative71.3%
Applied egg-rr71.3%
Taylor expanded in x around inf 64.5%
*-commutative64.5%
clear-num64.5%
un-div-inv64.5%
+-commutative64.5%
Applied egg-rr64.5%
if -1.1999999999999999e117 < x < -6.8e-208Initial program 75.1%
associate-*l*75.0%
*-commutative75.0%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
distribute-lft-in99.7%
*-rgt-identity99.7%
+-commutative99.7%
pow299.7%
+-commutative99.7%
Applied egg-rr99.7%
unpow299.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 65.9%
clear-num65.7%
frac-times60.3%
*-un-lft-identity60.3%
+-commutative60.3%
+-commutative60.3%
*-un-lft-identity60.3%
distribute-rgt-out60.4%
Applied egg-rr60.4%
associate-/r*64.2%
associate-/r/72.1%
*-inverses72.1%
*-lft-identity72.1%
+-commutative72.1%
associate-+l+72.1%
Simplified72.1%
if -6.8e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 55.9%
associate-/r*56.3%
+-commutative56.3%
Simplified56.3%
associate-*r/56.7%
div-inv56.7%
Applied egg-rr56.7%
Final simplification60.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7e-208) (/ (/ y x) (* (/ (+ x (+ y 1.0)) x) (+ y x))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7e-208) {
tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7d-208)) then
tmp = (y / x) / (((x + (y + 1.0d0)) / x) * (y + x))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7e-208) {
tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7e-208: tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7e-208) tmp = Float64(Float64(y / x) / Float64(Float64(Float64(x + Float64(y + 1.0)) / x) * Float64(y + x))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7e-208)
tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7e-208], N[(N[(y / x), $MachinePrecision] / N[(N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * N[(y + x), $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 -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{\frac{y}{x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -6.99999999999999982e-208Initial program 61.1%
associate-*l*61.1%
*-commutative61.1%
times-frac88.6%
+-commutative88.6%
+-commutative88.6%
distribute-lft-in88.5%
*-rgt-identity88.5%
+-commutative88.5%
pow288.5%
+-commutative88.5%
Applied egg-rr88.5%
unpow288.5%
+-commutative88.5%
+-commutative88.5%
Applied egg-rr88.5%
Taylor expanded in y around 0 66.9%
clear-num66.9%
+-commutative66.9%
pow266.9%
frac-times72.8%
*-rgt-identity72.8%
pow272.8%
+-commutative72.8%
*-un-lft-identity72.8%
distribute-rgt-out72.9%
Applied egg-rr72.9%
associate-/r*67.0%
associate-/l*69.9%
+-commutative69.9%
associate-+l+69.9%
Simplified69.9%
if -6.99999999999999982e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 55.9%
associate-/r*56.3%
+-commutative56.3%
Simplified56.3%
associate-*r/56.7%
div-inv56.7%
Applied egg-rr56.7%
Final simplification61.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (* (/ y x) (/ 1.0 x)) (if (<= x -2.2e-172) (/ y x) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2.2e-172) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-2.2d-172)) then
tmp = y / x
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2.2e-172) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) * (1.0 / x) elif x <= -2.2e-172: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -2.2e-172) tmp = Float64(y / x); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) * (1.0 / x);
elseif (x <= -2.2e-172)
tmp = y / x;
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e-172], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-172}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 51.2%
associate-*l*51.2%
*-commutative51.2%
times-frac80.5%
+-commutative80.5%
+-commutative80.5%
distribute-lft-in80.4%
*-rgt-identity80.4%
+-commutative80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
Taylor expanded in x around inf 55.7%
Taylor expanded in y around 0 54.9%
if -1 < x < -2.20000000000000009e-172Initial program 72.6%
associate-/l*89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.8%
associate-/r*49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around 0 49.8%
if -2.20000000000000009e-172 < x Initial program 66.3%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in x around 0 56.7%
+-commutative56.7%
Simplified56.7%
Final simplification55.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (* (/ y x) (/ 1.0 x)) (if (<= x -2.4e-172) (/ y x) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2.4e-172) {
tmp = y / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-2.4d-172)) then
tmp = y / x
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -2.4e-172) {
tmp = y / x;
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) * (1.0 / x) elif x <= -2.4e-172: tmp = y / x else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -2.4e-172) tmp = Float64(y / x); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.0)
tmp = (y / x) * (1.0 / x);
elseif (x <= -2.4e-172)
tmp = y / x;
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.4e-172], N[(y / x), $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:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-172}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1Initial program 51.2%
associate-*l*51.2%
*-commutative51.2%
times-frac80.5%
+-commutative80.5%
+-commutative80.5%
distribute-lft-in80.4%
*-rgt-identity80.4%
+-commutative80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
Taylor expanded in x around inf 55.7%
Taylor expanded in y around 0 54.9%
if -1 < x < -2.4000000000000001e-172Initial program 72.6%
associate-/l*89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in y around 0 49.8%
associate-/r*49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around 0 49.8%
if -2.4000000000000001e-172 < x Initial program 66.3%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in x around 0 56.6%
associate-/r*57.0%
+-commutative57.0%
Simplified57.0%
associate-*r/57.4%
div-inv57.5%
Applied egg-rr57.5%
Final simplification56.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.0) (* (/ y x) (/ 1.0 x)) (if (<= x -7e-208) (/ y x) (/ x y))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -7e-208) {
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 <= (-1.0d0)) then
tmp = (y / x) * (1.0d0 / x)
else if (x <= (-7d-208)) 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 <= -1.0) {
tmp = (y / x) * (1.0 / x);
} else if (x <= -7e-208) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.0: tmp = (y / x) * (1.0 / x) elif x <= -7e-208: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(y / x) * Float64(1.0 / x)); elseif (x <= -7e-208) 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 <= -1.0)
tmp = (y / x) * (1.0 / x);
elseif (x <= -7e-208)
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, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-208], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 51.2%
associate-*l*51.2%
*-commutative51.2%
times-frac80.5%
+-commutative80.5%
+-commutative80.5%
distribute-lft-in80.4%
*-rgt-identity80.4%
+-commutative80.4%
pow280.4%
+-commutative80.4%
Applied egg-rr80.4%
Taylor expanded in x around inf 55.7%
Taylor expanded in y around 0 54.9%
if -1 < x < -6.99999999999999982e-208Initial program 75.0%
associate-/l*90.2%
associate-+l+90.2%
Simplified90.2%
Taylor expanded in y around 0 45.8%
associate-/r*45.8%
+-commutative45.8%
Simplified45.8%
Taylor expanded in x around 0 45.8%
if -6.99999999999999982e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 56.0%
+-commutative56.0%
Simplified56.0%
Taylor expanded in y around 0 30.7%
Final simplification37.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.4e-172) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.4e-172) {
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 <= (-2.4d-172)) 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 <= -2.4e-172) {
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 <= -2.4e-172: 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 <= -2.4e-172) 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 <= -2.4e-172)
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, -2.4e-172], 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 -2.4 \cdot 10^{-172}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.4000000000000001e-172Initial program 59.7%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 55.8%
associate-/r*55.2%
+-commutative55.2%
Simplified55.2%
if -2.4000000000000001e-172 < x Initial program 66.3%
associate-/l*79.0%
associate-+l+79.0%
Simplified79.0%
Taylor expanded in x around 0 56.6%
associate-/r*57.0%
+-commutative57.0%
Simplified57.0%
associate-*r/57.4%
div-inv57.5%
Applied egg-rr57.5%
Final simplification56.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7e-208) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7e-208) {
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 <= (-7d-208)) 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 <= -7e-208) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7e-208: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7e-208) 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 <= -7e-208)
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, -7e-208], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -6.99999999999999982e-208Initial program 61.1%
associate-/l*77.1%
associate-+l+77.1%
Simplified77.1%
Taylor expanded in y around 0 53.9%
associate-/r*53.3%
+-commutative53.3%
Simplified53.3%
Taylor expanded in x around 0 30.5%
if -6.99999999999999982e-208 < x Initial program 65.7%
associate-/l*78.7%
associate-+l+78.7%
Simplified78.7%
Taylor expanded in x around 0 56.0%
+-commutative56.0%
Simplified56.0%
Taylor expanded in y around 0 30.7%
Final simplification30.6%
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 64.2%
associate-*l*64.2%
*-commutative64.2%
times-frac93.9%
+-commutative93.9%
+-commutative93.9%
distribute-lft-in93.9%
*-rgt-identity93.9%
+-commutative93.9%
pow293.9%
+-commutative93.9%
Applied egg-rr93.9%
Taylor expanded in x around inf 32.8%
Taylor expanded in y around inf 4.1%
Final simplification4.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
assert x < y;
public static double code(double x, double y) {
return x / y;
}
[x, y] = sort([x, y]) def code(x, y): return x / y
x, y = sort([x, y]) function code(x, y) return Float64(x / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Initial program 64.2%
associate-/l*78.1%
associate-+l+78.1%
Simplified78.1%
Taylor expanded in x around 0 51.6%
+-commutative51.6%
Simplified51.6%
Taylor expanded in y around 0 25.9%
Final simplification25.9%
(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 2024115
(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))))