
(FPCore (x y) :precision binary64 (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))
double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x - y) * (x + y)) / ((x * x) + (y * y))
end function
public static double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
def code(x, y): return ((x - y) * (x + y)) / ((x * x) + (y * y))
function code(x, y) return Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))) end
function tmp = code(x, y) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); end
code[x_, y_] := N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))
double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x - y) * (x + y)) / ((x * x) + (y * y))
end function
public static double code(double x, double y) {
return ((x - y) * (x + y)) / ((x * x) + (y * y));
}
def code(x, y): return ((x - y) * (x + y)) / ((x * x) + (y * y))
function code(x, y) return Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))) end
function tmp = code(x, y) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); end
code[x_, y_] := N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (- x y) (hypot x y)) (/ (+ x y) (hypot x y))))
double code(double x, double y) {
return ((x - y) / hypot(x, y)) * ((x + y) / hypot(x, y));
}
public static double code(double x, double y) {
return ((x - y) / Math.hypot(x, y)) * ((x + y) / Math.hypot(x, y));
}
def code(x, y): return ((x - y) / math.hypot(x, y)) * ((x + y) / math.hypot(x, y))
function code(x, y) return Float64(Float64(Float64(x - y) / hypot(x, y)) * Float64(Float64(x + y) / hypot(x, y))) end
function tmp = code(x, y) tmp = ((x - y) / hypot(x, y)) * ((x + y) / hypot(x, y)); end
code[x_, y_] := N[(N[(N[(x - y), $MachinePrecision] / N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}
\end{array}
Initial program 65.6%
fma-define65.6%
add-sqr-sqrt65.6%
times-frac65.6%
fma-define65.6%
hypot-define65.6%
fma-define65.6%
hypot-define99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(+ 1.0 (/ -1.0 (* (pow (/ x y) 2.0) 0.5)))
(if (<= y 2.25e-175)
(/ (- x y) (+ y (* x (+ (* (/ x y) 2.0) -1.0))))
(if (<= y 1e-22) (/ (* (- x y) (+ x y)) (fma x x (pow y 2.0))) -1.0))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 + (-1.0 / (pow((x / y), 2.0) * 0.5));
} else if (y <= 2.25e-175) {
tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0)));
} else if (y <= 1e-22) {
tmp = ((x - y) * (x + y)) / fma(x, x, pow(y, 2.0));
} else {
tmp = -1.0;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 + Float64(-1.0 / Float64((Float64(x / y) ^ 2.0) * 0.5))); elseif (y <= 2.25e-175) tmp = Float64(Float64(x - y) / Float64(y + Float64(x * Float64(Float64(Float64(x / y) * 2.0) + -1.0)))); elseif (y <= 1e-22) tmp = Float64(Float64(Float64(x - y) * Float64(x + y)) / fma(x, x, (y ^ 2.0))); else tmp = -1.0; end return tmp end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(1.0 + N[(-1.0 / N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e-175], N[(N[(x - y), $MachinePrecision] / N[(y + N[(x * N[(N[(N[(x / y), $MachinePrecision] * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-22], N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x * x + N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;1 + \frac{-1}{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-175}:\\
\;\;\;\;\frac{x - y}{y + x \cdot \left(\frac{x}{y} \cdot 2 + -1\right)}\\
\mathbf{elif}\;y \leq 10^{-22}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{\mathsf{fma}\left(x, x, {y}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around -inf 36.3%
mul-1-neg36.3%
unsub-neg36.3%
Simplified36.3%
clear-num36.3%
inv-pow36.3%
*-un-lft-identity36.3%
associate-/l*36.3%
times-frac36.3%
metadata-eval36.3%
*-un-lft-identity36.3%
*-commutative36.3%
unpow236.3%
associate-/l*36.9%
frac-times36.9%
clear-num36.9%
pow236.9%
Applied egg-rr36.9%
unpow-136.9%
*-commutative36.9%
Simplified36.9%
if 8.99999999999999912e-205 < y < 2.24999999999999999e-175Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
*-un-lft-identity17.0%
add-sqr-sqrt17.0%
times-frac17.0%
fma-define17.0%
hypot-define17.0%
fma-define17.0%
hypot-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 0.1%
associate-+r+0.1%
mul-1-neg0.1%
unpow20.1%
unpow20.1%
times-frac85.0%
unpow285.0%
sub-neg85.0%
Simplified85.0%
clear-num85.1%
un-div-inv85.8%
+-commutative85.8%
Applied egg-rr85.8%
Taylor expanded in x around 0 86.6%
if 2.24999999999999999e-175 < y < 1e-22Initial program 97.7%
fma-define97.8%
pow297.8%
Applied egg-rr97.8%
if 1e-22 < y Initial program 100.0%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
Final simplification51.2%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(+ 1.0 (/ -1.0 (* (pow (/ x y) 2.0) 0.5)))
(if (<= y 6.8e-176)
(/ (- x y) (+ y (* x (+ (* (/ x y) 2.0) -1.0))))
(if (<= y 3.1e-19) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) -1.0))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 + (-1.0 / (pow((x / y), 2.0) * 0.5));
} else if (y <= 6.8e-176) {
tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0)));
} else if (y <= 3.1e-19) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = 1.0d0 + ((-1.0d0) / (((x / y) ** 2.0d0) * 0.5d0))
else if (y <= 6.8d-176) then
tmp = (x - y) / (y + (x * (((x / y) * 2.0d0) + (-1.0d0))))
else if (y <= 3.1d-19) then
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y))
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 + (-1.0 / (Math.pow((x / y), 2.0) * 0.5));
} else if (y <= 6.8e-176) {
tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0)));
} else if (y <= 3.1e-19) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = 1.0 + (-1.0 / (math.pow((x / y), 2.0) * 0.5)) elif y <= 6.8e-176: tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0))) elif y <= 3.1e-19: tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)) else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 + Float64(-1.0 / Float64((Float64(x / y) ^ 2.0) * 0.5))); elseif (y <= 6.8e-176) tmp = Float64(Float64(x - y) / Float64(y + Float64(x * Float64(Float64(Float64(x / y) * 2.0) + -1.0)))); elseif (y <= 3.1e-19) tmp = Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))); else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = 1.0 + (-1.0 / (((x / y) ^ 2.0) * 0.5)); elseif (y <= 6.8e-176) tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0))); elseif (y <= 3.1e-19) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(1.0 + N[(-1.0 / N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e-176], N[(N[(x - y), $MachinePrecision] / N[(y + N[(x * N[(N[(N[(x / y), $MachinePrecision] * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e-19], N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;1 + \frac{-1}{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-176}:\\
\;\;\;\;\frac{x - y}{y + x \cdot \left(\frac{x}{y} \cdot 2 + -1\right)}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-19}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around -inf 36.3%
mul-1-neg36.3%
unsub-neg36.3%
Simplified36.3%
clear-num36.3%
inv-pow36.3%
*-un-lft-identity36.3%
associate-/l*36.3%
times-frac36.3%
metadata-eval36.3%
*-un-lft-identity36.3%
*-commutative36.3%
unpow236.3%
associate-/l*36.9%
frac-times36.9%
clear-num36.9%
pow236.9%
Applied egg-rr36.9%
unpow-136.9%
*-commutative36.9%
Simplified36.9%
if 8.99999999999999912e-205 < y < 6.7999999999999994e-176Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
*-un-lft-identity17.0%
add-sqr-sqrt17.0%
times-frac17.0%
fma-define17.0%
hypot-define17.0%
fma-define17.0%
hypot-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 0.1%
associate-+r+0.1%
mul-1-neg0.1%
unpow20.1%
unpow20.1%
times-frac85.0%
unpow285.0%
sub-neg85.0%
Simplified85.0%
clear-num85.1%
un-div-inv85.8%
+-commutative85.8%
Applied egg-rr85.8%
Taylor expanded in x around 0 86.6%
if 6.7999999999999994e-176 < y < 3.0999999999999999e-19Initial program 97.7%
if 3.0999999999999999e-19 < y Initial program 100.0%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
Final simplification51.2%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(/ 1.0 (/ x (* (- x y) (+ 1.0 (/ y x)))))
(if (<= y 9e-175)
(/ (* (- x y) (+ 1.0 (/ x y))) y)
(if (<= y 5e-20) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) -1.0))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x))));
} else if (y <= 9e-175) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 5e-20) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = 1.0d0 / (x / ((x - y) * (1.0d0 + (y / x))))
else if (y <= 9d-175) then
tmp = ((x - y) * (1.0d0 + (x / y))) / y
else if (y <= 5d-20) then
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y))
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x))));
} else if (y <= 9e-175) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 5e-20) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x)))) elif y <= 9e-175: tmp = ((x - y) * (1.0 + (x / y))) / y elif y <= 5e-20: tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)) else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 / Float64(x / Float64(Float64(x - y) * Float64(1.0 + Float64(y / x))))); elseif (y <= 9e-175) tmp = Float64(Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) / y); elseif (y <= 5e-20) tmp = Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))); else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x)))); elseif (y <= 9e-175) tmp = ((x - y) * (1.0 + (x / y))) / y; elseif (y <= 5e-20) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(1.0 / N[(x / N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-175], N[(N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 5e-20], N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\frac{1}{\frac{x}{\left(x - y\right) \cdot \left(1 + \frac{y}{x}\right)}}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-175}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)}{y}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
associate-*r/36.8%
clear-num36.8%
Applied egg-rr36.8%
if 8.99999999999999912e-205 < y < 8.99999999999999996e-175Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
associate-*r/84.0%
Applied egg-rr84.0%
if 8.99999999999999996e-175 < y < 4.9999999999999999e-20Initial program 97.7%
if 4.9999999999999999e-20 < y Initial program 100.0%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
Final simplification51.0%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(/ 1.0 (/ x (* (- x y) (+ 1.0 (/ y x)))))
(if (<= y 5.4e-175)
(/ (- x y) (+ y (* x (+ (* (/ x y) 2.0) -1.0))))
(if (<= y 2e-19) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) -1.0))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x))));
} else if (y <= 5.4e-175) {
tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0)));
} else if (y <= 2e-19) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = 1.0d0 / (x / ((x - y) * (1.0d0 + (y / x))))
else if (y <= 5.4d-175) then
tmp = (x - y) / (y + (x * (((x / y) * 2.0d0) + (-1.0d0))))
else if (y <= 2d-19) then
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y))
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x))));
} else if (y <= 5.4e-175) {
tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0)));
} else if (y <= 2e-19) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x)))) elif y <= 5.4e-175: tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0))) elif y <= 2e-19: tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)) else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 / Float64(x / Float64(Float64(x - y) * Float64(1.0 + Float64(y / x))))); elseif (y <= 5.4e-175) tmp = Float64(Float64(x - y) / Float64(y + Float64(x * Float64(Float64(Float64(x / y) * 2.0) + -1.0)))); elseif (y <= 2e-19) tmp = Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))); else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = 1.0 / (x / ((x - y) * (1.0 + (y / x)))); elseif (y <= 5.4e-175) tmp = (x - y) / (y + (x * (((x / y) * 2.0) + -1.0))); elseif (y <= 2e-19) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(1.0 / N[(x / N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e-175], N[(N[(x - y), $MachinePrecision] / N[(y + N[(x * N[(N[(N[(x / y), $MachinePrecision] * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e-19], N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\frac{1}{\frac{x}{\left(x - y\right) \cdot \left(1 + \frac{y}{x}\right)}}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-175}:\\
\;\;\;\;\frac{x - y}{y + x \cdot \left(\frac{x}{y} \cdot 2 + -1\right)}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-19}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
associate-*r/36.8%
clear-num36.8%
Applied egg-rr36.8%
if 8.99999999999999912e-205 < y < 5.39999999999999998e-175Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
*-un-lft-identity17.0%
add-sqr-sqrt17.0%
times-frac17.0%
fma-define17.0%
hypot-define17.0%
fma-define17.0%
hypot-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 0.1%
associate-+r+0.1%
mul-1-neg0.1%
unpow20.1%
unpow20.1%
times-frac85.0%
unpow285.0%
sub-neg85.0%
Simplified85.0%
clear-num85.1%
un-div-inv85.8%
+-commutative85.8%
Applied egg-rr85.8%
Taylor expanded in x around 0 86.6%
if 5.39999999999999998e-175 < y < 2e-19Initial program 97.7%
if 2e-19 < y Initial program 100.0%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around 0 100.0%
Final simplification51.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- x y) (+ 1.0 (/ x y)))) (t_1 (+ 1.0 (/ y x))))
(if (<= y 9e-205)
(/ 1.0 (/ x (* (- x y) t_1)))
(if (<= y 8e-175)
(/ t_0 y)
(if (<= y 4.8e-168) (/ (- x y) (/ x t_1)) (/ 1.0 (/ y t_0)))))))
double code(double x, double y) {
double t_0 = (x - y) * (1.0 + (x / y));
double t_1 = 1.0 + (y / x);
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * t_1));
} else if (y <= 8e-175) {
tmp = t_0 / y;
} else if (y <= 4.8e-168) {
tmp = (x - y) / (x / t_1);
} else {
tmp = 1.0 / (y / t_0);
}
return tmp;
}
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 = (x - y) * (1.0d0 + (x / y))
t_1 = 1.0d0 + (y / x)
if (y <= 9d-205) then
tmp = 1.0d0 / (x / ((x - y) * t_1))
else if (y <= 8d-175) then
tmp = t_0 / y
else if (y <= 4.8d-168) then
tmp = (x - y) / (x / t_1)
else
tmp = 1.0d0 / (y / t_0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x - y) * (1.0 + (x / y));
double t_1 = 1.0 + (y / x);
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * t_1));
} else if (y <= 8e-175) {
tmp = t_0 / y;
} else if (y <= 4.8e-168) {
tmp = (x - y) / (x / t_1);
} else {
tmp = 1.0 / (y / t_0);
}
return tmp;
}
def code(x, y): t_0 = (x - y) * (1.0 + (x / y)) t_1 = 1.0 + (y / x) tmp = 0 if y <= 9e-205: tmp = 1.0 / (x / ((x - y) * t_1)) elif y <= 8e-175: tmp = t_0 / y elif y <= 4.8e-168: tmp = (x - y) / (x / t_1) else: tmp = 1.0 / (y / t_0) return tmp
function code(x, y) t_0 = Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) t_1 = Float64(1.0 + Float64(y / x)) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 / Float64(x / Float64(Float64(x - y) * t_1))); elseif (y <= 8e-175) tmp = Float64(t_0 / y); elseif (y <= 4.8e-168) tmp = Float64(Float64(x - y) / Float64(x / t_1)); else tmp = Float64(1.0 / Float64(y / t_0)); end return tmp end
function tmp_2 = code(x, y) t_0 = (x - y) * (1.0 + (x / y)); t_1 = 1.0 + (y / x); tmp = 0.0; if (y <= 9e-205) tmp = 1.0 / (x / ((x - y) * t_1)); elseif (y <= 8e-175) tmp = t_0 / y; elseif (y <= 4.8e-168) tmp = (x - y) / (x / t_1); else tmp = 1.0 / (y / t_0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-205], N[(1.0 / N[(x / N[(N[(x - y), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-175], N[(t$95$0 / y), $MachinePrecision], If[LessEqual[y, 4.8e-168], N[(N[(x - y), $MachinePrecision] / N[(x / t$95$1), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)\\
t_1 := 1 + \frac{y}{x}\\
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\frac{1}{\frac{x}{\left(x - y\right) \cdot t\_1}}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-175}:\\
\;\;\;\;\frac{t\_0}{y}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-168}:\\
\;\;\;\;\frac{x - y}{\frac{x}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{t\_0}}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
associate-*r/36.8%
clear-num36.8%
Applied egg-rr36.8%
if 8.99999999999999912e-205 < y < 8e-175Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
associate-*r/84.0%
Applied egg-rr84.0%
if 8e-175 < y < 4.7999999999999999e-168Initial program 66.7%
associate-/l*67.2%
fma-define67.2%
Simplified67.2%
Taylor expanded in x around inf 69.3%
clear-num69.3%
un-div-inv69.8%
Applied egg-rr69.8%
if 4.7999999999999999e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
associate-*r/70.2%
clear-num70.2%
Applied egg-rr70.2%
Final simplification45.1%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
1.0
(if (or (<= y 2.5e-175) (not (<= y 4.7e-168)))
(* (- x y) (/ (+ 1.0 (/ x y)) y))
1.0)))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0;
} else if ((y <= 2.5e-175) || !(y <= 4.7e-168)) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = 1.0d0
else if ((y <= 2.5d-175) .or. (.not. (y <= 4.7d-168))) then
tmp = (x - y) * ((1.0d0 + (x / y)) / y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = 1.0;
} else if ((y <= 2.5e-175) || !(y <= 4.7e-168)) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = 1.0 elif (y <= 2.5e-175) or not (y <= 4.7e-168): tmp = (x - y) * ((1.0 + (x / y)) / y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = 1.0; elseif ((y <= 2.5e-175) || !(y <= 4.7e-168)) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(x / y)) / y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = 1.0; elseif ((y <= 2.5e-175) || ~((y <= 4.7e-168))) tmp = (x - y) * ((1.0 + (x / y)) / y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], 1.0, If[Or[LessEqual[y, 2.5e-175], N[Not[LessEqual[y, 4.7e-168]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-175} \lor \neg \left(y \leq 4.7 \cdot 10^{-168}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205 or 2.5e-175 < y < 4.70000000000000026e-168Initial program 58.6%
associate-/l*58.4%
fma-define58.4%
Simplified58.4%
Taylor expanded in x around inf 35.5%
if 8.99999999999999912e-205 < y < 2.5e-175 or 4.70000000000000026e-168 < y Initial program 89.6%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
Taylor expanded in y around inf 71.8%
Final simplification43.7%
(FPCore (x y) :precision binary64 (if (or (<= y 9e-205) (and (not (<= y 8.2e-176)) (<= y 5.2e-168))) (* (- x y) (/ (+ 1.0 (/ y x)) x)) (* (- x y) (/ (+ 1.0 (/ x y)) y))))
double code(double x, double y) {
double tmp;
if ((y <= 9e-205) || (!(y <= 8.2e-176) && (y <= 5.2e-168))) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = (x - y) * ((1.0 + (x / y)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 9d-205) .or. (.not. (y <= 8.2d-176)) .and. (y <= 5.2d-168)) then
tmp = (x - y) * ((1.0d0 + (y / x)) / x)
else
tmp = (x - y) * ((1.0d0 + (x / y)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 9e-205) || (!(y <= 8.2e-176) && (y <= 5.2e-168))) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = (x - y) * ((1.0 + (x / y)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 9e-205) or (not (y <= 8.2e-176) and (y <= 5.2e-168)): tmp = (x - y) * ((1.0 + (y / x)) / x) else: tmp = (x - y) * ((1.0 + (x / y)) / y) return tmp
function code(x, y) tmp = 0.0 if ((y <= 9e-205) || (!(y <= 8.2e-176) && (y <= 5.2e-168))) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(y / x)) / x)); else tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(x / y)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 9e-205) || (~((y <= 8.2e-176)) && (y <= 5.2e-168))) tmp = (x - y) * ((1.0 + (y / x)) / x); else tmp = (x - y) * ((1.0 + (x / y)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 9e-205], And[N[Not[LessEqual[y, 8.2e-176]], $MachinePrecision], LessEqual[y, 5.2e-168]]], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205} \lor \neg \left(y \leq 8.2 \cdot 10^{-176}\right) \land y \leq 5.2 \cdot 10^{-168}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205 or 8.2000000000000005e-176 < y < 5.2000000000000002e-168Initial program 58.6%
associate-/l*58.4%
fma-define58.4%
Simplified58.4%
Taylor expanded in x around inf 37.1%
if 8.99999999999999912e-205 < y < 8.2000000000000005e-176 or 5.2000000000000002e-168 < y Initial program 89.6%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
Taylor expanded in y around inf 71.8%
Final simplification44.9%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(* (- x y) (/ (/ (+ x y) x) x))
(if (or (<= y 2.75e-175) (not (<= y 4.4e-168)))
(/ (* (- x y) (+ 1.0 (/ x y))) y)
(* (- x y) (/ (+ 1.0 (/ y x)) x)))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if ((y <= 2.75e-175) || !(y <= 4.4e-168)) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else {
tmp = (x - y) * ((1.0 + (y / x)) / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = (x - y) * (((x + y) / x) / x)
else if ((y <= 2.75d-175) .or. (.not. (y <= 4.4d-168))) then
tmp = ((x - y) * (1.0d0 + (x / y))) / y
else
tmp = (x - y) * ((1.0d0 + (y / x)) / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if ((y <= 2.75e-175) || !(y <= 4.4e-168)) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else {
tmp = (x - y) * ((1.0 + (y / x)) / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = (x - y) * (((x + y) / x) / x) elif (y <= 2.75e-175) or not (y <= 4.4e-168): tmp = ((x - y) * (1.0 + (x / y))) / y else: tmp = (x - y) * ((1.0 + (y / x)) / x) return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(Float64(x - y) * Float64(Float64(Float64(x + y) / x) / x)); elseif ((y <= 2.75e-175) || !(y <= 4.4e-168)) tmp = Float64(Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) / y); else tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(y / x)) / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = (x - y) * (((x + y) / x) / x); elseif ((y <= 2.75e-175) || ~((y <= 4.4e-168))) tmp = ((x - y) * (1.0 + (x / y))) / y; else tmp = (x - y) * ((1.0 + (y / x)) / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(N[(x - y), $MachinePrecision] * N[(N[(N[(x + y), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 2.75e-175], N[Not[LessEqual[y, 4.4e-168]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{\frac{x + y}{x}}{x}\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-175} \lor \neg \left(y \leq 4.4 \cdot 10^{-168}\right):\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{y}{x}}{x}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
Taylor expanded in x around 0 36.6%
+-commutative36.6%
Simplified36.6%
if 8.99999999999999912e-205 < y < 2.75000000000000027e-175 or 4.3999999999999996e-168 < y Initial program 89.6%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
Taylor expanded in y around inf 71.8%
associate-*r/71.9%
Applied egg-rr71.9%
if 2.75000000000000027e-175 < y < 4.3999999999999996e-168Initial program 66.7%
associate-/l*67.2%
fma-define67.2%
Simplified67.2%
Taylor expanded in x around inf 69.3%
Final simplification45.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- x y) (/ (+ 1.0 (/ y x)) x))))
(if (<= y 9e-205)
t_0
(if (<= y 8.6e-176)
(* (- x y) (/ (+ 1.0 (/ x y)) y))
(if (<= y 5.2e-168) t_0 (* (- x y) (/ (/ (+ x y) y) y)))))))
double code(double x, double y) {
double t_0 = (x - y) * ((1.0 + (y / x)) / x);
double tmp;
if (y <= 9e-205) {
tmp = t_0;
} else if (y <= 8.6e-176) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else if (y <= 5.2e-168) {
tmp = t_0;
} else {
tmp = (x - y) * (((x + y) / y) / y);
}
return tmp;
}
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 + (y / x)) / x)
if (y <= 9d-205) then
tmp = t_0
else if (y <= 8.6d-176) then
tmp = (x - y) * ((1.0d0 + (x / y)) / y)
else if (y <= 5.2d-168) then
tmp = t_0
else
tmp = (x - y) * (((x + y) / y) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x - y) * ((1.0 + (y / x)) / x);
double tmp;
if (y <= 9e-205) {
tmp = t_0;
} else if (y <= 8.6e-176) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else if (y <= 5.2e-168) {
tmp = t_0;
} else {
tmp = (x - y) * (((x + y) / y) / y);
}
return tmp;
}
def code(x, y): t_0 = (x - y) * ((1.0 + (y / x)) / x) tmp = 0 if y <= 9e-205: tmp = t_0 elif y <= 8.6e-176: tmp = (x - y) * ((1.0 + (x / y)) / y) elif y <= 5.2e-168: tmp = t_0 else: tmp = (x - y) * (((x + y) / y) / y) return tmp
function code(x, y) t_0 = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(y / x)) / x)) tmp = 0.0 if (y <= 9e-205) tmp = t_0; elseif (y <= 8.6e-176) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(x / y)) / y)); elseif (y <= 5.2e-168) tmp = t_0; else tmp = Float64(Float64(x - y) * Float64(Float64(Float64(x + y) / y) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (x - y) * ((1.0 + (y / x)) / x); tmp = 0.0; if (y <= 9e-205) tmp = t_0; elseif (y <= 8.6e-176) tmp = (x - y) * ((1.0 + (x / y)) / y); elseif (y <= 5.2e-168) tmp = t_0; else tmp = (x - y) * (((x + y) / y) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-205], t$95$0, If[LessEqual[y, 8.6e-176], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e-168], t$95$0, N[(N[(x - y), $MachinePrecision] * N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - y\right) \cdot \frac{1 + \frac{y}{x}}{x}\\
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-176}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{x}{y}}{y}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{\frac{x + y}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205 or 8.60000000000000025e-176 < y < 5.2000000000000002e-168Initial program 58.6%
associate-/l*58.4%
fma-define58.4%
Simplified58.4%
Taylor expanded in x around inf 37.1%
if 8.99999999999999912e-205 < y < 8.60000000000000025e-176Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
if 5.2000000000000002e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
Taylor expanded in y around 0 70.2%
Final simplification44.9%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(* (- x y) (/ (/ (+ x y) x) x))
(if (<= y 1.4e-175)
(* (- x y) (/ (+ 1.0 (/ x y)) y))
(if (<= y 5.2e-168)
(* (- x y) (/ (+ 1.0 (/ y x)) x))
(* (- x y) (/ (/ (+ x y) y) y))))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if (y <= 1.4e-175) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else if (y <= 5.2e-168) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = (x - y) * (((x + y) / y) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = (x - y) * (((x + y) / x) / x)
else if (y <= 1.4d-175) then
tmp = (x - y) * ((1.0d0 + (x / y)) / y)
else if (y <= 5.2d-168) then
tmp = (x - y) * ((1.0d0 + (y / x)) / x)
else
tmp = (x - y) * (((x + y) / y) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if (y <= 1.4e-175) {
tmp = (x - y) * ((1.0 + (x / y)) / y);
} else if (y <= 5.2e-168) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = (x - y) * (((x + y) / y) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = (x - y) * (((x + y) / x) / x) elif y <= 1.4e-175: tmp = (x - y) * ((1.0 + (x / y)) / y) elif y <= 5.2e-168: tmp = (x - y) * ((1.0 + (y / x)) / x) else: tmp = (x - y) * (((x + y) / y) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(Float64(x - y) * Float64(Float64(Float64(x + y) / x) / x)); elseif (y <= 1.4e-175) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(x / y)) / y)); elseif (y <= 5.2e-168) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(y / x)) / x)); else tmp = Float64(Float64(x - y) * Float64(Float64(Float64(x + y) / y) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = (x - y) * (((x + y) / x) / x); elseif (y <= 1.4e-175) tmp = (x - y) * ((1.0 + (x / y)) / y); elseif (y <= 5.2e-168) tmp = (x - y) * ((1.0 + (y / x)) / x); else tmp = (x - y) * (((x + y) / y) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(N[(x - y), $MachinePrecision] * N[(N[(N[(x + y), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-175], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e-168], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{\frac{x + y}{x}}{x}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-175}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{x}{y}}{y}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{\frac{x + y}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
Taylor expanded in x around 0 36.6%
+-commutative36.6%
Simplified36.6%
if 8.99999999999999912e-205 < y < 1.4e-175Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
if 1.4e-175 < y < 5.2000000000000002e-168Initial program 66.7%
associate-/l*67.2%
fma-define67.2%
Simplified67.2%
Taylor expanded in x around inf 69.3%
if 5.2000000000000002e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
Taylor expanded in y around 0 70.2%
Final simplification45.0%
(FPCore (x y)
:precision binary64
(if (<= y 9e-205)
(* (- x y) (/ (/ (+ x y) x) x))
(if (<= y 8.8e-176)
(/ (* (- x y) (+ 1.0 (/ x y))) y)
(if (<= y 5.2e-168)
(* (- x y) (/ (+ 1.0 (/ y x)) x))
(/ (* (- x y) (/ (+ x y) y)) y)))))
double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if (y <= 8.8e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 5.2e-168) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 9d-205) then
tmp = (x - y) * (((x + y) / x) / x)
else if (y <= 8.8d-176) then
tmp = ((x - y) * (1.0d0 + (x / y))) / y
else if (y <= 5.2d-168) then
tmp = (x - y) * ((1.0d0 + (y / x)) / x)
else
tmp = ((x - y) * ((x + y) / y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 9e-205) {
tmp = (x - y) * (((x + y) / x) / x);
} else if (y <= 8.8e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 5.2e-168) {
tmp = (x - y) * ((1.0 + (y / x)) / x);
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9e-205: tmp = (x - y) * (((x + y) / x) / x) elif y <= 8.8e-176: tmp = ((x - y) * (1.0 + (x / y))) / y elif y <= 5.2e-168: tmp = (x - y) * ((1.0 + (y / x)) / x) else: tmp = ((x - y) * ((x + y) / y)) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 9e-205) tmp = Float64(Float64(x - y) * Float64(Float64(Float64(x + y) / x) / x)); elseif (y <= 8.8e-176) tmp = Float64(Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) / y); elseif (y <= 5.2e-168) tmp = Float64(Float64(x - y) * Float64(Float64(1.0 + Float64(y / x)) / x)); else tmp = Float64(Float64(Float64(x - y) * Float64(Float64(x + y) / y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9e-205) tmp = (x - y) * (((x + y) / x) / x); elseif (y <= 8.8e-176) tmp = ((x - y) * (1.0 + (x / y))) / y; elseif (y <= 5.2e-168) tmp = (x - y) * ((1.0 + (y / x)) / x); else tmp = ((x - y) * ((x + y) / y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9e-205], N[(N[(x - y), $MachinePrecision] * N[(N[(N[(x + y), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.8e-176], N[(N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 5.2e-168], N[(N[(x - y), $MachinePrecision] * N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{\frac{x + y}{x}}{x}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-176}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)}{y}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{1 + \frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \frac{x + y}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
Taylor expanded in x around 0 36.6%
+-commutative36.6%
Simplified36.6%
if 8.99999999999999912e-205 < y < 8.7999999999999994e-176Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
associate-*r/84.0%
Applied egg-rr84.0%
if 8.7999999999999994e-176 < y < 5.2000000000000002e-168Initial program 66.7%
associate-/l*67.2%
fma-define67.2%
Simplified67.2%
Taylor expanded in x around inf 69.3%
if 5.2000000000000002e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
associate-*r/70.2%
Applied egg-rr70.2%
Taylor expanded in y around 0 70.2%
Final simplification45.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x y) (/ x (+ 1.0 (/ y x))))))
(if (<= y 9e-205)
t_0
(if (<= y 8.8e-176)
(/ (* (- x y) (+ 1.0 (/ x y))) y)
(if (<= y 4.4e-168) t_0 (/ (* (- x y) (/ (+ x y) y)) y))))))
double code(double x, double y) {
double t_0 = (x - y) / (x / (1.0 + (y / x)));
double tmp;
if (y <= 9e-205) {
tmp = t_0;
} else if (y <= 8.8e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 4.4e-168) {
tmp = t_0;
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
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) / (x / (1.0d0 + (y / x)))
if (y <= 9d-205) then
tmp = t_0
else if (y <= 8.8d-176) then
tmp = ((x - y) * (1.0d0 + (x / y))) / y
else if (y <= 4.4d-168) then
tmp = t_0
else
tmp = ((x - y) * ((x + y) / y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x - y) / (x / (1.0 + (y / x)));
double tmp;
if (y <= 9e-205) {
tmp = t_0;
} else if (y <= 8.8e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 4.4e-168) {
tmp = t_0;
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
def code(x, y): t_0 = (x - y) / (x / (1.0 + (y / x))) tmp = 0 if y <= 9e-205: tmp = t_0 elif y <= 8.8e-176: tmp = ((x - y) * (1.0 + (x / y))) / y elif y <= 4.4e-168: tmp = t_0 else: tmp = ((x - y) * ((x + y) / y)) / y return tmp
function code(x, y) t_0 = Float64(Float64(x - y) / Float64(x / Float64(1.0 + Float64(y / x)))) tmp = 0.0 if (y <= 9e-205) tmp = t_0; elseif (y <= 8.8e-176) tmp = Float64(Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) / y); elseif (y <= 4.4e-168) tmp = t_0; else tmp = Float64(Float64(Float64(x - y) * Float64(Float64(x + y) / y)) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = (x - y) / (x / (1.0 + (y / x))); tmp = 0.0; if (y <= 9e-205) tmp = t_0; elseif (y <= 8.8e-176) tmp = ((x - y) * (1.0 + (x / y))) / y; elseif (y <= 4.4e-168) tmp = t_0; else tmp = ((x - y) * ((x + y) / y)) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / N[(x / N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-205], t$95$0, If[LessEqual[y, 8.8e-176], N[(N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 4.4e-168], t$95$0, N[(N[(N[(x - y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{\frac{x}{1 + \frac{y}{x}}}\\
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-176}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)}{y}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-168}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \frac{x + y}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205 or 8.7999999999999994e-176 < y < 4.3999999999999996e-168Initial program 58.6%
associate-/l*58.4%
fma-define58.4%
Simplified58.4%
Taylor expanded in x around inf 37.1%
clear-num37.1%
un-div-inv37.2%
Applied egg-rr37.2%
if 8.99999999999999912e-205 < y < 8.7999999999999994e-176Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
associate-*r/84.0%
Applied egg-rr84.0%
if 4.3999999999999996e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
associate-*r/70.2%
Applied egg-rr70.2%
Taylor expanded in y around 0 70.2%
Final simplification45.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ y x))))
(if (<= y 9e-205)
(/ 1.0 (/ x (* (- x y) t_0)))
(if (<= y 8.2e-176)
(/ (* (- x y) (+ 1.0 (/ x y))) y)
(if (<= y 4.7e-168)
(/ (- x y) (/ x t_0))
(/ (* (- x y) (/ (+ x y) y)) y))))))
double code(double x, double y) {
double t_0 = 1.0 + (y / x);
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * t_0));
} else if (y <= 8.2e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 4.7e-168) {
tmp = (x - y) / (x / t_0);
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
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 = 1.0d0 + (y / x)
if (y <= 9d-205) then
tmp = 1.0d0 / (x / ((x - y) * t_0))
else if (y <= 8.2d-176) then
tmp = ((x - y) * (1.0d0 + (x / y))) / y
else if (y <= 4.7d-168) then
tmp = (x - y) / (x / t_0)
else
tmp = ((x - y) * ((x + y) / y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (y / x);
double tmp;
if (y <= 9e-205) {
tmp = 1.0 / (x / ((x - y) * t_0));
} else if (y <= 8.2e-176) {
tmp = ((x - y) * (1.0 + (x / y))) / y;
} else if (y <= 4.7e-168) {
tmp = (x - y) / (x / t_0);
} else {
tmp = ((x - y) * ((x + y) / y)) / y;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (y / x) tmp = 0 if y <= 9e-205: tmp = 1.0 / (x / ((x - y) * t_0)) elif y <= 8.2e-176: tmp = ((x - y) * (1.0 + (x / y))) / y elif y <= 4.7e-168: tmp = (x - y) / (x / t_0) else: tmp = ((x - y) * ((x + y) / y)) / y return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(y / x)) tmp = 0.0 if (y <= 9e-205) tmp = Float64(1.0 / Float64(x / Float64(Float64(x - y) * t_0))); elseif (y <= 8.2e-176) tmp = Float64(Float64(Float64(x - y) * Float64(1.0 + Float64(x / y))) / y); elseif (y <= 4.7e-168) tmp = Float64(Float64(x - y) / Float64(x / t_0)); else tmp = Float64(Float64(Float64(x - y) * Float64(Float64(x + y) / y)) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (y / x); tmp = 0.0; if (y <= 9e-205) tmp = 1.0 / (x / ((x - y) * t_0)); elseif (y <= 8.2e-176) tmp = ((x - y) * (1.0 + (x / y))) / y; elseif (y <= 4.7e-168) tmp = (x - y) / (x / t_0); else tmp = ((x - y) * ((x + y) / y)) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-205], N[(1.0 / N[(x / N[(N[(x - y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-176], N[(N[(N[(x - y), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 4.7e-168], N[(N[(x - y), $MachinePrecision] / N[(x / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{y}{x}\\
\mathbf{if}\;y \leq 9 \cdot 10^{-205}:\\
\;\;\;\;\frac{1}{\frac{x}{\left(x - y\right) \cdot t\_0}}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-176}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(1 + \frac{x}{y}\right)}{y}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-168}:\\
\;\;\;\;\frac{x - y}{\frac{x}{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \frac{x + y}{y}}{y}\\
\end{array}
\end{array}
if y < 8.99999999999999912e-205Initial program 58.4%
associate-/l*58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in x around inf 36.6%
associate-*r/36.8%
clear-num36.8%
Applied egg-rr36.8%
if 8.99999999999999912e-205 < y < 8.2000000000000005e-176Initial program 14.3%
associate-/l*17.0%
fma-define17.0%
Simplified17.0%
Taylor expanded in y around inf 83.5%
associate-*r/84.0%
Applied egg-rr84.0%
if 8.2000000000000005e-176 < y < 4.70000000000000026e-168Initial program 66.7%
associate-/l*67.2%
fma-define67.2%
Simplified67.2%
Taylor expanded in x around inf 69.3%
clear-num69.3%
un-div-inv69.8%
Applied egg-rr69.8%
if 4.70000000000000026e-168 < y Initial program 99.9%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in y around inf 70.2%
associate-*r/70.2%
Applied egg-rr70.2%
Taylor expanded in y around 0 70.2%
Final simplification45.1%
(FPCore (x y) :precision binary64 (if (<= y 8.5e-205) 1.0 (if (<= y 1.5e-175) -1.0 (if (<= y 5e-168) 1.0 -1.0))))
double code(double x, double y) {
double tmp;
if (y <= 8.5e-205) {
tmp = 1.0;
} else if (y <= 1.5e-175) {
tmp = -1.0;
} else if (y <= 5e-168) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 8.5d-205) then
tmp = 1.0d0
else if (y <= 1.5d-175) then
tmp = -1.0d0
else if (y <= 5d-168) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 8.5e-205) {
tmp = 1.0;
} else if (y <= 1.5e-175) {
tmp = -1.0;
} else if (y <= 5e-168) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 8.5e-205: tmp = 1.0 elif y <= 1.5e-175: tmp = -1.0 elif y <= 5e-168: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= 8.5e-205) tmp = 1.0; elseif (y <= 1.5e-175) tmp = -1.0; elseif (y <= 5e-168) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 8.5e-205) tmp = 1.0; elseif (y <= 1.5e-175) tmp = -1.0; elseif (y <= 5e-168) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 8.5e-205], 1.0, If[LessEqual[y, 1.5e-175], -1.0, If[LessEqual[y, 5e-168], 1.0, -1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{-205}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-175}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-168}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 8.5000000000000005e-205 or 1.5e-175 < y < 5.00000000000000001e-168Initial program 58.6%
associate-/l*58.4%
fma-define58.4%
Simplified58.4%
Taylor expanded in x around inf 35.5%
if 8.5000000000000005e-205 < y < 1.5e-175 or 5.00000000000000001e-168 < y Initial program 89.6%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
Taylor expanded in x around 0 70.2%
Final simplification43.4%
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
return -1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -1.0d0
end function
public static double code(double x, double y) {
return -1.0;
}
def code(x, y): return -1.0
function code(x, y) return -1.0 end
function tmp = code(x, y) tmp = -1.0; end
code[x_, y_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 65.6%
associate-/l*65.4%
fma-define65.4%
Simplified65.4%
Taylor expanded in x around 0 66.2%
Final simplification66.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fabs (/ x y))))
(if (and (< 0.5 t_0) (< t_0 2.0))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y)))
(- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))))
double code(double x, double y) {
double t_0 = fabs((x / y));
double tmp;
if ((0.5 < t_0) && (t_0 < 2.0)) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = 1.0 - (2.0 / (1.0 + ((x / y) * (x / y))));
}
return tmp;
}
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 = abs((x / y))
if ((0.5d0 < t_0) .and. (t_0 < 2.0d0)) then
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y))
else
tmp = 1.0d0 - (2.0d0 / (1.0d0 + ((x / y) * (x / y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.abs((x / y));
double tmp;
if ((0.5 < t_0) && (t_0 < 2.0)) {
tmp = ((x - y) * (x + y)) / ((x * x) + (y * y));
} else {
tmp = 1.0 - (2.0 / (1.0 + ((x / y) * (x / y))));
}
return tmp;
}
def code(x, y): t_0 = math.fabs((x / y)) tmp = 0 if (0.5 < t_0) and (t_0 < 2.0): tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)) else: tmp = 1.0 - (2.0 / (1.0 + ((x / y) * (x / y)))) return tmp
function code(x, y) t_0 = abs(Float64(x / y)) tmp = 0.0 if ((0.5 < t_0) && (t_0 < 2.0)) tmp = Float64(Float64(Float64(x - y) * Float64(x + y)) / Float64(Float64(x * x) + Float64(y * y))); else tmp = Float64(1.0 - Float64(2.0 / Float64(1.0 + Float64(Float64(x / y) * Float64(x / y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = abs((x / y)); tmp = 0.0; if ((0.5 < t_0) && (t_0 < 2.0)) tmp = ((x - y) * (x + y)) / ((x * x) + (y * y)); else tmp = 1.0 - (2.0 / (1.0 + ((x / y) * (x / y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[And[Less[0.5, t$95$0], Less[t$95$0, 2.0]], N[(N[(N[(x - y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(2.0 / N[(1.0 + N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;0.5 < t\_0 \land t\_0 < 2:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{2}{1 + \frac{x}{y} \cdot \frac{x}{y}}\\
\end{array}
\end{array}
herbie shell --seed 2024055
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (and (< 0.0 x) (< x 1.0)) (< y 1.0))
:alt
(if (and (< 0.5 (fabs (/ x y))) (< (fabs (/ x y)) 2.0)) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))