
(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 (* (/ y (+ y x)) (* (/ 1.0 (+ y (+ x 1.0))) (/ x (+ y x)))))
assert(x < y);
double code(double x, double y) {
return (y / (y + x)) * ((1.0 / (y + (x + 1.0))) * (x / (y + x)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + x)) * ((1.0d0 / (y + (x + 1.0d0))) * (x / (y + x)))
end function
assert x < y;
public static double code(double x, double y) {
return (y / (y + x)) * ((1.0 / (y + (x + 1.0))) * (x / (y + x)));
}
[x, y] = sort([x, y]) def code(x, y): return (y / (y + x)) * ((1.0 / (y + (x + 1.0))) * (x / (y + x)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y / Float64(y + x)) * Float64(Float64(1.0 / Float64(y + Float64(x + 1.0))) * Float64(x / Float64(y + x)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y / (y + x)) * ((1.0 / (y + (x + 1.0))) * (x / (y + x)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{y + x} \cdot \left(\frac{1}{y + \left(x + 1\right)} \cdot \frac{x}{y + x}\right)
\end{array}
Initial program 66.0%
*-commutative66.0%
associate-*l*66.0%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
associate-+r+91.1%
+-commutative91.1%
associate-+l+91.1%
Applied egg-rr91.1%
*-un-lft-identity91.1%
distribute-rgt-in87.9%
+-commutative87.9%
distribute-rgt-in91.1%
*-commutative91.1%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.15e+158)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -5.5e+21)
(* (/ x (* (+ y x) (+ y (+ x 1.0)))) (/ y x))
(if (<= x -1.5e-162)
(* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
(/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.15e+158) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.5e+21) {
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / x);
} else if (x <= -1.5e-162) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.15d+158)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-5.5d+21)) then
tmp = (x / ((y + x) * (y + (x + 1.0d0)))) * (y / x)
else if (x <= (-1.5d-162)) then
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.15e+158) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -5.5e+21) {
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / x);
} else if (x <= -1.5e-162) {
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.15e+158: tmp = (y / (y + x)) * (1.0 / x) elif x <= -5.5e+21: tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / x) elif x <= -1.5e-162: tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0)))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.15e+158) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -5.5e+21) tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) * Float64(y / x)); elseif (x <= -1.5e-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) / 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.15e+158)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -5.5e+21)
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / x);
elseif (x <= -1.5e-162)
tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.15e+158], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.5e+21], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-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] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+158}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{+21}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -1.5 \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}}{y + 1}\\
\end{array}
\end{array}
if x < -2.15e158Initial program 54.1%
*-commutative54.1%
associate-*l*54.1%
times-frac71.2%
+-commutative71.2%
+-commutative71.2%
associate-+r+71.2%
+-commutative71.2%
associate-+l+71.2%
Applied egg-rr71.2%
Taylor expanded in x around inf 85.5%
if -2.15e158 < x < -5.5e21Initial program 56.5%
*-commutative56.5%
associate-*l*56.5%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l+87.0%
Applied egg-rr87.0%
Taylor expanded in y around 0 78.3%
if -5.5e21 < x < -1.49999999999999999e-162Initial program 80.8%
associate-/l*93.7%
associate-+l+93.7%
Simplified93.7%
if -1.49999999999999999e-162 < x Initial program 66.5%
*-commutative66.5%
associate-*l*66.4%
times-frac93.7%
+-commutative93.7%
+-commutative93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
Applied egg-rr93.7%
*-un-lft-identity93.7%
distribute-rgt-in92.4%
+-commutative92.4%
distribute-rgt-in93.7%
*-commutative93.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 52.1%
associate-/r*50.8%
+-commutative50.8%
Simplified50.8%
Final simplification63.4%
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 (<= y -5e-284)
(* (/ y (+ y x)) (/ 1.0 t_0))
(if (<= y 1.5e+123)
(* x (/ (/ y (* (+ y x) t_0)) (+ y x)))
(* (/ (/ 1.0 (+ y x)) (/ (+ y x) y)) (/ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= -5e-284) {
tmp = (y / (y + x)) * (1.0 / t_0);
} else if (y <= 1.5e+123) {
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
} else {
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (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 (y <= (-5d-284)) then
tmp = (y / (y + x)) * (1.0d0 / t_0)
else if (y <= 1.5d+123) then
tmp = x * ((y / ((y + x) * t_0)) / (y + x))
else
tmp = ((1.0d0 / (y + x)) / ((y + x) / y)) * (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 (y <= -5e-284) {
tmp = (y / (y + x)) * (1.0 / t_0);
} else if (y <= 1.5e+123) {
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
} else {
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= -5e-284: tmp = (y / (y + x)) * (1.0 / t_0) elif y <= 1.5e+123: tmp = x * ((y / ((y + x) * t_0)) / (y + x)) else: tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (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 (y <= -5e-284) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / t_0)); elseif (y <= 1.5e+123) tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * t_0)) / Float64(y + x))); else tmp = Float64(Float64(Float64(1.0 / Float64(y + x)) / Float64(Float64(y + x) / y)) * 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 (y <= -5e-284)
tmp = (y / (y + x)) * (1.0 / t_0);
elseif (y <= 1.5e+123)
tmp = x * ((y / ((y + x) * t_0)) / (y + x));
else
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (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[y, -5e-284], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+123], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $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}\;y \leq -5 \cdot 10^{-284}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{t\_0}\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+123}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot t\_0}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y + x}}{\frac{y + x}{y}} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -4.99999999999999973e-284Initial program 75.9%
*-commutative75.9%
associate-*l*75.9%
times-frac91.9%
+-commutative91.9%
+-commutative91.9%
associate-+r+91.9%
+-commutative91.9%
associate-+l+91.9%
Applied egg-rr91.9%
*-un-lft-identity91.9%
distribute-rgt-in90.3%
+-commutative90.3%
distribute-rgt-in91.9%
*-commutative91.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 51.3%
if -4.99999999999999973e-284 < y < 1.50000000000000004e123Initial program 58.9%
associate-/l*73.6%
associate-+l+73.6%
Simplified73.6%
*-un-lft-identity73.6%
associate-+r+73.6%
associate-*l*73.6%
times-frac93.3%
+-commutative93.3%
+-commutative93.3%
associate-+r+93.3%
+-commutative93.3%
associate-+l+93.3%
Applied egg-rr93.3%
associate-*l/93.3%
*-lft-identity93.3%
+-commutative93.3%
Simplified93.3%
if 1.50000000000000004e123 < y Initial program 49.8%
*-commutative49.8%
associate-*l*49.8%
times-frac77.2%
+-commutative77.2%
+-commutative77.2%
associate-+r+77.2%
+-commutative77.2%
associate-+l+77.2%
Applied egg-rr77.2%
clear-num77.2%
associate-/r*99.8%
+-commutative99.8%
frac-times99.7%
metadata-eval99.7%
times-frac99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
div-inv99.7%
*-commutative99.7%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 87.2%
Final simplification70.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y x))) (t_1 (+ y (+ x 1.0))))
(if (<= y -1.58e+41)
(* t_0 (/ 1.0 t_1))
(if (<= y 5.8e+134)
(* t_0 (/ x (* (+ y x) t_1)))
(* (/ (/ 1.0 (+ y x)) (/ (+ y x) y)) (/ x y))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (y + x);
double t_1 = y + (x + 1.0);
double tmp;
if (y <= -1.58e+41) {
tmp = t_0 * (1.0 / t_1);
} else if (y <= 5.8e+134) {
tmp = t_0 * (x / ((y + x) * t_1));
} else {
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (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) :: t_1
real(8) :: tmp
t_0 = y / (y + x)
t_1 = y + (x + 1.0d0)
if (y <= (-1.58d+41)) then
tmp = t_0 * (1.0d0 / t_1)
else if (y <= 5.8d+134) then
tmp = t_0 * (x / ((y + x) * t_1))
else
tmp = ((1.0d0 / (y + x)) / ((y + x) / y)) * (x / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (y + x);
double t_1 = y + (x + 1.0);
double tmp;
if (y <= -1.58e+41) {
tmp = t_0 * (1.0 / t_1);
} else if (y <= 5.8e+134) {
tmp = t_0 * (x / ((y + x) * t_1));
} else {
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (x / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (y + x) t_1 = y + (x + 1.0) tmp = 0 if y <= -1.58e+41: tmp = t_0 * (1.0 / t_1) elif y <= 5.8e+134: tmp = t_0 * (x / ((y + x) * t_1)) else: tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (x / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(y + x)) t_1 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= -1.58e+41) tmp = Float64(t_0 * Float64(1.0 / t_1)); elseif (y <= 5.8e+134) tmp = Float64(t_0 * Float64(x / Float64(Float64(y + x) * t_1))); else tmp = Float64(Float64(Float64(1.0 / Float64(y + x)) / Float64(Float64(y + x) / y)) * Float64(x / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (y + x);
t_1 = y + (x + 1.0);
tmp = 0.0;
if (y <= -1.58e+41)
tmp = t_0 * (1.0 / t_1);
elseif (y <= 5.8e+134)
tmp = t_0 * (x / ((y + x) * t_1));
else
tmp = ((1.0 / (y + x)) / ((y + x) / y)) * (x / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.58e+41], N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+134], N[(t$95$0 * N[(x / N[(N[(y + x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{y + x}\\
t_1 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq -1.58 \cdot 10^{+41}:\\
\;\;\;\;t\_0 \cdot \frac{1}{t\_1}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+134}:\\
\;\;\;\;t\_0 \cdot \frac{x}{\left(y + x\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y + x}}{\frac{y + x}{y}} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -1.5799999999999999e41Initial program 67.7%
*-commutative67.7%
associate-*l*67.7%
times-frac82.9%
+-commutative82.9%
+-commutative82.9%
associate-+r+82.9%
+-commutative82.9%
associate-+l+82.9%
Applied egg-rr82.9%
*-un-lft-identity82.9%
distribute-rgt-in79.4%
+-commutative79.4%
distribute-rgt-in82.9%
*-commutative82.9%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 26.7%
if -1.5799999999999999e41 < y < 5.80000000000000023e134Initial program 70.0%
*-commutative70.0%
associate-*l*69.9%
times-frac98.7%
+-commutative98.7%
+-commutative98.7%
associate-+r+98.7%
+-commutative98.7%
associate-+l+98.7%
Applied egg-rr98.7%
if 5.80000000000000023e134 < y Initial program 49.6%
*-commutative49.6%
associate-*l*49.6%
times-frac76.1%
+-commutative76.1%
+-commutative76.1%
associate-+r+76.1%
+-commutative76.1%
associate-+l+76.1%
Applied egg-rr76.1%
clear-num76.1%
associate-/r*99.9%
+-commutative99.9%
frac-times99.7%
metadata-eval99.7%
times-frac99.7%
*-un-lft-identity99.7%
*-un-lft-identity99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
div-inv99.7%
*-commutative99.7%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 86.7%
Final simplification79.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.7e+159)
(* (/ y (+ y x)) (/ 1.0 x))
(if (<= x -3.4e-115)
(* (/ x (* (+ y x) (+ y (+ x 1.0)))) (/ y x))
(/ (/ x y) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.7e+159) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -3.4e-115) {
tmp = (x / ((y + x) * (y + (x + 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.7d+159)) then
tmp = (y / (y + x)) * (1.0d0 / x)
else if (x <= (-3.4d-115)) then
tmp = (x / ((y + x) * (y + (x + 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.7e+159) {
tmp = (y / (y + x)) * (1.0 / x);
} else if (x <= -3.4e-115) {
tmp = (x / ((y + x) * (y + (x + 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.7e+159: tmp = (y / (y + x)) * (1.0 / x) elif x <= -3.4e-115: tmp = (x / ((y + x) * (y + (x + 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.7e+159) tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x)); elseif (x <= -3.4e-115) tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 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.7e+159)
tmp = (y / (y + x)) * (1.0 / x);
elseif (x <= -3.4e-115)
tmp = (x / ((y + x) * (y + (x + 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.7e+159], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.4e-115], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+159}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-115}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.69999999999999996e159Initial program 54.1%
*-commutative54.1%
associate-*l*54.1%
times-frac71.2%
+-commutative71.2%
+-commutative71.2%
associate-+r+71.2%
+-commutative71.2%
associate-+l+71.2%
Applied egg-rr71.2%
Taylor expanded in x around inf 85.5%
if -1.69999999999999996e159 < x < -3.3999999999999998e-115Initial program 70.6%
*-commutative70.6%
associate-*l*70.7%
times-frac94.0%
+-commutative94.0%
+-commutative94.0%
associate-+r+94.0%
+-commutative94.0%
associate-+l+94.0%
Applied egg-rr94.0%
Taylor expanded in y around 0 73.4%
if -3.3999999999999998e-115 < x Initial program 66.9%
*-commutative66.9%
associate-*l*66.9%
times-frac94.0%
+-commutative94.0%
+-commutative94.0%
associate-+r+94.0%
+-commutative94.0%
associate-+l+94.0%
Applied egg-rr94.0%
*-un-lft-identity94.0%
distribute-rgt-in92.7%
+-commutative92.7%
distribute-rgt-in94.0%
*-commutative94.0%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 53.1%
associate-/r*52.0%
+-commutative52.0%
Simplified52.0%
Final simplification60.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.6e-224)
(/ y x)
(if (<= y 2.3e-167)
(/ x y)
(if (<= y 2.5e-98) (/ y x) (/ x (* y (+ y 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.6e-224) {
tmp = y / x;
} else if (y <= 2.3e-167) {
tmp = x / y;
} else if (y <= 2.5e-98) {
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 (y <= 1.6d-224) then
tmp = y / x
else if (y <= 2.3d-167) then
tmp = x / y
else if (y <= 2.5d-98) 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 (y <= 1.6e-224) {
tmp = y / x;
} else if (y <= 2.3e-167) {
tmp = x / y;
} else if (y <= 2.5e-98) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.6e-224: tmp = y / x elif y <= 2.3e-167: tmp = x / y elif y <= 2.5e-98: 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 (y <= 1.6e-224) tmp = Float64(y / x); elseif (y <= 2.3e-167) tmp = Float64(x / y); elseif (y <= 2.5e-98) 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 (y <= 1.6e-224)
tmp = y / x;
elseif (y <= 2.3e-167)
tmp = x / y;
elseif (y <= 2.5e-98)
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[y, 1.6e-224], N[(y / x), $MachinePrecision], If[LessEqual[y, 2.3e-167], N[(x / y), $MachinePrecision], If[LessEqual[y, 2.5e-98], 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}\;y \leq 1.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-167}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.5999999999999999e-224 or 2.3000000000000001e-167 < y < 2.50000000000000009e-98Initial program 72.7%
associate-/l*81.2%
associate-+l+81.2%
Simplified81.2%
associate-*r/72.7%
associate-+r+72.7%
associate-/r*75.0%
clear-num74.9%
associate-+r+74.9%
+-commutative74.9%
associate-+l+74.9%
*-commutative74.9%
associate-/l*84.5%
pow284.5%
+-commutative84.5%
Applied egg-rr84.5%
associate-/r/84.6%
*-commutative84.6%
associate-*l*82.6%
+-commutative82.6%
Simplified82.6%
Taylor expanded in y around 0 55.1%
Taylor expanded in x around 0 33.5%
if 1.5999999999999999e-224 < y < 2.3000000000000001e-167Initial program 45.8%
associate-/l*52.6%
associate-+l+52.6%
Simplified52.6%
Taylor expanded in x around 0 38.8%
+-commutative38.8%
Simplified38.8%
Taylor expanded in y around 0 38.8%
if 2.50000000000000009e-98 < y Initial program 54.7%
associate-/l*75.6%
associate-+l+75.6%
Simplified75.6%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Final simplification41.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ (/ y (+ x 1.0)) x) (/ (/ x y) (* (+ y (+ x 1.0)) (/ (+ y x) y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / y) / ((y + (x + 1.0)) * ((y + 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 <= 3.1d-97) then
tmp = (y / (x + 1.0d0)) / x
else
tmp = (x / y) / ((y + (x + 1.0d0)) * ((y + x) / y))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / y) / ((y + (x + 1.0)) * ((y + x) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-97: tmp = (y / (x + 1.0)) / x else: tmp = (x / y) / ((y + (x + 1.0)) * ((y + x) / y)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-97) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(x / y) / Float64(Float64(y + Float64(x + 1.0)) * Float64(Float64(y + x) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-97)
tmp = (y / (x + 1.0)) / x;
else
tmp = (x / y) / ((y + (x + 1.0)) * ((y + 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, 3.1e-97], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(y + \left(x + 1\right)\right) \cdot \frac{y + x}{y}}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
associate-*r/71.0%
associate-+r+71.0%
associate-/r*73.2%
clear-num73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
*-commutative73.1%
associate-/l*82.5%
pow282.5%
+-commutative82.5%
Applied egg-rr82.5%
associate-/r/82.6%
*-commutative82.6%
associate-*l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in y around 0 55.6%
un-div-inv55.7%
+-commutative55.7%
*-commutative55.7%
associate-/r*59.3%
Applied egg-rr59.3%
if 3.10000000000000002e-97 < y Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
clear-num84.8%
associate-/r*99.7%
+-commutative99.7%
frac-times98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-un-lft-identity98.8%
+-commutative98.8%
+-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 79.0%
Final simplification65.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (* (/ x (+ y (+ x 1.0))) (/ (/ 1.0 (+ y x)) (/ (+ y x) y))))
assert(x < y);
double code(double x, double y) {
return (x / (y + (x + 1.0))) * ((1.0 / (y + x)) / ((y + 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 + (x + 1.0d0))) * ((1.0d0 / (y + x)) / ((y + x) / y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (y + (x + 1.0))) * ((1.0 / (y + x)) / ((y + x) / y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (y + (x + 1.0))) * ((1.0 / (y + x)) / ((y + x) / y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(y + Float64(x + 1.0))) * Float64(Float64(1.0 / Float64(y + x)) / Float64(Float64(y + x) / y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (y + (x + 1.0))) * ((1.0 / (y + x)) / ((y + x) / y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + \left(x + 1\right)} \cdot \frac{\frac{1}{y + x}}{\frac{y + x}{y}}
\end{array}
Initial program 66.0%
*-commutative66.0%
associate-*l*66.0%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
associate-+r+91.1%
+-commutative91.1%
associate-+l+91.1%
Applied egg-rr91.1%
clear-num91.1%
associate-/r*99.7%
+-commutative99.7%
frac-times99.4%
metadata-eval99.4%
times-frac99.4%
*-un-lft-identity99.4%
*-un-lft-identity99.4%
+-commutative99.4%
+-commutative99.4%
Applied egg-rr99.4%
div-inv99.4%
*-commutative99.4%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ x (* (+ y x) (/ (+ y x) y))) (+ y (+ x 1.0))))
assert(x < y);
double code(double x, double y) {
return (x / ((y + x) * ((y + x) / 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 / ((y + x) * ((y + x) / y))) / (y + (x + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
return (x / ((y + x) * ((y + x) / y))) / (y + (x + 1.0));
}
[x, y] = sort([x, y]) def code(x, y): return (x / ((y + x) * ((y + x) / y))) / (y + (x + 1.0))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(Float64(y + x) * Float64(Float64(y + x) / y))) / Float64(y + Float64(x + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / ((y + x) * ((y + x) / 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[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{\left(y + x\right) \cdot \frac{y + x}{y}}}{y + \left(x + 1\right)}
\end{array}
Initial program 66.0%
*-commutative66.0%
associate-*l*66.0%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
associate-+r+91.1%
+-commutative91.1%
associate-+l+91.1%
Applied egg-rr91.1%
*-un-lft-identity91.1%
distribute-rgt-in87.9%
+-commutative87.9%
distribute-rgt-in91.1%
*-commutative91.1%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
clear-num99.7%
+-commutative99.7%
associate-*l/99.7%
*-un-lft-identity99.7%
frac-times99.4%
*-un-lft-identity99.4%
associate-/r*99.7%
associate-/l/99.4%
+-commutative99.4%
+-commutative99.4%
Applied egg-rr99.4%
Final simplification99.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ x (+ y x)) (* (+ y (+ x 1.0)) (+ 1.0 (/ x y)))))
assert(x < y);
double code(double x, double y) {
return (x / (y + x)) / ((y + (x + 1.0)) * (1.0 + (x / y)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y + x)) / ((y + (x + 1.0d0)) * (1.0d0 + (x / y)))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (y + x)) / ((y + (x + 1.0)) * (1.0 + (x / y)));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (y + x)) / ((y + (x + 1.0)) * (1.0 + (x / y)))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + Float64(x + 1.0)) * Float64(1.0 + Float64(x / y)))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (y + x)) / ((y + (x + 1.0)) * (1.0 + (x / y)));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{y + x}}{\left(y + \left(x + 1\right)\right) \cdot \left(1 + \frac{x}{y}\right)}
\end{array}
Initial program 66.0%
*-commutative66.0%
associate-*l*66.0%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
associate-+r+91.1%
+-commutative91.1%
associate-+l+91.1%
Applied egg-rr91.1%
clear-num91.1%
associate-/r*99.7%
+-commutative99.7%
frac-times99.4%
metadata-eval99.4%
times-frac99.4%
*-un-lft-identity99.4%
*-un-lft-identity99.4%
+-commutative99.4%
+-commutative99.4%
Applied egg-rr99.4%
Taylor expanded in x around 0 99.4%
Final simplification99.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ (/ y (+ x 1.0)) x) (/ (/ x (+ y x)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / (y + x)) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.1d-97) then
tmp = (y / (x + 1.0d0)) / x
else
tmp = (x / (y + x)) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / (x + 1.0)) / x;
} else {
tmp = (x / (y + x)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-97: tmp = (y / (x + 1.0)) / x else: tmp = (x / (y + x)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-97) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-97)
tmp = (y / (x + 1.0)) / x;
else
tmp = (x / (y + x)) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.1e-97], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + 1}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
associate-*r/71.0%
associate-+r+71.0%
associate-/r*73.2%
clear-num73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
*-commutative73.1%
associate-/l*82.5%
pow282.5%
+-commutative82.5%
Applied egg-rr82.5%
associate-/r/82.6%
*-commutative82.6%
associate-*l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in y around 0 55.6%
un-div-inv55.7%
+-commutative55.7%
*-commutative55.7%
associate-/r*59.3%
Applied egg-rr59.3%
if 3.10000000000000002e-97 < y Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
clear-num84.8%
associate-/r*99.7%
+-commutative99.7%
frac-times98.8%
metadata-eval98.8%
times-frac98.8%
*-un-lft-identity98.8%
*-un-lft-identity98.8%
+-commutative98.8%
+-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 60.4%
+-commutative60.4%
Simplified60.4%
Final simplification59.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.1d-97) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-97: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-97) 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 (y <= 3.1e-97)
tmp = y / (x * (x + 1.0));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.1e-97], 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}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
Taylor expanded in y around 0 55.7%
if 3.10000000000000002e-97 < y Initial program 54.7%
associate-/l*75.6%
associate-+l+75.6%
Simplified75.6%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Final simplification56.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.1d-97) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-97: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-97) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-97)
tmp = y / (x * (x + 1.0));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.1e-97], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
Taylor expanded in y around 0 55.7%
if 3.10000000000000002e-97 < y Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
*-un-lft-identity84.8%
distribute-rgt-in77.0%
+-commutative77.0%
distribute-rgt-in84.8%
*-commutative84.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 59.1%
associate-/r*59.8%
+-commutative59.8%
Simplified59.8%
Final simplification56.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.1d-97) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.1e-97: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 3.1e-97) 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 (y <= 3.1e-97)
tmp = (y / x) / (x + 1.0);
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.1e-97], 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}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
Taylor expanded in y around 0 55.7%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
if 3.10000000000000002e-97 < y Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
*-un-lft-identity84.8%
distribute-rgt-in77.0%
+-commutative77.0%
distribute-rgt-in84.8%
*-commutative84.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 59.1%
associate-/r*59.8%
+-commutative59.8%
Simplified59.8%
Final simplification59.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.1e-97) (/ (/ y (+ x 1.0)) x) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.1e-97) {
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 (y <= 3.1d-97) 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 (y <= 3.1e-97) {
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 y <= 3.1e-97: 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 (y <= 3.1e-97) tmp = Float64(Float64(y / Float64(x + 1.0)) / x); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 3.1e-97)
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[y, 3.1e-97], N[(N[(y / N[(x + 1.0), $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}\;y \leq 3.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.10000000000000002e-97Initial program 71.0%
associate-/l*79.4%
associate-+l+79.4%
Simplified79.4%
associate-*r/71.0%
associate-+r+71.0%
associate-/r*73.2%
clear-num73.1%
associate-+r+73.1%
+-commutative73.1%
associate-+l+73.1%
*-commutative73.1%
associate-/l*82.5%
pow282.5%
+-commutative82.5%
Applied egg-rr82.5%
associate-/r/82.6%
*-commutative82.6%
associate-*l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in y around 0 55.6%
un-div-inv55.7%
+-commutative55.7%
*-commutative55.7%
associate-/r*59.3%
Applied egg-rr59.3%
if 3.10000000000000002e-97 < y Initial program 54.7%
*-commutative54.7%
associate-*l*54.7%
times-frac84.8%
+-commutative84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
associate-+l+84.8%
Applied egg-rr84.8%
*-un-lft-identity84.8%
distribute-rgt-in77.0%
+-commutative77.0%
distribute-rgt-in84.8%
*-commutative84.8%
times-frac99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 59.1%
associate-/r*59.8%
+-commutative59.8%
Simplified59.8%
Final simplification59.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -1.02e-197) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.02e-197) {
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.02d-197)) 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.02e-197) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1.02e-197: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -1.02e-197) 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.02e-197)
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.02e-197], 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.02 \cdot 10^{-197}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.0199999999999999e-197Initial program 63.2%
associate-/l*76.1%
associate-+l+76.1%
Simplified76.1%
associate-*r/63.2%
associate-+r+63.2%
associate-/r*69.0%
clear-num68.9%
associate-+r+68.9%
+-commutative68.9%
associate-+l+68.9%
*-commutative68.9%
associate-/l*83.6%
pow283.6%
+-commutative83.6%
Applied egg-rr83.6%
associate-/r/83.8%
*-commutative83.8%
associate-*l*80.9%
+-commutative80.9%
Simplified80.9%
Taylor expanded in y around 0 54.3%
Taylor expanded in x around 0 26.7%
if -1.0199999999999999e-197 < x Initial program 67.7%
associate-/l*79.5%
associate-+l+79.5%
Simplified79.5%
Taylor expanded in x around 0 52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in y around 0 31.1%
Final simplification29.4%
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 66.0%
associate-/l*78.2%
associate-+l+78.2%
Simplified78.2%
Taylor expanded in x around 0 46.9%
+-commutative46.9%
Simplified46.9%
Taylor expanded in y around 0 22.4%
Final simplification22.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 2024079
(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))))