
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ (/ x (+ x y)) (* (+ x y) (/ (+ x (+ y 1.0)) y))))
assert(x < y);
double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / 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 / (x + y)) / ((x + y) * ((x + (y + 1.0d0)) / y))
end function
assert x < y;
public static double code(double x, double y) {
return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y));
}
[x, y] = sort([x, y]) def code(x, y): return (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y))
x, y = sort([x, y]) function code(x, y) return Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(x + Float64(y + 1.0)) / y))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (x / (x + y)) / ((x + y) * ((x + (y + 1.0)) / y));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\left(x + y\right) \cdot \frac{x + \left(y + 1\right)}{y}}
\end{array}
Initial program 76.3%
associate-/r*79.9%
+-commutative79.9%
+-commutative79.9%
+-commutative79.9%
associate-/r*76.3%
associate-*l/84.9%
*-commutative84.9%
*-commutative84.9%
distribute-rgt1-in65.7%
fma-def84.9%
+-commutative84.9%
+-commutative84.9%
cube-unmult85.0%
+-commutative85.0%
Simplified85.0%
associate-*r/76.4%
fma-udef60.3%
cube-mult60.3%
distribute-rgt1-in76.3%
associate-+r+76.3%
*-commutative76.3%
*-commutative76.3%
frac-times91.5%
associate-/r*99.8%
clear-num99.7%
frac-times99.3%
*-un-lft-identity99.3%
Applied egg-rr99.3%
Final simplification99.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.1e+17)
(/ (/ y (+ x (+ y 1.0))) x)
(if (<= x -2.2e-159)
(* (/ y (* (+ x y) (+ x y))) (/ x (+ y 1.0)))
(if (<= x -2.7e-224)
(/ (/ y (+ x y)) (+ (+ y 1.0) (/ y x)))
(/ (/ x y) (+ y 1.0))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = (y / (x + (y + 1.0))) / x;
} else if (x <= -2.2e-159) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
} else if (x <= -2.7e-224) {
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.1d+17)) then
tmp = (y / (x + (y + 1.0d0))) / x
else if (x <= (-2.2d-159)) then
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0d0))
else if (x <= (-2.7d-224)) then
tmp = (y / (x + y)) / ((y + 1.0d0) + (y / x))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = (y / (x + (y + 1.0))) / x;
} else if (x <= -2.2e-159) {
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
} else if (x <= -2.7e-224) {
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = (y / (x + (y + 1.0))) / x elif x <= -2.2e-159: tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0)) elif x <= -2.7e-224: tmp = (y / (x + y)) / ((y + 1.0) + (y / x)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x); elseif (x <= -2.2e-159) tmp = Float64(Float64(y / Float64(Float64(x + y) * Float64(x + y))) * Float64(x / Float64(y + 1.0))); elseif (x <= -2.7e-224) tmp = Float64(Float64(y / Float64(x + y)) / Float64(Float64(y + 1.0) + Float64(y / x))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.1e+17)
tmp = (y / (x + (y + 1.0))) / x;
elseif (x <= -2.2e-159)
tmp = (y / ((x + y) * (x + y))) * (x / (y + 1.0));
elseif (x <= -2.7e-224)
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.1e+17], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -2.2e-159], N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.7e-224], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-159}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{y + 1}\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-224}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{\left(y + 1\right) + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
times-frac93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around inf 87.3%
associate-*l/87.3%
*-un-lft-identity87.3%
Applied egg-rr87.3%
if -2.1e17 < x < -2.2e-159Initial program 88.0%
associate-/r*90.2%
+-commutative90.2%
+-commutative90.2%
+-commutative90.2%
associate-/l/88.0%
times-frac99.6%
*-commutative99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in x around 0 99.2%
+-commutative99.2%
Simplified99.2%
if -2.2e-159 < x < -2.69999999999999998e-224Initial program 51.4%
associate-/r*51.4%
+-commutative51.4%
+-commutative51.4%
+-commutative51.4%
associate-/l/51.4%
times-frac56.6%
*-commutative56.6%
+-commutative56.6%
+-commutative56.6%
+-commutative56.6%
associate-+l+56.6%
Simplified56.6%
Taylor expanded in x around 0 56.6%
+-commutative56.6%
Simplified56.6%
*-commutative56.6%
clear-num56.6%
associate-/r*99.7%
frac-times99.6%
*-un-lft-identity99.6%
Applied egg-rr99.6%
Taylor expanded in y around 0 84.6%
distribute-rgt-in84.6%
*-lft-identity84.6%
associate-+r+84.6%
+-commutative84.6%
associate-*l/84.7%
*-lft-identity84.7%
Simplified84.7%
if -2.69999999999999998e-224 < x Initial program 78.3%
times-frac93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around 0 58.1%
associate-/r*56.5%
+-commutative56.5%
Simplified56.5%
Final simplification71.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3.5e-17) (* (/ x (* (+ x y) (+ x y))) (/ y (+ x (+ y 1.0)))) (/ (/ y (+ x y)) (* (+ x y) (/ (+ y 1.0) x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3.5e-17) {
tmp = (x / ((x + y) * (x + y))) * (y / (x + (y + 1.0)));
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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 <= (-3.5d-17)) then
tmp = (x / ((x + y) * (x + y))) * (y / (x + (y + 1.0d0)))
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0d0) / x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3.5e-17) {
tmp = (x / ((x + y) * (x + y))) * (y / (x + (y + 1.0)));
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3.5e-17: tmp = (x / ((x + y) * (x + y))) * (y / (x + (y + 1.0))) else: tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3.5e-17) tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(y / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(y + 1.0) / x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3.5e-17)
tmp = (x / ((x + y) * (x + y))) * (y / (x + (y + 1.0)));
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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, -3.5e-17], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{x}}\\
\end{array}
\end{array}
if x < -3.5000000000000002e-17Initial program 74.4%
times-frac93.8%
associate-+l+93.8%
Simplified93.8%
if -3.5000000000000002e-17 < x Initial program 76.9%
associate-/r*79.3%
+-commutative79.3%
+-commutative79.3%
+-commutative79.3%
associate-/l/76.9%
times-frac90.8%
*-commutative90.8%
+-commutative90.8%
+-commutative90.8%
+-commutative90.8%
associate-+l+90.8%
Simplified90.8%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
Simplified83.9%
*-commutative83.9%
clear-num83.9%
associate-/r*92.4%
frac-times82.8%
*-un-lft-identity82.8%
Applied egg-rr82.8%
Final simplification85.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -3e-17) (* (/ y (* (+ x y) (+ x y))) (/ x (+ x (+ y 1.0)))) (/ (/ y (+ x y)) (* (+ x y) (/ (+ y 1.0) x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -3e-17) {
tmp = (y / ((x + y) * (x + y))) * (x / (x + (y + 1.0)));
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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 <= (-3d-17)) then
tmp = (y / ((x + y) * (x + y))) * (x / (x + (y + 1.0d0)))
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0d0) / x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -3e-17) {
tmp = (y / ((x + y) * (x + y))) * (x / (x + (y + 1.0)));
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -3e-17: tmp = (y / ((x + y) * (x + y))) * (x / (x + (y + 1.0))) else: tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -3e-17) tmp = Float64(Float64(y / Float64(Float64(x + y) * Float64(x + y))) * Float64(x / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(y / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(y + 1.0) / x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -3e-17)
tmp = (y / ((x + y) * (x + y))) * (x / (x + (y + 1.0)));
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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, -3e-17], N[(N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-17}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{x}}\\
\end{array}
\end{array}
if x < -3.00000000000000006e-17Initial program 74.4%
associate-/r*82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-/l/74.4%
times-frac93.8%
*-commutative93.8%
+-commutative93.8%
+-commutative93.8%
+-commutative93.8%
associate-+l+93.8%
Simplified93.8%
if -3.00000000000000006e-17 < x Initial program 76.9%
associate-/r*79.3%
+-commutative79.3%
+-commutative79.3%
+-commutative79.3%
associate-/l/76.9%
times-frac90.8%
*-commutative90.8%
+-commutative90.8%
+-commutative90.8%
+-commutative90.8%
associate-+l+90.8%
Simplified90.8%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
Simplified83.9%
*-commutative83.9%
clear-num83.9%
associate-/r*92.4%
frac-times82.8%
*-un-lft-identity82.8%
Applied egg-rr82.8%
Final simplification85.5%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* (+ x y) (+ x y)))) (t_1 (+ x (+ y 1.0))))
(if (<= y 2.1e-169)
(/ (/ y t_1) x)
(if (<= y 1.02e-17)
(* x t_0)
(if (<= y 5.7e-8) t_0 (* (/ x t_1) (/ 1.0 y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = y / ((x + y) * (x + y));
double t_1 = x + (y + 1.0);
double tmp;
if (y <= 2.1e-169) {
tmp = (y / t_1) / x;
} else if (y <= 1.02e-17) {
tmp = x * t_0;
} else if (y <= 5.7e-8) {
tmp = t_0;
} else {
tmp = (x / t_1) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / ((x + y) * (x + y))
t_1 = x + (y + 1.0d0)
if (y <= 2.1d-169) then
tmp = (y / t_1) / x
else if (y <= 1.02d-17) then
tmp = x * t_0
else if (y <= 5.7d-8) then
tmp = t_0
else
tmp = (x / t_1) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = y / ((x + y) * (x + y));
double t_1 = x + (y + 1.0);
double tmp;
if (y <= 2.1e-169) {
tmp = (y / t_1) / x;
} else if (y <= 1.02e-17) {
tmp = x * t_0;
} else if (y <= 5.7e-8) {
tmp = t_0;
} else {
tmp = (x / t_1) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = y / ((x + y) * (x + y)) t_1 = x + (y + 1.0) tmp = 0 if y <= 2.1e-169: tmp = (y / t_1) / x elif y <= 1.02e-17: tmp = x * t_0 elif y <= 5.7e-8: tmp = t_0 else: tmp = (x / t_1) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(y / Float64(Float64(x + y) * Float64(x + y))) t_1 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 2.1e-169) tmp = Float64(Float64(y / t_1) / x); elseif (y <= 1.02e-17) tmp = Float64(x * t_0); elseif (y <= 5.7e-8) tmp = t_0; else tmp = Float64(Float64(x / t_1) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = y / ((x + y) * (x + y));
t_1 = x + (y + 1.0);
tmp = 0.0;
if (y <= 2.1e-169)
tmp = (y / t_1) / x;
elseif (y <= 1.02e-17)
tmp = x * t_0;
elseif (y <= 5.7e-8)
tmp = t_0;
else
tmp = (x / t_1) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.1e-169], N[(N[(y / t$95$1), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.02e-17], N[(x * t$95$0), $MachinePrecision], If[LessEqual[y, 5.7e-8], t$95$0, N[(N[(x / t$95$1), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}\\
t_1 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 2.1 \cdot 10^{-169}:\\
\;\;\;\;\frac{\frac{y}{t_1}}{x}\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-17}:\\
\;\;\;\;x \cdot t_0\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{-8}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t_1} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 2.1000000000000001e-169Initial program 74.1%
times-frac89.3%
associate-+l+89.3%
Simplified89.3%
Taylor expanded in x around inf 56.9%
associate-*l/56.9%
*-un-lft-identity56.9%
Applied egg-rr56.9%
if 2.1000000000000001e-169 < y < 1.01999999999999997e-17Initial program 91.6%
associate-/r*91.6%
+-commutative91.6%
+-commutative91.6%
+-commutative91.6%
associate-/l/91.6%
times-frac99.0%
*-commutative99.0%
+-commutative99.0%
+-commutative99.0%
+-commutative99.0%
associate-+l+99.0%
Simplified99.0%
Taylor expanded in x around 0 79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in y around 0 79.2%
if 1.01999999999999997e-17 < y < 5.70000000000000009e-8Initial program 100.0%
associate-/r*99.2%
+-commutative99.2%
+-commutative99.2%
+-commutative99.2%
associate-/l/100.0%
times-frac100.0%
*-commutative100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 5.70000000000000009e-8 < y Initial program 72.2%
associate-/r*79.3%
+-commutative79.3%
+-commutative79.3%
+-commutative79.3%
associate-/l/72.2%
times-frac93.4%
*-commutative93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
associate-+l+93.4%
Simplified93.4%
Taylor expanded in y around inf 74.3%
Final simplification63.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= y 6.5e-280)
(/ (/ y t_0) x)
(if (<= y 1.55e-136)
(/ (/ y (+ x y)) (+ (+ y 1.0) (/ y x)))
(if (<= y 1.15e-35) (/ y (+ x (* x x))) (* (/ x t_0) (/ 1.0 y)))))))assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 6.5e-280) {
tmp = (y / t_0) / x;
} else if (y <= 1.55e-136) {
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
} else if (y <= 1.15e-35) {
tmp = y / (x + (x * x));
} else {
tmp = (x / t_0) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (y <= 6.5d-280) then
tmp = (y / t_0) / x
else if (y <= 1.55d-136) then
tmp = (y / (x + y)) / ((y + 1.0d0) + (y / x))
else if (y <= 1.15d-35) then
tmp = y / (x + (x * x))
else
tmp = (x / t_0) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 6.5e-280) {
tmp = (y / t_0) / x;
} else if (y <= 1.55e-136) {
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
} else if (y <= 1.15e-35) {
tmp = y / (x + (x * x));
} else {
tmp = (x / t_0) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 6.5e-280: tmp = (y / t_0) / x elif y <= 1.55e-136: tmp = (y / (x + y)) / ((y + 1.0) + (y / x)) elif y <= 1.15e-35: tmp = y / (x + (x * x)) else: tmp = (x / t_0) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 6.5e-280) tmp = Float64(Float64(y / t_0) / x); elseif (y <= 1.55e-136) tmp = Float64(Float64(y / Float64(x + y)) / Float64(Float64(y + 1.0) + Float64(y / x))); elseif (y <= 1.15e-35) tmp = Float64(y / Float64(x + Float64(x * x))); else tmp = Float64(Float64(x / t_0) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (y <= 6.5e-280)
tmp = (y / t_0) / x;
elseif (y <= 1.55e-136)
tmp = (y / (x + y)) / ((y + 1.0) + (y / x));
elseif (y <= 1.15e-35)
tmp = y / (x + (x * x));
else
tmp = (x / t_0) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.5e-280], N[(N[(y / t$95$0), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.55e-136], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-35], N[(y / N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 6.5 \cdot 10^{-280}:\\
\;\;\;\;\frac{\frac{y}{t_0}}{x}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-136}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{\left(y + 1\right) + \frac{y}{x}}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t_0} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 6.5000000000000005e-280Initial program 76.4%
times-frac91.9%
associate-+l+91.9%
Simplified91.9%
Taylor expanded in x around inf 52.9%
associate-*l/53.0%
*-un-lft-identity53.0%
Applied egg-rr53.0%
if 6.5000000000000005e-280 < y < 1.55e-136Initial program 57.0%
associate-/r*57.0%
+-commutative57.0%
+-commutative57.0%
+-commutative57.0%
associate-/l/57.0%
times-frac73.2%
*-commutative73.2%
+-commutative73.2%
+-commutative73.2%
+-commutative73.2%
associate-+l+73.2%
Simplified73.2%
Taylor expanded in x around 0 59.9%
+-commutative59.9%
Simplified59.9%
*-commutative59.9%
clear-num59.8%
associate-/r*86.4%
frac-times82.6%
*-un-lft-identity82.6%
Applied egg-rr82.6%
Taylor expanded in y around 0 82.6%
distribute-rgt-in82.6%
*-lft-identity82.6%
associate-+r+82.6%
+-commutative82.6%
associate-*l/82.6%
*-lft-identity82.6%
Simplified82.6%
if 1.55e-136 < y < 1.1499999999999999e-35Initial program 95.9%
times-frac99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in y around 0 86.2%
distribute-lft-in86.2%
*-rgt-identity86.2%
Simplified86.2%
if 1.1499999999999999e-35 < y Initial program 75.9%
associate-/r*82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-/l/75.9%
times-frac94.2%
*-commutative94.2%
+-commutative94.2%
+-commutative94.2%
+-commutative94.2%
associate-+l+94.2%
Simplified94.2%
Taylor expanded in y around inf 71.4%
Final simplification63.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.1e+17) (/ (/ y (+ x (+ y 1.0))) x) (/ (/ y (+ x y)) (* (+ x y) (/ (+ y 1.0) x)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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.1d+17)) then
tmp = (y / (x + (y + 1.0d0))) / x
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0d0) / x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = (y / (x + (y + 1.0))) / x else: tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / x)) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x); else tmp = Float64(Float64(y / Float64(x + y)) / Float64(Float64(x + y) * Float64(Float64(y + 1.0) / x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.1e+17)
tmp = (y / (x + (y + 1.0))) / x;
else
tmp = (y / (x + y)) / ((x + y) * ((y + 1.0) / 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.1e+17], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{x}}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
times-frac93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around inf 87.3%
associate-*l/87.3%
*-un-lft-identity87.3%
Applied egg-rr87.3%
if -2.1e17 < x Initial program 77.8%
associate-/r*80.1%
+-commutative80.1%
+-commutative80.1%
+-commutative80.1%
associate-/l/77.8%
times-frac91.1%
*-commutative91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 84.5%
+-commutative84.5%
Simplified84.5%
*-commutative84.5%
clear-num84.5%
associate-/r*92.7%
frac-times83.4%
*-un-lft-identity83.4%
Applied egg-rr83.4%
Final simplification84.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.1e+17)
(/ y (* x x))
(if (<= x -3e-17)
(/ x (* y y))
(if (<= x -8e-185)
(/ y x)
(if (<= x 8e-180) (/ x y) (* (/ x y) (/ 1.0 y)))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -3e-17) {
tmp = x / (y * y);
} else if (x <= -8e-185) {
tmp = y / x;
} else if (x <= 8e-180) {
tmp = x / y;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.1d+17)) then
tmp = y / (x * x)
else if (x <= (-3d-17)) then
tmp = x / (y * y)
else if (x <= (-8d-185)) then
tmp = y / x
else if (x <= 8d-180) then
tmp = x / y
else
tmp = (x / y) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -3e-17) {
tmp = x / (y * y);
} else if (x <= -8e-185) {
tmp = y / x;
} else if (x <= 8e-180) {
tmp = x / y;
} else {
tmp = (x / y) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = y / (x * x) elif x <= -3e-17: tmp = x / (y * y) elif x <= -8e-185: tmp = y / x elif x <= 8e-180: tmp = x / y else: tmp = (x / y) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(y / Float64(x * x)); elseif (x <= -3e-17) tmp = Float64(x / Float64(y * y)); elseif (x <= -8e-185) tmp = Float64(y / x); elseif (x <= 8e-180) tmp = Float64(x / y); else tmp = Float64(Float64(x / y) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.1e+17)
tmp = y / (x * x);
elseif (x <= -3e-17)
tmp = x / (y * y);
elseif (x <= -8e-185)
tmp = y / x;
elseif (x <= 8e-180)
tmp = x / y;
else
tmp = (x / y) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.1e+17], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e-17], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8e-185], N[(y / x), $MachinePrecision], If[LessEqual[x, 8e-180], N[(x / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-180}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
associate-/r*79.4%
+-commutative79.4%
+-commutative79.4%
+-commutative79.4%
associate-/r*70.7%
associate-*l/84.2%
*-commutative84.2%
*-commutative84.2%
distribute-rgt1-in41.0%
fma-def84.2%
+-commutative84.2%
+-commutative84.2%
cube-unmult84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around inf 85.1%
unpow285.1%
Simplified85.1%
if -2.1e17 < x < -3.00000000000000006e-17Initial program 99.4%
associate-/r*99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-/r*99.4%
associate-*l/99.6%
*-commutative99.6%
*-commutative99.6%
distribute-rgt1-in86.7%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 85.0%
unpow285.0%
Simplified85.0%
if -3.00000000000000006e-17 < x < -7.9999999999999999e-185Initial program 74.1%
associate-/r*76.2%
+-commutative76.2%
+-commutative76.2%
+-commutative76.2%
associate-/l/74.1%
times-frac85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-+l+85.8%
Simplified85.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 52.3%
if -7.9999999999999999e-185 < x < 8.0000000000000002e-180Initial program 67.2%
associate-/r*67.1%
+-commutative67.1%
+-commutative67.1%
+-commutative67.1%
associate-/l/67.2%
times-frac81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
+-commutative81.7%
associate-+l+81.7%
Simplified81.7%
Taylor expanded in x around 0 81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in y around 0 66.6%
Taylor expanded in y around inf 79.1%
if 8.0000000000000002e-180 < x Initial program 82.9%
associate-/r*86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
associate-/r*82.9%
associate-*l/89.1%
*-commutative89.1%
*-commutative89.1%
distribute-rgt1-in77.4%
fma-def89.1%
+-commutative89.1%
+-commutative89.1%
cube-unmult89.1%
+-commutative89.1%
Simplified89.1%
Taylor expanded in y around inf 36.0%
unpow236.0%
Simplified36.0%
associate-/r*33.8%
div-inv33.7%
Applied egg-rr33.7%
Final simplification58.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))))
(if (<= x -2.1e+17)
(/ y (* x x))
(if (<= x -2.6e-17)
t_0
(if (<= x -8e-185) (/ y x) (if (<= x 9.2e-184) (/ x y) t_0))))))assert(x < y);
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -2.6e-17) {
tmp = t_0;
} else if (x <= -8e-185) {
tmp = y / x;
} else if (x <= 9.2e-184) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y * y)
if (x <= (-2.1d+17)) then
tmp = y / (x * x)
else if (x <= (-2.6d-17)) then
tmp = t_0
else if (x <= (-8d-185)) then
tmp = y / x
else if (x <= 9.2d-184) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -2.6e-17) {
tmp = t_0;
} else if (x <= -8e-185) {
tmp = y / x;
} else if (x <= 9.2e-184) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x / (y * y) tmp = 0 if x <= -2.1e+17: tmp = y / (x * x) elif x <= -2.6e-17: tmp = t_0 elif x <= -8e-185: tmp = y / x elif x <= 9.2e-184: tmp = x / y else: tmp = t_0 return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(y / Float64(x * x)); elseif (x <= -2.6e-17) tmp = t_0; elseif (x <= -8e-185) tmp = Float64(y / x); elseif (x <= 9.2e-184) tmp = Float64(x / y); else tmp = t_0; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x / (y * y);
tmp = 0.0;
if (x <= -2.1e+17)
tmp = y / (x * x);
elseif (x <= -2.6e-17)
tmp = t_0;
elseif (x <= -8e-185)
tmp = y / x;
elseif (x <= 9.2e-184)
tmp = x / y;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e+17], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-17], t$95$0, If[LessEqual[x, -8e-185], N[(y / x), $MachinePrecision], If[LessEqual[x, 9.2e-184], N[(x / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-184}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
associate-/r*79.4%
+-commutative79.4%
+-commutative79.4%
+-commutative79.4%
associate-/r*70.7%
associate-*l/84.2%
*-commutative84.2%
*-commutative84.2%
distribute-rgt1-in41.0%
fma-def84.2%
+-commutative84.2%
+-commutative84.2%
cube-unmult84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around inf 85.1%
unpow285.1%
Simplified85.1%
if -2.1e17 < x < -2.60000000000000003e-17 or 9.1999999999999998e-184 < x Initial program 84.1%
associate-/r*87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
associate-/r*84.1%
associate-*l/89.9%
*-commutative89.9%
*-commutative89.9%
distribute-rgt1-in78.0%
fma-def89.9%
+-commutative89.9%
+-commutative89.9%
cube-unmult89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 39.6%
unpow239.6%
Simplified39.6%
if -2.60000000000000003e-17 < x < -7.9999999999999999e-185Initial program 74.1%
associate-/r*76.2%
+-commutative76.2%
+-commutative76.2%
+-commutative76.2%
associate-/l/74.1%
times-frac85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-+l+85.8%
Simplified85.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 52.3%
if -7.9999999999999999e-185 < x < 9.1999999999999998e-184Initial program 67.2%
associate-/r*67.1%
+-commutative67.1%
+-commutative67.1%
+-commutative67.1%
associate-/l/67.2%
times-frac81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
+-commutative81.7%
associate-+l+81.7%
Simplified81.7%
Taylor expanded in x around 0 81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in y around 0 66.6%
Taylor expanded in y around inf 79.1%
Final simplification59.0%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.1e+17)
(/ y (* x x))
(if (<= x -3.9e-17)
(/ x (* y y))
(if (<= x -6e-185) (/ y x) (if (<= x 9e-182) (/ x y) (/ (/ x y) y))))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -3.9e-17) {
tmp = x / (y * y);
} else if (x <= -6e-185) {
tmp = y / x;
} else if (x <= 9e-182) {
tmp = x / y;
} else {
tmp = (x / y) / y;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.1d+17)) then
tmp = y / (x * x)
else if (x <= (-3.9d-17)) then
tmp = x / (y * y)
else if (x <= (-6d-185)) then
tmp = y / x
else if (x <= 9d-182) then
tmp = x / y
else
tmp = (x / y) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if (x <= -3.9e-17) {
tmp = x / (y * y);
} else if (x <= -6e-185) {
tmp = y / x;
} else if (x <= 9e-182) {
tmp = x / y;
} else {
tmp = (x / y) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = y / (x * x) elif x <= -3.9e-17: tmp = x / (y * y) elif x <= -6e-185: tmp = y / x elif x <= 9e-182: tmp = x / y else: tmp = (x / y) / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(y / Float64(x * x)); elseif (x <= -3.9e-17) tmp = Float64(x / Float64(y * y)); elseif (x <= -6e-185) tmp = Float64(y / x); elseif (x <= 9e-182) tmp = Float64(x / y); else tmp = Float64(Float64(x / y) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (x <= -2.1e+17)
tmp = y / (x * x);
elseif (x <= -3.9e-17)
tmp = x / (y * y);
elseif (x <= -6e-185)
tmp = y / x;
elseif (x <= 9e-182)
tmp = x / y;
else
tmp = (x / y) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[x, -2.1e+17], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.9e-17], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e-185], N[(y / x), $MachinePrecision], If[LessEqual[x, 9e-182], N[(x / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-182}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
associate-/r*79.4%
+-commutative79.4%
+-commutative79.4%
+-commutative79.4%
associate-/r*70.7%
associate-*l/84.2%
*-commutative84.2%
*-commutative84.2%
distribute-rgt1-in41.0%
fma-def84.2%
+-commutative84.2%
+-commutative84.2%
cube-unmult84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around inf 85.1%
unpow285.1%
Simplified85.1%
if -2.1e17 < x < -3.89999999999999989e-17Initial program 99.4%
associate-/r*99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
associate-/r*99.4%
associate-*l/99.6%
*-commutative99.6%
*-commutative99.6%
distribute-rgt1-in86.7%
fma-def99.2%
+-commutative99.2%
+-commutative99.2%
cube-unmult99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 85.0%
unpow285.0%
Simplified85.0%
if -3.89999999999999989e-17 < x < -6.00000000000000061e-185Initial program 74.1%
associate-/r*76.2%
+-commutative76.2%
+-commutative76.2%
+-commutative76.2%
associate-/l/74.1%
times-frac85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-+l+85.8%
Simplified85.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 52.3%
if -6.00000000000000061e-185 < x < 8.9999999999999998e-182Initial program 67.2%
associate-/r*67.1%
+-commutative67.1%
+-commutative67.1%
+-commutative67.1%
associate-/l/67.2%
times-frac81.7%
*-commutative81.7%
+-commutative81.7%
+-commutative81.7%
+-commutative81.7%
associate-+l+81.7%
Simplified81.7%
Taylor expanded in x around 0 81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in y around 0 66.6%
Taylor expanded in y around inf 79.1%
if 8.9999999999999998e-182 < x Initial program 82.9%
associate-/r*86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
associate-/r*82.9%
associate-*l/89.1%
*-commutative89.1%
*-commutative89.1%
distribute-rgt1-in77.4%
fma-def89.1%
+-commutative89.1%
+-commutative89.1%
cube-unmult89.1%
+-commutative89.1%
Simplified89.1%
associate-*r/82.9%
fma-udef72.1%
cube-mult72.1%
distribute-rgt1-in82.9%
associate-+r+82.9%
*-commutative82.9%
*-commutative82.9%
frac-times97.3%
associate-/r*99.8%
clear-num99.7%
frac-times98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
add-sqr-sqrt65.5%
pow265.5%
Applied egg-rr65.5%
Taylor expanded in y around inf 36.0%
unpow236.0%
associate-/r*33.8%
Simplified33.8%
Final simplification58.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(if (<= x -2.1e+17)
(/ y (* x x))
(if (or (<= x -3.2e-17) (not (<= x -8e-185)))
(/ x (* y (+ y 1.0)))
(/ y x))))assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if ((x <= -3.2e-17) || !(x <= -8e-185)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = 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.1d+17)) then
tmp = y / (x * x)
else if ((x <= (-3.2d-17)) .or. (.not. (x <= (-8d-185)))) then
tmp = x / (y * (y + 1.0d0))
else
tmp = y / x
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
tmp = y / (x * x);
} else if ((x <= -3.2e-17) || !(x <= -8e-185)) {
tmp = x / (y * (y + 1.0));
} else {
tmp = y / x;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = y / (x * x) elif (x <= -3.2e-17) or not (x <= -8e-185): tmp = x / (y * (y + 1.0)) else: tmp = y / x return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) tmp = Float64(y / Float64(x * x)); elseif ((x <= -3.2e-17) || !(x <= -8e-185)) tmp = Float64(x / Float64(y * Float64(y + 1.0))); else tmp = 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.1e+17)
tmp = y / (x * x);
elseif ((x <= -3.2e-17) || ~((x <= -8e-185)))
tmp = x / (y * (y + 1.0));
else
tmp = 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.1e+17], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.2e-17], N[Not[LessEqual[x, -8e-185]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / x), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-17} \lor \neg \left(x \leq -8 \cdot 10^{-185}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
associate-/r*79.4%
+-commutative79.4%
+-commutative79.4%
+-commutative79.4%
associate-/r*70.7%
associate-*l/84.2%
*-commutative84.2%
*-commutative84.2%
distribute-rgt1-in41.0%
fma-def84.2%
+-commutative84.2%
+-commutative84.2%
cube-unmult84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in x around inf 85.1%
unpow285.1%
Simplified85.1%
if -2.1e17 < x < -3.2000000000000002e-17 or -7.9999999999999999e-185 < x Initial program 78.8%
times-frac92.5%
associate-+l+92.5%
Simplified92.5%
Taylor expanded in x around 0 61.4%
if -3.2000000000000002e-17 < x < -7.9999999999999999e-185Initial program 74.1%
associate-/r*76.2%
+-commutative76.2%
+-commutative76.2%
+-commutative76.2%
associate-/l/74.1%
times-frac85.8%
*-commutative85.8%
+-commutative85.8%
+-commutative85.8%
+-commutative85.8%
associate-+l+85.8%
Simplified85.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 52.3%
Final simplification64.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (let* ((t_0 (+ x (+ y 1.0)))) (if (<= y 1.85e-35) (/ (/ y t_0) x) (* (/ x t_0) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 1.85e-35) {
tmp = (y / t_0) / x;
} else {
tmp = (x / t_0) * (1.0 / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x + (y + 1.0d0)
if (y <= 1.85d-35) then
tmp = (y / t_0) / x
else
tmp = (x / t_0) * (1.0d0 / y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 1.85e-35) {
tmp = (y / t_0) / x;
} else {
tmp = (x / t_0) * (1.0 / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 1.85e-35: tmp = (y / t_0) / x else: tmp = (x / t_0) * (1.0 / y) return tmp
x, y = sort([x, y]) function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 1.85e-35) tmp = Float64(Float64(y / t_0) / x); else tmp = Float64(Float64(x / t_0) * Float64(1.0 / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
t_0 = x + (y + 1.0);
tmp = 0.0;
if (y <= 1.85e-35)
tmp = (y / t_0) / x;
else
tmp = (x / t_0) * (1.0 / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.85e-35], N[(N[(y / t$95$0), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 1.85 \cdot 10^{-35}:\\
\;\;\;\;\frac{\frac{y}{t_0}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t_0} \cdot \frac{1}{y}\\
\end{array}
\end{array}
if y < 1.8499999999999999e-35Initial program 76.5%
times-frac90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in x around inf 60.5%
associate-*l/60.6%
*-un-lft-identity60.6%
Applied egg-rr60.6%
if 1.8499999999999999e-35 < y Initial program 75.9%
associate-/r*82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-/l/75.9%
times-frac94.2%
*-commutative94.2%
+-commutative94.2%
+-commutative94.2%
+-commutative94.2%
associate-+l+94.2%
Simplified94.2%
Taylor expanded in y around inf 71.4%
Final simplification63.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.46e-35) (/ y (+ x (* x x))) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.46e-35) {
tmp = y / (x + (x * x));
} else {
tmp = (x / (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.46d-35) then
tmp = y / (x + (x * x))
else
tmp = (x / (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.46e-35) {
tmp = y / (x + (x * x));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.46e-35: tmp = y / (x + (x * x)) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.46e-35) tmp = Float64(y / Float64(x + Float64(x * x))); else tmp = Float64(Float64(x / 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 <= 1.46e-35)
tmp = y / (x + (x * x));
else
tmp = (x / (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.46e-35], N[(y / N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.46 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.46000000000000007e-35Initial program 76.5%
times-frac90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in y around 0 60.5%
distribute-lft-in60.5%
*-rgt-identity60.5%
Simplified60.5%
if 1.46000000000000007e-35 < y Initial program 75.9%
associate-/r*82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-/r*75.9%
associate-*l/81.5%
*-commutative81.5%
*-commutative81.5%
distribute-rgt1-in72.9%
fma-def81.5%
+-commutative81.5%
+-commutative81.5%
cube-unmult81.6%
+-commutative81.6%
Simplified81.6%
associate-*r/75.9%
fma-udef70.9%
cube-mult70.8%
distribute-rgt1-in75.9%
associate-+r+75.9%
*-commutative75.9%
*-commutative75.9%
frac-times94.1%
associate-/r*99.8%
clear-num99.8%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 71.3%
+-commutative71.3%
Simplified71.3%
Final simplification63.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.82e-35) (/ (/ y (+ x (+ y 1.0))) x) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.82e-35) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (x / (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.82d-35) then
tmp = (y / (x + (y + 1.0d0))) / x
else
tmp = (x / (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.82e-35) {
tmp = (y / (x + (y + 1.0))) / x;
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.82e-35: tmp = (y / (x + (y + 1.0))) / x else: tmp = (x / (x + y)) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.82e-35) tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x); else tmp = Float64(Float64(x / 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 <= 1.82e-35)
tmp = (y / (x + (y + 1.0))) / x;
else
tmp = (x / (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.82e-35], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.82 \cdot 10^{-35}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.82000000000000003e-35Initial program 76.5%
times-frac90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in x around inf 60.5%
associate-*l/60.6%
*-un-lft-identity60.6%
Applied egg-rr60.6%
if 1.82000000000000003e-35 < y Initial program 75.9%
associate-/r*82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-/r*75.9%
associate-*l/81.5%
*-commutative81.5%
*-commutative81.5%
distribute-rgt1-in72.9%
fma-def81.5%
+-commutative81.5%
+-commutative81.5%
cube-unmult81.6%
+-commutative81.6%
Simplified81.6%
associate-*r/75.9%
fma-udef70.9%
cube-mult70.8%
distribute-rgt1-in75.9%
associate-+r+75.9%
*-commutative75.9%
*-commutative75.9%
frac-times94.1%
associate-/r*99.8%
clear-num99.8%
frac-times99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 71.3%
+-commutative71.3%
Simplified71.3%
Final simplification63.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 1.4e-36) (/ y x) (if (<= y 0.76) (- (/ x y) x) (/ x (* y y)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 1.4e-36) {
tmp = y / x;
} else if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = x / (y * y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.4d-36) then
tmp = y / x
else if (y <= 0.76d0) then
tmp = (x / y) - x
else
tmp = x / (y * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 1.4e-36) {
tmp = y / x;
} else if (y <= 0.76) {
tmp = (x / y) - x;
} else {
tmp = x / (y * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 1.4e-36: tmp = y / x elif y <= 0.76: tmp = (x / y) - x else: tmp = x / (y * y) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 1.4e-36) tmp = Float64(y / x); elseif (y <= 0.76) tmp = Float64(Float64(x / y) - x); else tmp = Float64(x / Float64(y * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 1.4e-36)
tmp = y / x;
elseif (y <= 0.76)
tmp = (x / y) - x;
else
tmp = x / (y * y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 1.4e-36], N[(y / x), $MachinePrecision], If[LessEqual[y, 0.76], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 1.4000000000000001e-36Initial program 76.5%
associate-/r*79.3%
+-commutative79.3%
+-commutative79.3%
+-commutative79.3%
associate-/l/76.5%
times-frac90.7%
*-commutative90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in x around 0 79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in y around 0 37.4%
if 1.4000000000000001e-36 < y < 0.76000000000000001Initial program 99.6%
times-frac99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in x around 0 55.3%
Taylor expanded in y around 0 49.5%
neg-mul-149.5%
+-commutative49.5%
unsub-neg49.5%
Simplified49.5%
if 0.76000000000000001 < y Initial program 70.5%
associate-/r*78.1%
+-commutative78.1%
+-commutative78.1%
+-commutative78.1%
associate-/r*70.5%
associate-*l/77.5%
*-commutative77.5%
*-commutative77.5%
distribute-rgt1-in71.0%
fma-def77.5%
+-commutative77.5%
+-commutative77.5%
cube-unmult77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in y around inf 76.5%
unpow276.5%
Simplified76.5%
Final simplification45.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 3.7e-36) (/ y (+ x (* x x))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 3.7e-36) {
tmp = y / (x + (x * x));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.7d-36) then
tmp = y / (x + (x * x))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 3.7e-36) {
tmp = y / (x + (x * x));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 3.7e-36: tmp = y / (x + (x * 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.7e-36) tmp = Float64(y / Float64(x + Float64(x * 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 <= 3.7e-36)
tmp = y / (x + (x * x));
else
tmp = x / (y * (y + 1.0));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 3.7e-36], N[(y / N[(x + N[(x * x), $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.7 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 3.70000000000000002e-36Initial program 76.5%
times-frac90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in y around 0 60.5%
distribute-lft-in60.5%
*-rgt-identity60.5%
Simplified60.5%
if 3.70000000000000002e-36 < y Initial program 75.9%
times-frac94.1%
associate-+l+94.1%
Simplified94.1%
Taylor expanded in x around 0 73.0%
Final simplification63.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= y 7.2e-36) (/ y (+ x (* x x))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
double tmp;
if (y <= 7.2e-36) {
tmp = y / (x + (x * x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 7.2d-36) then
tmp = y / (x + (x * x))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y) {
double tmp;
if (y <= 7.2e-36) {
tmp = y / (x + (x * x));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if y <= 7.2e-36: tmp = y / (x + (x * x)) else: tmp = (x / y) / (y + 1.0) return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (y <= 7.2e-36) tmp = Float64(y / Float64(x + Float64(x * x))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
tmp = 0.0;
if (y <= 7.2e-36)
tmp = y / (x + (x * x));
else
tmp = (x / y) / (y + 1.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := If[LessEqual[y, 7.2e-36], N[(y / N[(x + N[(x * 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}\;y \leq 7.2 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{x + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 7.20000000000000064e-36Initial program 76.5%
times-frac90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in y around 0 60.5%
distribute-lft-in60.5%
*-rgt-identity60.5%
Simplified60.5%
if 7.20000000000000064e-36 < y Initial program 75.9%
times-frac94.1%
associate-+l+94.1%
Simplified94.1%
Taylor expanded in x around 0 73.0%
associate-/r*70.8%
+-commutative70.8%
Simplified70.8%
Final simplification62.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -2.1e+17) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -2.1e+17) {
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 <= (-2.1d+17)) 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 <= -2.1e+17) {
tmp = 1.0 / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -2.1e+17: tmp = 1.0 / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -2.1e+17) 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 <= -2.1e+17)
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, -2.1e+17], 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 -2.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -2.1e17Initial program 70.7%
times-frac93.0%
associate-+l+93.0%
Simplified93.0%
Taylor expanded in x around inf 87.3%
Taylor expanded in y around inf 6.1%
if -2.1e17 < x Initial program 77.8%
associate-/r*80.1%
+-commutative80.1%
+-commutative80.1%
+-commutative80.1%
associate-/l/77.8%
times-frac91.1%
*-commutative91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
associate-+l+91.1%
Simplified91.1%
Taylor expanded in x around 0 84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in y around 0 68.2%
Taylor expanded in y around inf 31.9%
Final simplification26.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (if (<= x -8e-185) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
double tmp;
if (x <= -8e-185) {
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 <= (-8d-185)) 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 <= -8e-185) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y): tmp = 0 if x <= -8e-185: tmp = y / x else: tmp = x / y return tmp
x, y = sort([x, y]) function code(x, y) tmp = 0.0 if (x <= -8e-185) 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 <= -8e-185)
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, -8e-185], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-185}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -7.9999999999999999e-185Initial program 74.3%
associate-/r*79.7%
+-commutative79.7%
+-commutative79.7%
+-commutative79.7%
associate-/l/74.3%
times-frac90.6%
*-commutative90.6%
+-commutative90.6%
+-commutative90.6%
+-commutative90.6%
associate-+l+90.6%
Simplified90.6%
Taylor expanded in x around 0 77.8%
+-commutative77.8%
Simplified77.8%
Taylor expanded in y around 0 39.7%
if -7.9999999999999999e-185 < x Initial program 77.7%
associate-/r*80.1%
+-commutative80.1%
+-commutative80.1%
+-commutative80.1%
associate-/l/77.7%
times-frac92.1%
*-commutative92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
associate-+l+92.1%
Simplified92.1%
Taylor expanded in x around 0 83.4%
+-commutative83.4%
Simplified83.4%
Taylor expanded in y around 0 69.7%
Taylor expanded in y around inf 36.8%
Final simplification38.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
return 1.0 / x;
}
[x, y] = sort([x, y]) def code(x, y): return 1.0 / x
x, y = sort([x, y]) function code(x, y) return Float64(1.0 / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Initial program 76.3%
times-frac91.5%
associate-+l+91.5%
Simplified91.5%
Taylor expanded in x around inf 53.7%
Taylor expanded in y around inf 4.1%
Final simplification4.1%
(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 2023271
(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))))