
(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 21 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 (/ (/ x (+ y x)) (+ x (+ y 1.0)))) (+ y x)))
assert(x < y);
double code(double x, double y) {
return (y * ((x / (y + x)) / (x + (y + 1.0)))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * ((x / (y + x)) / (x + (y + 1.0d0)))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
return (y * ((x / (y + x)) / (x + (y + 1.0)))) / (y + x);
}
[x, y] = sort([x, y]) def code(x, y): return (y * ((x / (y + x)) / (x + (y + 1.0)))) / (y + x)
x, y = sort([x, y]) function code(x, y) return Float64(Float64(y * Float64(Float64(x / Float64(y + x)) / Float64(x + Float64(y + 1.0)))) / Float64(y + x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (y * ((x / (y + x)) / (x + (y + 1.0)))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(y * N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y \cdot \frac{\frac{x}{y + x}}{x + \left(y + 1\right)}}{y + x}
\end{array}
Initial program 65.4%
*-commutative65.4%
associate-*l*65.4%
times-frac93.8%
+-commutative93.8%
+-commutative93.8%
associate-+r+93.8%
+-commutative93.8%
associate-+l+93.8%
Applied egg-rr93.8%
associate-*l/93.8%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2e+57)
(/ (* y (/ 1.0 x)) (+ y x))
(if (<= x -38000000.0)
(/ (/ x (+ y 1.0)) (+ y x))
(if (<= x -1.3e-38)
(/ 1.0 (* x (/ (+ x 1.0) y)))
(if (<= x -1.9e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153)
(* (/ 1.0 (+ x 1.0)) (/ y (+ y x)))
(/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -38000000.0) {
tmp = (x / (y + 1.0)) / (y + x);
} else if (x <= -1.3e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.9e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = (1.0 / (x + 1.0)) * (y / (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 <= (-2d+57)) then
tmp = (y * (1.0d0 / x)) / (y + x)
else if (x <= (-38000000.0d0)) then
tmp = (x / (y + 1.0d0)) / (y + x)
else if (x <= (-1.3d-38)) then
tmp = 1.0d0 / (x * ((x + 1.0d0) / y))
else if (x <= (-1.9d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = (1.0d0 / (x + 1.0d0)) * (y / (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 <= -2e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -38000000.0) {
tmp = (x / (y + 1.0)) / (y + x);
} else if (x <= -1.3e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.9e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = (1.0 / (x + 1.0)) * (y / (y + x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2e+57: tmp = (y * (1.0 / x)) / (y + x) elif x <= -38000000.0: tmp = (x / (y + 1.0)) / (y + x) elif x <= -1.3e-38: tmp = 1.0 / (x * ((x + 1.0) / y)) elif x <= -1.9e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = (1.0 / (x + 1.0)) * (y / (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 <= -2e+57) tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y + x)); elseif (x <= -38000000.0) tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); elseif (x <= -1.3e-38) tmp = Float64(1.0 / Float64(x * Float64(Float64(x + 1.0) / y))); elseif (x <= -1.9e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(Float64(1.0 / Float64(x + 1.0)) * Float64(y / 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 <= -2e+57)
tmp = (y * (1.0 / x)) / (y + x);
elseif (x <= -38000000.0)
tmp = (x / (y + 1.0)) / (y + x);
elseif (x <= -1.3e-38)
tmp = 1.0 / (x * ((x + 1.0) / y));
elseif (x <= -1.9e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = (1.0 / (x + 1.0)) * (y / (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, -2e+57], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -38000000.0], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-38], N[(1.0 / N[(x * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.9e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+57}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\
\mathbf{elif}\;x \leq -38000000:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-38}:\\
\;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{1}{x + 1} \cdot \frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.0000000000000001e57Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.8%
if -2.0000000000000001e57 < x < -3.8e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 61.4%
+-commutative61.4%
Simplified61.4%
if -3.8e7 < x < -1.30000000000000005e-38Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
associate-*r/99.8%
associate-+r+99.8%
clear-num99.3%
associate-/l*99.6%
pow299.6%
+-commutative99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
Applied egg-rr99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 58.3%
associate-/l*58.3%
+-commutative58.3%
Simplified58.3%
if -1.30000000000000005e-38 < x < -1.8999999999999999e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.8999999999999999e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 29.0%
+-commutative29.0%
Simplified29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (+ x 1.0)))))
(if (<= x -2.65e+57)
t_0
(if (<= x -35000000.0)
(/ (/ x y) (+ y x))
(if (<= x -2.15e-38)
t_0
(if (or (<= x -1.2e-85) (not (<= x -4.1e-153)))
(/ x (* y (+ y 1.0)))
(/ y (+ y x))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (x <= -2.65e+57) {
tmp = t_0;
} else if (x <= -35000000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.15e-38) {
tmp = t_0;
} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (x * (x + 1.0d0))
if (x <= (-2.65d+57)) then
tmp = t_0
else if (x <= (-35000000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-2.15d-38)) then
tmp = t_0
else if ((x <= (-1.2d-85)) .or. (.not. (x <= (-4.1d-153)))) then
tmp = x / (y * (y + 1.0d0))
else
tmp = y / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (x <= -2.65e+57) {
tmp = t_0;
} else if (x <= -35000000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.15e-38) {
tmp = t_0;
} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x * (x + 1.0)) tmp = 0 if x <= -2.65e+57: tmp = t_0 elif x <= -35000000.0: tmp = (x / y) / (y + x) elif x <= -2.15e-38: tmp = t_0 elif (x <= -1.2e-85) or not (x <= -4.1e-153): tmp = x / (y * (y + 1.0)) else: tmp = y / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * Float64(x + 1.0))) tmp = 0.0 if (x <= -2.65e+57) tmp = t_0; elseif (x <= -35000000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -2.15e-38) tmp = t_0; elseif ((x <= -1.2e-85) || !(x <= -4.1e-153)) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(y / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / (x * (x + 1.0));
tmp = 0.0;
if (x <= -2.65e+57)
tmp = t_0;
elseif (x <= -35000000.0)
tmp = (x / y) / (y + x);
elseif (x <= -2.15e-38)
tmp = t_0;
elseif ((x <= -1.2e-85) || ~((x <= -4.1e-153)))
tmp = x / (y * (y + 1.0));
else
tmp = y / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.65e+57], t$95$0, If[LessEqual[x, -35000000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.15e-38], t$95$0, If[Or[LessEqual[x, -1.2e-85], N[Not[LessEqual[x, -4.1e-153]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -2.65 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -35000000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + x}\\
\end{array}
\end{array}
if x < -2.64999999999999993e57 or -3.5e7 < x < -2.1500000000000001e-38Initial program 58.4%
associate-/l*74.1%
associate-+l+74.1%
Simplified74.1%
Taylor expanded in y around 0 79.7%
+-commutative79.7%
Simplified79.7%
if -2.64999999999999993e57 < x < -3.5e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -2.1500000000000001e-38 < x < -1.2e-85 or -4.1e-153 < x Initial program 66.0%
associate-/l*77.6%
associate-+l+77.6%
Simplified77.6%
Taylor expanded in x around 0 60.9%
if -1.2e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
Final simplification63.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (+ x 1.0)))))
(if (<= x -1.5e+57)
t_0
(if (<= x -15200000.0)
(/ (/ x y) (+ y x))
(if (<= x -1.7e-38)
t_0
(if (<= x -1.2e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0)))))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / (x * (x + 1.0));
double tmp;
if (x <= -1.5e+57) {
tmp = t_0;
} else if (x <= -15200000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -1.7e-38) {
tmp = t_0;
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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) :: t_0
real(8) :: tmp
t_0 = y / (x * (x + 1.0d0))
if (x <= (-1.5d+57)) then
tmp = t_0
else if (x <= (-15200000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-1.7d-38)) then
tmp = t_0
else if (x <= (-1.2d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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 t_0 = y / (x * (x + 1.0));
double tmp;
if (x <= -1.5e+57) {
tmp = t_0;
} else if (x <= -15200000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -1.7e-38) {
tmp = t_0;
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (y + x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / (x * (x + 1.0)) tmp = 0 if x <= -1.5e+57: tmp = t_0 elif x <= -15200000.0: tmp = (x / y) / (y + x) elif x <= -1.7e-38: tmp = t_0 elif x <= -1.2e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (y + x) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(x * Float64(x + 1.0))) tmp = 0.0 if (x <= -1.5e+57) tmp = t_0; elseif (x <= -15200000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -1.7e-38) tmp = t_0; elseif (x <= -1.2e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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)
t_0 = y / (x * (x + 1.0));
tmp = 0.0;
if (x <= -1.5e+57)
tmp = t_0;
elseif (x <= -15200000.0)
tmp = (x / y) / (y + x);
elseif (x <= -1.7e-38)
tmp = t_0;
elseif (x <= -1.2e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e+57], t$95$0, If[LessEqual[x, -15200000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.7e-38], t$95$0, If[LessEqual[x, -1.2e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -15200000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.5e57 or -1.52e7 < x < -1.7000000000000001e-38Initial program 58.4%
associate-/l*74.1%
associate-+l+74.1%
Simplified74.1%
Taylor expanded in y around 0 79.7%
+-commutative79.7%
Simplified79.7%
if -1.5e57 < x < -1.52e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -1.7000000000000001e-38 < x < -1.2e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.2e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.15e+57)
(/ (/ y x) (+ x 1.0))
(if (<= x -14500000.0)
(/ (/ x y) (+ y x))
(if (<= x -2.25e-38)
(/ y (* x (+ x 1.0)))
(if (<= x -1.2e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.15e+57) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -14500000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.25e-38) {
tmp = y / (x * (x + 1.0));
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.15d+57)) then
tmp = (y / x) / (x + 1.0d0)
else if (x <= (-14500000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-2.25d-38)) then
tmp = y / (x * (x + 1.0d0))
else if (x <= (-1.2d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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.15e+57) {
tmp = (y / x) / (x + 1.0);
} else if (x <= -14500000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.25e-38) {
tmp = y / (x * (x + 1.0));
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.15e+57: tmp = (y / x) / (x + 1.0) elif x <= -14500000.0: tmp = (x / y) / (y + x) elif x <= -2.25e-38: tmp = y / (x * (x + 1.0)) elif x <= -1.2e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (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.15e+57) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (x <= -14500000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -2.25e-38) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif (x <= -1.2e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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.15e+57)
tmp = (y / x) / (x + 1.0);
elseif (x <= -14500000.0)
tmp = (x / y) / (y + x);
elseif (x <= -2.25e-38)
tmp = y / (x * (x + 1.0));
elseif (x <= -1.2e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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.15e+57], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -14500000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.25e-38], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.2e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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.15 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;x \leq -14500000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.1499999999999999e57Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 82.7%
associate-/r*87.5%
Simplified87.5%
if -1.1499999999999999e57 < x < -1.45e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -1.45e7 < x < -2.25000000000000004e-38Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in y around 0 58.5%
+-commutative58.5%
Simplified58.5%
if -2.25000000000000004e-38 < x < -1.2e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.2e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.46e+57)
(/ (/ y x) (+ y x))
(if (<= x -20500000.0)
(/ (/ x y) (+ y x))
(if (<= x -2.25e-38)
(/ y (* x (+ x 1.0)))
(if (<= x -1.25e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.46e+57) {
tmp = (y / x) / (y + x);
} else if (x <= -20500000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.25e-38) {
tmp = y / (x * (x + 1.0));
} else if (x <= -1.25e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.46d+57)) then
tmp = (y / x) / (y + x)
else if (x <= (-20500000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-2.25d-38)) then
tmp = y / (x * (x + 1.0d0))
else if (x <= (-1.25d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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.46e+57) {
tmp = (y / x) / (y + x);
} else if (x <= -20500000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -2.25e-38) {
tmp = y / (x * (x + 1.0));
} else if (x <= -1.25e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.46e+57: tmp = (y / x) / (y + x) elif x <= -20500000.0: tmp = (x / y) / (y + x) elif x <= -2.25e-38: tmp = y / (x * (x + 1.0)) elif x <= -1.25e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (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.46e+57) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -20500000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -2.25e-38) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif (x <= -1.25e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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.46e+57)
tmp = (y / x) / (y + x);
elseif (x <= -20500000.0)
tmp = (x / y) / (y + x);
elseif (x <= -2.25e-38)
tmp = y / (x * (x + 1.0));
elseif (x <= -1.25e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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.46e+57], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -20500000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.25e-38], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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.46 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -20500000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.46e57Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.9%
if -1.46e57 < x < -2.05e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -2.05e7 < x < -2.25000000000000004e-38Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in y around 0 58.5%
+-commutative58.5%
Simplified58.5%
if -2.25000000000000004e-38 < x < -1.25e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.25e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -8.5e+56)
(/ (/ y x) (+ y x))
(if (<= x -15800000.0)
(/ (/ x y) (+ y x))
(if (<= x -1.02e-38)
(/ 1.0 (* x (/ (+ x 1.0) y)))
(if (<= x -1.65e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8.5e+56) {
tmp = (y / x) / (y + x);
} else if (x <= -15800000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -1.02e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.65e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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 <= (-8.5d+56)) then
tmp = (y / x) / (y + x)
else if (x <= (-15800000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-1.02d-38)) then
tmp = 1.0d0 / (x * ((x + 1.0d0) / y))
else if (x <= (-1.65d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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 <= -8.5e+56) {
tmp = (y / x) / (y + x);
} else if (x <= -15800000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -1.02e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.65e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (y + x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8.5e+56: tmp = (y / x) / (y + x) elif x <= -15800000.0: tmp = (x / y) / (y + x) elif x <= -1.02e-38: tmp = 1.0 / (x * ((x + 1.0) / y)) elif x <= -1.65e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (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 <= -8.5e+56) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -15800000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -1.02e-38) tmp = Float64(1.0 / Float64(x * Float64(Float64(x + 1.0) / y))); elseif (x <= -1.65e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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 <= -8.5e+56)
tmp = (y / x) / (y + x);
elseif (x <= -15800000.0)
tmp = (x / y) / (y + x);
elseif (x <= -1.02e-38)
tmp = 1.0 / (x * ((x + 1.0) / y));
elseif (x <= -1.65e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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, -8.5e+56], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -15800000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.02e-38], N[(1.0 / N[(x * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.65e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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 -8.5 \cdot 10^{+56}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -15800000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -1.02 \cdot 10^{-38}:\\
\;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -8.4999999999999998e56Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.9%
if -8.4999999999999998e56 < x < -1.58e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -1.58e7 < x < -1.01999999999999998e-38Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
associate-*r/99.8%
associate-+r+99.8%
clear-num99.3%
associate-/l*99.6%
pow299.6%
+-commutative99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
Applied egg-rr99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 58.3%
associate-/l*58.3%
+-commutative58.3%
Simplified58.3%
if -1.01999999999999998e-38 < x < -1.64999999999999986e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.64999999999999986e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1.15e+57)
(/ (* y (/ 1.0 x)) (+ y x))
(if (<= x -30000000.0)
(/ (/ x y) (+ y x))
(if (<= x -7.5e-39)
(/ 1.0 (* x (/ (+ x 1.0) y)))
(if (<= x -1.4e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1.15e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -30000000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -7.5e-39) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.4e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.15d+57)) then
tmp = (y * (1.0d0 / x)) / (y + x)
else if (x <= (-30000000.0d0)) then
tmp = (x / y) / (y + x)
else if (x <= (-7.5d-39)) then
tmp = 1.0d0 / (x * ((x + 1.0d0) / y))
else if (x <= (-1.4d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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.15e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -30000000.0) {
tmp = (x / y) / (y + x);
} else if (x <= -7.5e-39) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.4e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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.15e+57: tmp = (y * (1.0 / x)) / (y + x) elif x <= -30000000.0: tmp = (x / y) / (y + x) elif x <= -7.5e-39: tmp = 1.0 / (x * ((x + 1.0) / y)) elif x <= -1.4e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (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.15e+57) tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y + x)); elseif (x <= -30000000.0) tmp = Float64(Float64(x / y) / Float64(y + x)); elseif (x <= -7.5e-39) tmp = Float64(1.0 / Float64(x * Float64(Float64(x + 1.0) / y))); elseif (x <= -1.4e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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.15e+57)
tmp = (y * (1.0 / x)) / (y + x);
elseif (x <= -30000000.0)
tmp = (x / y) / (y + x);
elseif (x <= -7.5e-39)
tmp = 1.0 / (x * ((x + 1.0) / y));
elseif (x <= -1.4e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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.15e+57], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -30000000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.5e-39], N[(1.0 / N[(x * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.4e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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.15 \cdot 10^{+57}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\
\mathbf{elif}\;x \leq -30000000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.1499999999999999e57Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.8%
if -1.1499999999999999e57 < x < -3e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.0%
if -3e7 < x < -7.49999999999999971e-39Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
associate-*r/99.8%
associate-+r+99.8%
clear-num99.3%
associate-/l*99.6%
pow299.6%
+-commutative99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
Applied egg-rr99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 58.3%
associate-/l*58.3%
+-commutative58.3%
Simplified58.3%
if -7.49999999999999971e-39 < x < -1.40000000000000008e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.40000000000000008e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -1e+57)
(/ (* y (/ 1.0 x)) (+ y x))
(if (<= x -59000000.0)
(/ (/ x (+ y 1.0)) (+ y x))
(if (<= x -2.25e-38)
(/ 1.0 (* x (/ (+ x 1.0) y)))
(if (<= x -1.2e-85)
(/ x (* y (+ y 1.0)))
(if (<= x -4.1e-153) (/ y (+ y x)) (/ (/ x y) (+ y 1.0))))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -1e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -59000000.0) {
tmp = (x / (y + 1.0)) / (y + x);
} else if (x <= -2.25e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (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 <= (-1d+57)) then
tmp = (y * (1.0d0 / x)) / (y + x)
else if (x <= (-59000000.0d0)) then
tmp = (x / (y + 1.0d0)) / (y + x)
else if (x <= (-2.25d-38)) then
tmp = 1.0d0 / (x * ((x + 1.0d0) / y))
else if (x <= (-1.2d-85)) then
tmp = x / (y * (y + 1.0d0))
else if (x <= (-4.1d-153)) then
tmp = y / (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 <= -1e+57) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -59000000.0) {
tmp = (x / (y + 1.0)) / (y + x);
} else if (x <= -2.25e-38) {
tmp = 1.0 / (x * ((x + 1.0) / y));
} else if (x <= -1.2e-85) {
tmp = x / (y * (y + 1.0));
} else if (x <= -4.1e-153) {
tmp = y / (y + x);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -1e+57: tmp = (y * (1.0 / x)) / (y + x) elif x <= -59000000.0: tmp = (x / (y + 1.0)) / (y + x) elif x <= -2.25e-38: tmp = 1.0 / (x * ((x + 1.0) / y)) elif x <= -1.2e-85: tmp = x / (y * (y + 1.0)) elif x <= -4.1e-153: tmp = y / (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 <= -1e+57) tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y + x)); elseif (x <= -59000000.0) tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); elseif (x <= -2.25e-38) tmp = Float64(1.0 / Float64(x * Float64(Float64(x + 1.0) / y))); elseif (x <= -1.2e-85) tmp = Float64(x / Float64(y * Float64(y + 1.0))); elseif (x <= -4.1e-153) tmp = Float64(y / 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 <= -1e+57)
tmp = (y * (1.0 / x)) / (y + x);
elseif (x <= -59000000.0)
tmp = (x / (y + 1.0)) / (y + x);
elseif (x <= -2.25e-38)
tmp = 1.0 / (x * ((x + 1.0) / y));
elseif (x <= -1.2e-85)
tmp = x / (y * (y + 1.0));
elseif (x <= -4.1e-153)
tmp = y / (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, -1e+57], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -59000000.0], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.25e-38], N[(1.0 / N[(x * N[(N[(x + 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.2e-85], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.1e-153], N[(y / 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 \cdot 10^{+57}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\
\mathbf{elif}\;x \leq -59000000:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\
\;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.00000000000000005e57Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.8%
if -1.00000000000000005e57 < x < -5.9e7Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
associate-*l/99.7%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 61.4%
+-commutative61.4%
Simplified61.4%
if -5.9e7 < x < -2.25000000000000004e-38Initial program 99.8%
associate-/l*100.0%
associate-+l+100.0%
Simplified100.0%
associate-*r/99.8%
associate-+r+99.8%
clear-num99.3%
associate-/l*99.6%
pow299.6%
+-commutative99.6%
associate-+r+99.6%
+-commutative99.6%
associate-+l+99.6%
*-commutative99.6%
Applied egg-rr99.6%
/-rgt-identity99.6%
/-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 58.3%
associate-/l*58.3%
+-commutative58.3%
Simplified58.3%
if -2.25000000000000004e-38 < x < -1.2e-85Initial program 93.1%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 77.2%
if -1.2e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
if -4.1e-153 < x Initial program 63.7%
associate-/l*76.3%
associate-+l+76.3%
Simplified76.3%
Taylor expanded in x around 0 59.5%
associate-/r*62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.58e-158)
(/ (/ y x) (+ x 1.0))
(if (<= y 1.24e-147)
(/ x y)
(if (<= y 1.45e-8)
(/ (* y x) (* (+ x 1.0) (* (+ y x) (+ y x))))
(if (<= y 1.8e+132)
(/ x (* (+ y x) (+ y (+ x 1.0))))
(/ (/ x (+ y x)) (+ (+ y x) 1.0)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.24e-147) {
tmp = x / y;
} else if (y <= 1.45e-8) {
tmp = (y * x) / ((x + 1.0) * ((y + x) * (y + x)));
} else if (y <= 1.8e+132) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.58d-158) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 1.24d-147) then
tmp = x / y
else if (y <= 1.45d-8) then
tmp = (y * x) / ((x + 1.0d0) * ((y + x) * (y + x)))
else if (y <= 1.8d+132) then
tmp = x / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / (y + x)) / ((y + x) + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.24e-147) {
tmp = x / y;
} else if (y <= 1.45e-8) {
tmp = (y * x) / ((x + 1.0) * ((y + x) * (y + x)));
} else if (y <= 1.8e+132) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.58e-158: tmp = (y / x) / (x + 1.0) elif y <= 1.24e-147: tmp = x / y elif y <= 1.45e-8: tmp = (y * x) / ((x + 1.0) * ((y + x) * (y + x))) elif y <= 1.8e+132: tmp = x / ((y + x) * (y + (x + 1.0))) else: tmp = (x / (y + x)) / ((y + x) + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.58e-158) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 1.24e-147) tmp = Float64(x / y); elseif (y <= 1.45e-8) tmp = Float64(Float64(y * x) / Float64(Float64(x + 1.0) * Float64(Float64(y + x) * Float64(y + x)))); elseif (y <= 1.8e+132) tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + x) + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.58e-158)
tmp = (y / x) / (x + 1.0);
elseif (y <= 1.24e-147)
tmp = x / y;
elseif (y <= 1.45e-8)
tmp = (y * x) / ((x + 1.0) * ((y + x) * (y + x)));
elseif (y <= 1.8e+132)
tmp = x / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / (y + x)) / ((y + x) + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.58e-158], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.24e-147], N[(x / y), $MachinePrecision], If[LessEqual[y, 1.45e-8], N[(N[(y * x), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+132], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 1.24 \cdot 10^{-147}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-8}:\\
\;\;\;\;\frac{y \cdot x}{\left(x + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\
\end{array}
\end{array}
if y < 1.57999999999999994e-158Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac93.0%
+-commutative93.0%
+-commutative93.0%
associate-+r+93.0%
+-commutative93.0%
associate-+l+93.0%
Applied egg-rr93.0%
associate-*l/93.0%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 51.7%
associate-/r*54.1%
Simplified54.1%
if 1.57999999999999994e-158 < y < 1.2400000000000001e-147Initial program 28.0%
associate-/l*90.1%
associate-+l+90.1%
Simplified90.1%
Taylor expanded in x around 0 76.0%
Taylor expanded in y around 0 76.0%
if 1.2400000000000001e-147 < y < 1.4500000000000001e-8Initial program 85.2%
Taylor expanded in y around 0 84.6%
+-commutative84.6%
Simplified84.6%
if 1.4500000000000001e-8 < y < 1.80000000000000008e132Initial program 64.1%
*-commutative64.1%
associate-*l*64.1%
times-frac96.8%
+-commutative96.8%
+-commutative96.8%
associate-+r+96.8%
+-commutative96.8%
associate-+l+96.8%
Applied egg-rr96.8%
Taylor expanded in y around inf 72.9%
if 1.80000000000000008e132 < y Initial program 68.8%
*-commutative68.8%
associate-*l*68.8%
times-frac88.8%
+-commutative88.8%
+-commutative88.8%
associate-+r+88.8%
+-commutative88.8%
associate-+l+88.8%
Applied egg-rr88.8%
Taylor expanded in y around inf 88.8%
add-exp-log85.1%
associate-/r*84.4%
+-commutative84.4%
log-div75.0%
+-commutative75.0%
associate-+r+75.0%
+-commutative75.0%
log1p-define75.0%
+-commutative75.0%
Applied egg-rr75.0%
exp-diff74.9%
rem-exp-log90.1%
log1p-undefine90.1%
rem-exp-log91.7%
Simplified91.7%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -4.2e+58)
(/ (* y (/ 1.0 x)) (+ y x))
(if (<= x -8.2e-166)
(* x (/ y (* (+ x (+ y 1.0)) (* (+ y x) (+ y x)))))
(/ (/ x y) (+ y 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4.2e+58) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -8.2e-166) {
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.2d+58)) then
tmp = (y * (1.0d0 / x)) / (y + x)
else if (x <= (-8.2d-166)) then
tmp = x * (y / ((x + (y + 1.0d0)) * ((y + x) * (y + x))))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4.2e+58) {
tmp = (y * (1.0 / x)) / (y + x);
} else if (x <= -8.2e-166) {
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4.2e+58: tmp = (y * (1.0 / x)) / (y + x) elif x <= -8.2e-166: tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x)))) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4.2e+58) tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y + x)); elseif (x <= -8.2e-166) tmp = Float64(x * Float64(y / Float64(Float64(x + Float64(y + 1.0)) * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4.2e+58)
tmp = (y * (1.0 / x)) / (y + x);
elseif (x <= -8.2e-166)
tmp = x * (y / ((x + (y + 1.0)) * ((y + x) * (y + x))));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4.2e+58], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.2e-166], N[(x * N[(y / N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $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 -4.2 \cdot 10^{+58}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-166}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.20000000000000024e58Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.8%
if -4.20000000000000024e58 < x < -8.1999999999999995e-166Initial program 88.2%
associate-/l*95.1%
associate-+l+95.1%
Simplified95.1%
if -8.1999999999999995e-166 < x Initial program 63.5%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in x around 0 59.3%
associate-/r*61.9%
+-commutative61.9%
Simplified61.9%
Final simplification72.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -8e-39)
(/ y (* x (+ x 1.0)))
(if (or (<= x -1.2e-85) (not (<= x -4.1e-153)))
(/ x (* y (+ y 1.0)))
(/ y (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8e-39) {
tmp = y / (x * (x + 1.0));
} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-8d-39)) then
tmp = y / (x * (x + 1.0d0))
else if ((x <= (-1.2d-85)) .or. (.not. (x <= (-4.1d-153)))) then
tmp = x / (y * (y + 1.0d0))
else
tmp = y / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -8e-39) {
tmp = y / (x * (x + 1.0));
} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8e-39: tmp = y / (x * (x + 1.0)) elif (x <= -1.2e-85) or not (x <= -4.1e-153): tmp = x / (y * (y + 1.0)) else: tmp = y / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8e-39) tmp = Float64(y / Float64(x * Float64(x + 1.0))); elseif ((x <= -1.2e-85) || !(x <= -4.1e-153)) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = Float64(y / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -8e-39)
tmp = y / (x * (x + 1.0));
elseif ((x <= -1.2e-85) || ~((x <= -4.1e-153)))
tmp = x / (y * (y + 1.0));
else
tmp = y / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -8e-39], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.2e-85], N[Not[LessEqual[x, -4.1e-153]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + x}\\
\end{array}
\end{array}
if x < -7.99999999999999943e-39Initial program 60.2%
associate-/l*74.6%
associate-+l+74.6%
Simplified74.6%
Taylor expanded in y around 0 76.6%
+-commutative76.6%
Simplified76.6%
if -7.99999999999999943e-39 < x < -1.2e-85 or -4.1e-153 < x Initial program 66.0%
associate-/l*77.6%
associate-+l+77.6%
Simplified77.6%
Taylor expanded in x around 0 60.9%
if -1.2e-85 < x < -4.1e-153Initial program 79.9%
*-commutative79.9%
associate-*l*79.9%
times-frac99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
associate-*l/99.8%
associate-/r*99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 29.0%
Taylor expanded in x around 0 29.0%
Final simplification62.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -7.5e+58) (/ (* y (/ 1.0 x)) (+ y x)) (* x (/ (/ y (* (+ y x) (+ y (+ x 1.0)))) (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -7.5e+58) {
tmp = (y * (1.0 / x)) / (y + x);
} else {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.5d+58)) then
tmp = (y * (1.0d0 / x)) / (y + x)
else
tmp = x * ((y / ((y + x) * (y + (x + 1.0d0)))) / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -7.5e+58) {
tmp = (y * (1.0 / x)) / (y + x);
} else {
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -7.5e+58: tmp = (y * (1.0 / x)) / (y + x) else: tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -7.5e+58) tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y + x)); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -7.5e+58)
tmp = (y * (1.0 / x)) / (y + x);
else
tmp = x * ((y / ((y + x) * (y + (x + 1.0)))) / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -7.5e+58], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+58}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}}{y + x}\\
\end{array}
\end{array}
if x < -7.5000000000000001e58Initial program 52.5%
*-commutative52.5%
associate-*l*52.5%
times-frac87.6%
+-commutative87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
associate-+l+87.6%
Applied egg-rr87.6%
associate-*l/87.6%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 87.8%
if -7.5000000000000001e58 < x Initial program 68.5%
associate-/l*80.0%
associate-+l+80.0%
Simplified80.0%
*-un-lft-identity80.0%
associate-+r+80.0%
associate-*l*80.0%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l+92.1%
Applied egg-rr92.1%
associate-*l/92.2%
*-lft-identity92.2%
+-commutative92.2%
Simplified92.2%
Final simplification91.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.6e+143) (/ (* y (/ 1.0 (+ x (+ y 1.0)))) (+ y x)) (* (/ x (* (+ y x) (+ y (+ x 1.0)))) (/ y (+ y x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.6e+143) {
tmp = (y * (1.0 / (x + (y + 1.0)))) / (y + x);
} else {
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / (y + x));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.6d+143)) then
tmp = (y * (1.0d0 / (x + (y + 1.0d0)))) / (y + x)
else
tmp = (x / ((y + x) * (y + (x + 1.0d0)))) * (y / (y + x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.6e+143) {
tmp = (y * (1.0 / (x + (y + 1.0)))) / (y + x);
} else {
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / (y + x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.6e+143: tmp = (y * (1.0 / (x + (y + 1.0)))) / (y + x) else: tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / (y + x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.6e+143) tmp = Float64(Float64(y * Float64(1.0 / Float64(x + Float64(y + 1.0)))) / Float64(y + x)); else tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))) * Float64(y / Float64(y + x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.6e+143)
tmp = (y * (1.0 / (x + (y + 1.0)))) / (y + x);
else
tmp = (x / ((y + x) * (y + (x + 1.0)))) * (y / (y + x));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.6e+143], N[(N[(y * N[(1.0 / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+143}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x + \left(y + 1\right)}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{y}{y + x}\\
\end{array}
\end{array}
if x < -2.5999999999999999e143Initial program 57.0%
*-commutative57.0%
associate-*l*57.0%
times-frac85.8%
+-commutative85.8%
+-commutative85.8%
associate-+r+85.8%
+-commutative85.8%
associate-+l+85.8%
Applied egg-rr85.8%
associate-*l/85.8%
associate-/r*99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 93.2%
if -2.5999999999999999e143 < x Initial program 66.6%
*-commutative66.6%
associate-*l*66.6%
times-frac94.9%
+-commutative94.9%
+-commutative94.9%
associate-+r+94.9%
+-commutative94.9%
associate-+l+94.9%
Applied egg-rr94.9%
Final simplification94.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.58e-158)
(/ (/ y x) (+ x 1.0))
(if (<= y 3e+77)
(/ x (* (+ y x) (+ y (+ x 1.0))))
(/ (/ x (+ y 1.0)) (+ y x)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3e+77) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.58d-158) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 3d+77) then
tmp = x / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 3e+77) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.58e-158: tmp = (y / x) / (x + 1.0) elif y <= 3e+77: tmp = x / ((y + x) * (y + (x + 1.0))) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.58e-158) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 3e+77) tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.58e-158)
tmp = (y / x) / (x + 1.0);
elseif (y <= 3e+77)
tmp = x / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / (y + 1.0)) / (y + x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.58e-158], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+77], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if y < 1.57999999999999994e-158Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac93.0%
+-commutative93.0%
+-commutative93.0%
associate-+r+93.0%
+-commutative93.0%
associate-+l+93.0%
Applied egg-rr93.0%
associate-*l/93.0%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 51.7%
associate-/r*54.1%
Simplified54.1%
if 1.57999999999999994e-158 < y < 2.9999999999999998e77Initial program 77.0%
*-commutative77.0%
associate-*l*76.9%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 70.7%
if 2.9999999999999998e77 < y Initial program 62.0%
*-commutative62.0%
associate-*l*62.0%
times-frac90.3%
+-commutative90.3%
+-commutative90.3%
associate-+r+90.3%
+-commutative90.3%
associate-+l+90.3%
Applied egg-rr90.3%
associate-*l/90.4%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 78.8%
+-commutative78.8%
Simplified78.8%
Final simplification62.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= y 1.58e-158)
(/ (/ y x) (+ x 1.0))
(if (<= y 1.8e+132)
(/ x (* (+ y x) (+ y (+ x 1.0))))
(/ (/ x (+ y x)) (+ (+ y x) 1.0)))))assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.8e+132) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.58d-158) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 1.8d+132) then
tmp = x / ((y + x) * (y + (x + 1.0d0)))
else
tmp = (x / (y + x)) / ((y + x) + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.58e-158) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 1.8e+132) {
tmp = x / ((y + x) * (y + (x + 1.0)));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.58e-158: tmp = (y / x) / (x + 1.0) elif y <= 1.8e+132: tmp = x / ((y + x) * (y + (x + 1.0))) else: tmp = (x / (y + x)) / ((y + x) + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.58e-158) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 1.8e+132) tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + x) + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.58e-158)
tmp = (y / x) / (x + 1.0);
elseif (y <= 1.8e+132)
tmp = x / ((y + x) * (y + (x + 1.0)));
else
tmp = (x / (y + x)) / ((y + x) + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.58e-158], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+132], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\
\end{array}
\end{array}
if y < 1.57999999999999994e-158Initial program 62.7%
*-commutative62.7%
associate-*l*62.7%
times-frac93.0%
+-commutative93.0%
+-commutative93.0%
associate-+r+93.0%
+-commutative93.0%
associate-+l+93.0%
Applied egg-rr93.0%
associate-*l/93.0%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 51.7%
associate-/r*54.1%
Simplified54.1%
if 1.57999999999999994e-158 < y < 1.80000000000000008e132Initial program 70.2%
*-commutative70.2%
associate-*l*70.1%
times-frac98.2%
+-commutative98.2%
+-commutative98.2%
associate-+r+98.2%
+-commutative98.2%
associate-+l+98.2%
Applied egg-rr98.2%
Taylor expanded in y around inf 69.5%
if 1.80000000000000008e132 < y Initial program 68.8%
*-commutative68.8%
associate-*l*68.8%
times-frac88.8%
+-commutative88.8%
+-commutative88.8%
associate-+r+88.8%
+-commutative88.8%
associate-+l+88.8%
Applied egg-rr88.8%
Taylor expanded in y around inf 88.8%
add-exp-log85.1%
associate-/r*84.4%
+-commutative84.4%
log-div75.0%
+-commutative75.0%
associate-+r+75.0%
+-commutative75.0%
log1p-define75.0%
+-commutative75.0%
Applied egg-rr75.0%
exp-diff74.9%
rem-exp-log90.1%
log1p-undefine90.1%
rem-exp-log91.7%
Simplified91.7%
Final simplification62.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 8.2e-162) (/ y (+ y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 8.2e-162) {
tmp = y / (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 <= 8.2d-162) then
tmp = y / (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 <= 8.2e-162) {
tmp = y / (y + x);
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 8.2e-162: tmp = y / (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 <= 8.2e-162) tmp = Float64(y / 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 <= 8.2e-162)
tmp = y / (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, 8.2e-162], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.2 \cdot 10^{-162}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 8.20000000000000039e-162Initial program 62.8%
*-commutative62.8%
associate-*l*62.8%
times-frac92.9%
+-commutative92.9%
+-commutative92.9%
associate-+r+92.9%
+-commutative92.9%
associate-+l+92.9%
Applied egg-rr92.9%
associate-*l/92.9%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 54.5%
Taylor expanded in x around 0 30.0%
if 8.20000000000000039e-162 < y Initial program 69.4%
associate-/l*80.7%
associate-+l+80.7%
Simplified80.7%
Taylor expanded in x around 0 61.4%
Final simplification42.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.9e-226) (- (/ y x) y) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.9e-226) {
tmp = (y / x) - y;
} 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 (y <= 1.9d-226) then
tmp = (y / x) - y
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.9e-226) {
tmp = (y / x) - y;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.9e-226: tmp = (y / x) - y else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.9e-226) tmp = Float64(Float64(y / x) - y); 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 (y <= 1.9e-226)
tmp = (y / x) - y;
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[y, 1.9e-226], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-226}:\\
\;\;\;\;\frac{y}{x} - y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 1.89999999999999991e-226Initial program 61.8%
*-commutative61.8%
associate-*l*61.8%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l+92.1%
Applied egg-rr92.1%
associate-*l/92.1%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 48.5%
associate-/r*51.2%
Simplified51.2%
Taylor expanded in x around 0 12.7%
+-commutative12.7%
neg-mul-112.7%
unsub-neg12.7%
Simplified12.7%
if 1.89999999999999991e-226 < y Initial program 69.8%
associate-/l*80.6%
associate-+l+80.6%
Simplified80.6%
Taylor expanded in x around 0 56.4%
Taylor expanded in y around 0 32.5%
Final simplification21.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -4e-181) (/ y (+ y x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -4e-181) {
tmp = y / (y + x);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4d-181)) then
tmp = y / (y + x)
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -4e-181) {
tmp = y / (y + x);
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -4e-181: tmp = y / (y + x) else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -4e-181) tmp = Float64(y / Float64(y + x)); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -4e-181)
tmp = y / (y + x);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -4e-181], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-181}:\\
\;\;\;\;\frac{y}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.00000000000000019e-181Initial program 69.3%
*-commutative69.3%
associate-*l*69.3%
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%
associate-/r*99.8%
+-commutative99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 62.0%
Taylor expanded in x around 0 27.6%
if -4.00000000000000019e-181 < x Initial program 63.2%
associate-/l*76.1%
associate-+l+76.1%
Simplified76.1%
Taylor expanded in x around 0 59.0%
Taylor expanded in y around 0 38.0%
Final simplification34.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -0.002) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -0.002) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.002d0)) then
tmp = 1.0d0 / x
else
tmp = x / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -0.002) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -0.002: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -0.002) tmp = Float64(1.0 / x); else tmp = Float64(x / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -0.002)
tmp = 1.0 / x;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -0.002], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.002:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2e-3Initial program 58.9%
*-commutative58.9%
associate-*l*58.9%
times-frac89.6%
+-commutative89.6%
+-commutative89.6%
associate-+r+89.6%
+-commutative89.6%
associate-+l+89.6%
Applied egg-rr89.6%
Taylor expanded in y around inf 52.8%
Taylor expanded in x around inf 6.6%
if -2e-3 < x Initial program 67.4%
associate-/l*79.5%
associate-+l+79.5%
Simplified79.5%
Taylor expanded in x around 0 62.3%
Taylor expanded in y around 0 37.8%
Final simplification30.6%
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 65.4%
associate-/l*78.2%
associate-+l+78.2%
Simplified78.2%
Taylor expanded in x around 0 52.2%
Taylor expanded in y around 0 29.6%
Final simplification29.6%
(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 2024039
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))