
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ (/ y (+ y x)) (/ (+ y x) x)) (+ y (+ x 1.0))))
assert(x < y);
double code(double x, double y) {
return ((y / (y + x)) / ((y + x) / x)) / (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 = ((y / (y + x)) / ((y + x) / x)) / (y + (x + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return ((y / (y + x)) / ((y + x) / x)) / (y + (x + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return ((y / (y + x)) / ((y + x) / x)) / (y + (x + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) / Float64(Float64(y + x) / x)) / Float64(y + Float64(x + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = ((y / (y + x)) / ((y + x) / x)) / (y + (x + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{y}{y + x}}{\frac{y + x}{x}}}{y + \left(x + 1\right)}
\end{array}
Initial program 63.6%
associate-*l*63.6%
times-frac91.5%
+-commutative91.5%
+-commutative91.5%
associate-+r+91.5%
+-commutative91.5%
associate-+l+91.5%
Applied egg-rr91.5%
*-commutative91.5%
clear-num91.4%
frac-times87.4%
*-rgt-identity87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate-/r*91.4%
associate-/r*99.7%
associate-/r*98.9%
*-commutative98.9%
associate-/r*99.7%
Simplified99.7%
Final simplification99.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.75e+101)
(/ (/ y (+ y x)) t_0)
(if (<= x -1.6e-162)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(/ (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.75e+101) {
tmp = (y / (y + x)) / t_0;
} else if (x <= -1.6e-162) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / 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.75d+101)) then
tmp = (y / (y + x)) / t_0
else if (x <= (-1.6d-162)) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = (x / 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.75e+101) {
tmp = (y / (y + x)) / t_0;
} else if (x <= -1.6e-162) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / 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.75e+101: tmp = (y / (y + x)) / t_0 elif x <= -1.6e-162: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = (x / 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.75e+101) tmp = Float64(Float64(y / Float64(y + x)) / t_0); elseif (x <= -1.6e-162) tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / 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.75e+101)
tmp = (y / (y + x)) / t_0;
elseif (x <= -1.6e-162)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = (x / 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.75e+101], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, -1.6e-162], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $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.75 \cdot 10^{+101}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{t\_0}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-162}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -1.75000000000000012e101Initial program 43.3%
associate-*l*43.3%
times-frac79.1%
+-commutative79.1%
+-commutative79.1%
associate-+r+79.1%
+-commutative79.1%
associate-+l+79.1%
Applied egg-rr79.1%
*-commutative79.1%
clear-num79.0%
frac-times77.0%
*-rgt-identity77.0%
+-commutative77.0%
Applied egg-rr77.0%
associate-/r*79.0%
associate-/r*99.8%
associate-/r*99.0%
*-commutative99.0%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 79.0%
if -1.75000000000000012e101 < x < -1.59999999999999988e-162Initial program 82.9%
associate-/l*87.7%
associate-+l+87.7%
Simplified87.7%
if -1.59999999999999988e-162 < x Initial program 63.0%
associate-*l*63.0%
times-frac92.7%
+-commutative92.7%
+-commutative92.7%
associate-+r+92.7%
+-commutative92.7%
associate-+l+92.7%
Applied egg-rr92.7%
*-commutative92.7%
clear-num92.6%
frac-times87.9%
*-rgt-identity87.9%
+-commutative87.9%
Applied egg-rr87.9%
associate-/r*92.6%
associate-/r*99.7%
associate-/r*99.0%
*-commutative99.0%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around inf 55.5%
Final simplification66.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -2e+111)
(/ (/ y (+ y x)) t_0)
(if (<= x 3.65e-47)
(* x (/ (/ y (* (+ y x) t_0)) (+ y x)))
(/ (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -2e+111) {
tmp = (y / (y + x)) / t_0;
} else if (x <= 3.65e-47) {
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
} else {
tmp = (x / 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 <= (-2d+111)) then
tmp = (y / (y + x)) / t_0
else if (x <= 3.65d-47) then
tmp = x * ((y / ((y + x) * t_0)) / (y + x))
else
tmp = (x / 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 <= -2e+111) {
tmp = (y / (y + x)) / t_0;
} else if (x <= 3.65e-47) {
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -2e+111: tmp = (y / (y + x)) / t_0 elif x <= 3.65e-47: tmp = x * ((y / ((y + x) * t_0)) / (y + x)) else: tmp = (x / 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 <= -2e+111) tmp = Float64(Float64(y / Float64(y + x)) / t_0); elseif (x <= 3.65e-47) tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * t_0)) / Float64(y + x))); else tmp = Float64(Float64(x / 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 <= -2e+111)
tmp = (y / (y + x)) / t_0;
elseif (x <= 3.65e-47)
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
else
tmp = (x / 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, -2e+111], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, 3.65e-47], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{+111}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{t\_0}\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-47}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot t\_0}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -1.99999999999999991e111Initial program 42.1%
associate-*l*42.1%
times-frac78.6%
+-commutative78.6%
+-commutative78.6%
associate-+r+78.6%
+-commutative78.6%
associate-+l+78.6%
Applied egg-rr78.6%
*-commutative78.6%
clear-num78.6%
frac-times76.4%
*-rgt-identity76.4%
+-commutative76.4%
Applied egg-rr76.4%
associate-/r*78.6%
associate-/r*99.8%
associate-/r*99.0%
*-commutative99.0%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 78.5%
if -1.99999999999999991e111 < x < 3.65000000000000021e-47Initial program 72.1%
associate-/l*82.7%
associate-+l+82.7%
Simplified82.7%
*-un-lft-identity82.7%
associate-+r+82.7%
associate-*l*82.7%
times-frac97.8%
+-commutative97.8%
+-commutative97.8%
associate-+r+97.8%
+-commutative97.8%
associate-+l+97.8%
Applied egg-rr97.8%
associate-*l/97.8%
*-lft-identity97.8%
+-commutative97.8%
Simplified97.8%
if 3.65000000000000021e-47 < x Initial program 61.3%
associate-*l*61.3%
times-frac85.6%
+-commutative85.6%
+-commutative85.6%
associate-+r+85.6%
+-commutative85.6%
associate-+l+85.6%
Applied egg-rr85.6%
*-commutative85.6%
clear-num85.6%
frac-times81.0%
*-rgt-identity81.0%
+-commutative81.0%
Applied egg-rr81.0%
associate-/r*85.6%
associate-/r*99.7%
associate-/r*99.7%
*-commutative99.7%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 36.1%
Final simplification75.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.35e+141)
(/ (/ y (+ y x)) t_0)
(if (<= x 3.65e-47)
(* (/ x (+ y x)) (/ y (* (+ y x) t_0)))
(/ (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+141) {
tmp = (y / (y + x)) / t_0;
} else if (x <= 3.65e-47) {
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
} else {
tmp = (x / 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.35d+141)) then
tmp = (y / (y + x)) / t_0
else if (x <= 3.65d-47) then
tmp = (x / (y + x)) * (y / ((y + x) * t_0))
else
tmp = (x / 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.35e+141) {
tmp = (y / (y + x)) / t_0;
} else if (x <= 3.65e-47) {
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
} else {
tmp = (x / 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.35e+141: tmp = (y / (y + x)) / t_0 elif x <= 3.65e-47: tmp = (x / (y + x)) * (y / ((y + x) * t_0)) else: tmp = (x / 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.35e+141) tmp = Float64(Float64(y / Float64(y + x)) / t_0); elseif (x <= 3.65e-47) tmp = Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) * t_0))); else tmp = Float64(Float64(x / 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.35e+141)
tmp = (y / (y + x)) / t_0;
elseif (x <= 3.65e-47)
tmp = (x / (y + x)) * (y / ((y + x) * t_0));
else
tmp = (x / 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.35e+141], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, 3.65e-47], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $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^{+141}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{t\_0}\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-47}:\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -1.35e141Initial program 45.6%
associate-*l*45.6%
times-frac80.1%
+-commutative80.1%
+-commutative80.1%
associate-+r+80.1%
+-commutative80.1%
associate-+l+80.1%
Applied egg-rr80.1%
*-commutative80.1%
clear-num80.1%
frac-times80.1%
*-rgt-identity80.1%
+-commutative80.1%
Applied egg-rr80.1%
associate-/r*80.1%
associate-/r*99.9%
associate-/r*99.0%
*-commutative99.0%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around 0 85.3%
if -1.35e141 < x < 3.65000000000000021e-47Initial program 69.8%
associate-*l*69.8%
times-frac98.0%
+-commutative98.0%
+-commutative98.0%
associate-+r+98.0%
+-commutative98.0%
associate-+l+98.0%
Applied egg-rr98.0%
if 3.65000000000000021e-47 < x Initial program 61.3%
associate-*l*61.3%
times-frac85.6%
+-commutative85.6%
+-commutative85.6%
associate-+r+85.6%
+-commutative85.6%
associate-+l+85.6%
Applied egg-rr85.6%
*-commutative85.6%
clear-num85.6%
frac-times81.0%
*-rgt-identity81.0%
+-commutative81.0%
Applied egg-rr81.0%
associate-/r*85.6%
associate-/r*99.7%
associate-/r*99.7%
*-commutative99.7%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around inf 36.1%
Final simplification76.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.4e+72)
(/ (/ y x) t_0)
(if (<= x -4.1e-55) (/ y (* (+ y x) t_0)) (/ (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.4e+72) {
tmp = (y / x) / t_0;
} else if (x <= -4.1e-55) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / 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.4d+72)) then
tmp = (y / x) / t_0
else if (x <= (-4.1d-55)) then
tmp = y / ((y + x) * t_0)
else
tmp = (x / 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.4e+72) {
tmp = (y / x) / t_0;
} else if (x <= -4.1e-55) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / 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.4e+72: tmp = (y / x) / t_0 elif x <= -4.1e-55: tmp = y / ((y + x) * t_0) else: tmp = (x / 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.4e+72) tmp = Float64(Float64(y / x) / t_0); elseif (x <= -4.1e-55) tmp = Float64(y / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / 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.4e+72)
tmp = (y / x) / t_0;
elseif (x <= -4.1e-55)
tmp = y / ((y + x) * t_0);
else
tmp = (x / 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.4e+72], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, -4.1e-55], N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $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.4 \cdot 10^{+72}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -1.4e72Initial program 45.2%
associate-*l*45.2%
times-frac81.8%
+-commutative81.8%
+-commutative81.8%
associate-+r+81.8%
+-commutative81.8%
associate-+l+81.8%
Applied egg-rr81.8%
*-commutative81.8%
clear-num81.8%
frac-times80.0%
*-rgt-identity80.0%
+-commutative80.0%
Applied egg-rr80.0%
associate-/r*81.8%
associate-/r*99.7%
associate-/r*99.1%
*-commutative99.1%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 74.6%
if -1.4e72 < x < -4.0999999999999998e-55Initial program 82.7%
associate-*l*82.7%
times-frac97.3%
+-commutative97.3%
+-commutative97.3%
associate-+r+97.3%
+-commutative97.3%
associate-+l+97.3%
Applied egg-rr97.3%
Taylor expanded in x around inf 67.6%
if -4.0999999999999998e-55 < x Initial program 66.1%
associate-*l*66.1%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
*-commutative93.4%
clear-num93.4%
frac-times89.1%
*-rgt-identity89.1%
+-commutative89.1%
Applied egg-rr89.1%
associate-/r*93.4%
associate-/r*99.7%
associate-/r*99.1%
*-commutative99.1%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around inf 58.8%
Final simplification62.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.35e+141)
(/ (/ y (+ y x)) t_0)
(if (<= x -1.2e-54) (/ y (* (+ y x) t_0)) (/ (/ x y) t_0)))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.35e+141) {
tmp = (y / (y + x)) / t_0;
} else if (x <= -1.2e-54) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / 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.35d+141)) then
tmp = (y / (y + x)) / t_0
else if (x <= (-1.2d-54)) then
tmp = y / ((y + x) * t_0)
else
tmp = (x / 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.35e+141) {
tmp = (y / (y + x)) / t_0;
} else if (x <= -1.2e-54) {
tmp = y / ((y + x) * t_0);
} else {
tmp = (x / 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.35e+141: tmp = (y / (y + x)) / t_0 elif x <= -1.2e-54: tmp = y / ((y + x) * t_0) else: tmp = (x / 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.35e+141) tmp = Float64(Float64(y / Float64(y + x)) / t_0); elseif (x <= -1.2e-54) tmp = Float64(y / Float64(Float64(y + x) * t_0)); else tmp = Float64(Float64(x / 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.35e+141)
tmp = (y / (y + x)) / t_0;
elseif (x <= -1.2e-54)
tmp = y / ((y + x) * t_0);
else
tmp = (x / 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.35e+141], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, -1.2e-54], N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $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^{+141}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{t\_0}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -1.35e141Initial program 45.6%
associate-*l*45.6%
times-frac80.1%
+-commutative80.1%
+-commutative80.1%
associate-+r+80.1%
+-commutative80.1%
associate-+l+80.1%
Applied egg-rr80.1%
*-commutative80.1%
clear-num80.1%
frac-times80.1%
*-rgt-identity80.1%
+-commutative80.1%
Applied egg-rr80.1%
associate-/r*80.1%
associate-/r*99.9%
associate-/r*99.0%
*-commutative99.0%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in y around 0 85.3%
if -1.35e141 < x < -1.20000000000000007e-54Initial program 69.3%
associate-*l*69.3%
times-frac93.5%
+-commutative93.5%
+-commutative93.5%
associate-+r+93.5%
+-commutative93.5%
associate-+l+93.5%
Applied egg-rr93.5%
Taylor expanded in x around inf 64.8%
if -1.20000000000000007e-54 < x Initial program 66.1%
associate-*l*66.1%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
*-commutative93.4%
clear-num93.4%
frac-times89.1%
*-rgt-identity89.1%
+-commutative89.1%
Applied egg-rr89.1%
associate-/r*93.4%
associate-/r*99.7%
associate-/r*99.1%
*-commutative99.1%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around inf 58.8%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ y (+ y x)) (* (/ (+ y x) x) (+ y (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) / (((y + x) / x) * (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 = (y / (y + x)) / (((y + x) / x) * (y + (x + 1.0d0)))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) / (((y + x) / x) * (y + (x + 1.0)));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) / (((y + x) / x) * (y + (x + 1.0)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) / Float64(Float64(Float64(y + x) / x) * Float64(y + Float64(x + 1.0)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) / (((y + x) / x) * (y + (x + 1.0)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{\frac{y + x}{x} \cdot \left(y + \left(x + 1\right)\right)}
\end{array}
Initial program 63.6%
associate-*l*63.6%
times-frac91.5%
+-commutative91.5%
+-commutative91.5%
associate-+r+91.5%
+-commutative91.5%
associate-+l+91.5%
Applied egg-rr91.5%
clear-num91.4%
associate-/r*99.7%
frac-times98.9%
*-un-lft-identity98.9%
+-commutative98.9%
Applied egg-rr98.9%
Final simplification98.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.3e-54) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.3e-54) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / 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 (x <= (-2.3d-54)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / 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 (x <= -2.3e-54) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + (x + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.3e-54: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + (x + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.3e-54) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / 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 (x <= -2.3e-54)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / 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[x, -2.3e-54], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -2.2999999999999999e-54Initial program 57.7%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 61.5%
associate-/r*63.6%
+-commutative63.6%
Simplified63.6%
if -2.2999999999999999e-54 < x Initial program 66.1%
associate-*l*66.1%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
*-commutative93.4%
clear-num93.4%
frac-times89.1%
*-rgt-identity89.1%
+-commutative89.1%
Applied egg-rr89.1%
associate-/r*93.4%
associate-/r*99.7%
associate-/r*99.1%
*-commutative99.1%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around inf 58.8%
Final simplification60.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (let* ((t_0 (+ y (+ x 1.0)))) (if (<= x -7.2e-55) (/ (/ y x) t_0) (/ (/ x y) t_0))))
assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -7.2e-55) {
tmp = (y / x) / t_0;
} else {
tmp = (x / 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 <= (-7.2d-55)) then
tmp = (y / x) / t_0
else
tmp = (x / 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 <= -7.2e-55) {
tmp = (y / x) / t_0;
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -7.2e-55: tmp = (y / x) / t_0 else: tmp = (x / 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 <= -7.2e-55) tmp = Float64(Float64(y / x) / t_0); else tmp = Float64(Float64(x / 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 <= -7.2e-55)
tmp = (y / x) / t_0;
else
tmp = (x / 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, -7.2e-55], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if x < -7.2000000000000001e-55Initial program 57.7%
associate-*l*57.7%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l+87.0%
Applied egg-rr87.0%
*-commutative87.0%
clear-num86.9%
frac-times83.4%
*-rgt-identity83.4%
+-commutative83.4%
Applied egg-rr83.4%
associate-/r*86.8%
associate-/r*99.7%
associate-/r*98.5%
*-commutative98.5%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around 0 64.6%
if -7.2000000000000001e-55 < x Initial program 66.1%
associate-*l*66.1%
times-frac93.4%
+-commutative93.4%
+-commutative93.4%
associate-+r+93.4%
+-commutative93.4%
associate-+l+93.4%
Applied egg-rr93.4%
*-commutative93.4%
clear-num93.4%
frac-times89.1%
*-rgt-identity89.1%
+-commutative89.1%
Applied egg-rr89.1%
associate-/r*93.4%
associate-/r*99.7%
associate-/r*99.1%
*-commutative99.1%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in y around inf 58.8%
Final simplification60.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.3e-54) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.3e-54) {
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.3d-54)) 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.3e-54) {
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.3e-54: 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.3e-54) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.3e-54)
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.3e-54], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $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 -2.3 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -2.2999999999999999e-54Initial program 57.7%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 61.5%
if -2.2999999999999999e-54 < x Initial program 66.1%
associate-/l*81.0%
associate-+l+81.0%
Simplified81.0%
Taylor expanded in x around 0 57.3%
+-commutative57.3%
Simplified57.3%
Final simplification58.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.3e-54) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.3e-54) {
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.3d-54)) 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.3e-54) {
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.3e-54: 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.3e-54) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.3e-54)
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.3e-54], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.2999999999999999e-54Initial program 57.7%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 61.5%
if -2.2999999999999999e-54 < x Initial program 66.1%
associate-/l*81.0%
associate-+l+81.0%
Simplified81.0%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
div-inv57.3%
associate-/r*58.6%
Applied egg-rr58.6%
Final simplification59.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.75e-54) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.75e-54) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.75d-54)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -1.75e-54) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.75e-54: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.75e-54) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -1.75e-54)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -1.75e-54], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.74999999999999991e-54Initial program 57.7%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 61.5%
associate-/r*63.6%
+-commutative63.6%
Simplified63.6%
if -1.74999999999999991e-54 < x Initial program 66.1%
associate-/l*81.0%
associate-+l+81.0%
Simplified81.0%
Taylor expanded in x around 0 57.2%
+-commutative57.2%
div-inv57.3%
associate-/r*58.6%
Applied egg-rr58.6%
Final simplification60.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
return x / (y * (y + 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 / (y * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return x / (y * (y + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return x / (y * (y + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(x / Float64(y * Float64(y + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Initial program 63.6%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in x around 0 51.1%
+-commutative51.1%
Simplified51.1%
Final simplification51.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 63.6%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in x around 0 51.1%
+-commutative51.1%
Simplified51.1%
Taylor expanded in y around 0 21.7%
Final simplification21.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (- x))
assert(x < y);
double code(double x, double y) {
return -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 = -x
end function
assert x < y;
public static double code(double x, double y) {
return -x;
}
[x, y] = sort([x, y]) def code(x, y): return -x
x, y = sort([x, y]) function code(x, y) return Float64(-x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = -x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := (-x)
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-x
\end{array}
Initial program 63.6%
associate-/l*79.6%
associate-+l+79.6%
Simplified79.6%
Taylor expanded in x around 0 51.0%
Taylor expanded in y around 0 15.4%
neg-mul-115.4%
Simplified15.4%
Taylor expanded in y around inf 3.4%
neg-mul-13.4%
Simplified3.4%
Final simplification3.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 2024071
(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))))