\[\left(-1.79 \cdot 10^{+308} \leq x \land x \leq 1.79 \cdot 10^{+308}\right) \land \left(-1.79 \cdot 10^{+308} \leq y \land y \leq 1.79 \cdot 10^{+308}\right)\]
\[\sqrt{{x}^{2} + {y}^{2}} - x
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\sqrt{{x}^{2} + {y}^{2}} - x \leq 0:\\
\;\;\;\;\frac{0.5}{\frac{x}{y} \cdot \frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(x, y\right) - x\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- (sqrt (+ (pow x 2.0) (pow y 2.0))) x))
↓
(FPCore (x y)
:precision binary64
(if (<= (- (sqrt (+ (pow x 2.0) (pow y 2.0))) x) 0.0)
(/ 0.5 (* (/ x y) (/ 1.0 y)))
(- (hypot x y) x)))
double code(double x, double y) {
return sqrt((pow(x, 2.0) + pow(y, 2.0))) - x;
}
↓
double code(double x, double y) {
double tmp;
if ((sqrt((pow(x, 2.0) + pow(y, 2.0))) - x) <= 0.0) {
tmp = 0.5 / ((x / y) * (1.0 / y));
} else {
tmp = hypot(x, y) - x;
}
return tmp;
}
public static double code(double x, double y) {
return Math.sqrt((Math.pow(x, 2.0) + Math.pow(y, 2.0))) - x;
}
↓
public static double code(double x, double y) {
double tmp;
if ((Math.sqrt((Math.pow(x, 2.0) + Math.pow(y, 2.0))) - x) <= 0.0) {
tmp = 0.5 / ((x / y) * (1.0 / y));
} else {
tmp = Math.hypot(x, y) - x;
}
return tmp;
}
def code(x, y):
return math.sqrt((math.pow(x, 2.0) + math.pow(y, 2.0))) - x
↓
def code(x, y):
tmp = 0
if (math.sqrt((math.pow(x, 2.0) + math.pow(y, 2.0))) - x) <= 0.0:
tmp = 0.5 / ((x / y) * (1.0 / y))
else:
tmp = math.hypot(x, y) - x
return tmp
function code(x, y)
return Float64(sqrt(Float64((x ^ 2.0) + (y ^ 2.0))) - x)
end
↓
function code(x, y)
tmp = 0.0
if (Float64(sqrt(Float64((x ^ 2.0) + (y ^ 2.0))) - x) <= 0.0)
tmp = Float64(0.5 / Float64(Float64(x / y) * Float64(1.0 / y)));
else
tmp = Float64(hypot(x, y) - x);
end
return tmp
end
function tmp = code(x, y)
tmp = sqrt(((x ^ 2.0) + (y ^ 2.0))) - x;
end
↓
function tmp_2 = code(x, y)
tmp = 0.0;
if ((sqrt(((x ^ 2.0) + (y ^ 2.0))) - x) <= 0.0)
tmp = 0.5 / ((x / y) * (1.0 / y));
else
tmp = hypot(x, y) - x;
end
tmp_2 = tmp;
end
code[x_, y_] := N[(N[Sqrt[N[(N[Power[x, 2.0], $MachinePrecision] + N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - x), $MachinePrecision]
↓
code[x_, y_] := If[LessEqual[N[(N[Sqrt[N[(N[Power[x, 2.0], $MachinePrecision] + N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - x), $MachinePrecision], 0.0], N[(0.5 / N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] - x), $MachinePrecision]]
\sqrt{{x}^{2} + {y}^{2}} - x
↓
\begin{array}{l}
\mathbf{if}\;\sqrt{{x}^{2} + {y}^{2}} - x \leq 0:\\
\;\;\;\;\frac{0.5}{\frac{x}{y} \cdot \frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(x, y\right) - x\\
\end{array}
Alternatives
Alternative 1 |
---|
Error | 25.5 |
---|
Cost | 1900 |
---|
\[\begin{array}{l}
t_0 := \left(-x\right) - y\\
t_1 := y \cdot \left(0.5 \cdot \frac{y}{x}\right)\\
t_2 := 0.5 \cdot \frac{y \cdot y}{x}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -6.6 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-157}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq -1.38 \cdot 10^{-204}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-213}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-254}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-304}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-183}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-142}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-96}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-86}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 2 |
---|
Error | 25.6 |
---|
Cost | 1900 |
---|
\[\begin{array}{l}
t_0 := \left(-x\right) - y\\
t_1 := y \cdot \left(0.5 \cdot \frac{y}{x}\right)\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-116}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot y}{x}\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-158}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-212}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-255}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-304}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7.1 \cdot 10^{-183}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-95}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-80}:\\
\;\;\;\;y \cdot \left(y \cdot \frac{0.5}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 3 |
---|
Error | 25.6 |
---|
Cost | 1900 |
---|
\[\begin{array}{l}
t_0 := \left(-x\right) - y\\
t_1 := y \cdot \left(0.5 \cdot \frac{y}{x}\right)\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-120}:\\
\;\;\;\;\frac{0.5}{x} \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-157}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-204}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-211}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-255}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-304}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-179}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-95}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-85}:\\
\;\;\;\;y \cdot \left(y \cdot \frac{0.5}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 4 |
---|
Error | 25.6 |
---|
Cost | 1900 |
---|
\[\begin{array}{l}
t_0 := \left(-x\right) - y\\
t_1 := \frac{0.5}{\frac{x}{y} \cdot \frac{1}{y}}\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{-46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-117}:\\
\;\;\;\;\frac{0.5}{x} \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-156}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-204}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-212}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-254}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-304}:\\
\;\;\;\;y \cdot \left(0.5 \cdot \frac{y}{x}\right)\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{-178}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-99}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-85}:\\
\;\;\;\;y \cdot \left(y \cdot \frac{0.5}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 5 |
---|
Error | 25.6 |
---|
Cost | 976 |
---|
\[\begin{array}{l}
t_0 := 0.5 \cdot \frac{y \cdot y}{x}\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{-46}:\\
\;\;\;\;\left(-x\right) - y\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-118}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-179}:\\
\;\;\;\;x \cdot -2\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-95}:\\
\;\;\;\;x \cdot -2\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 6 |
---|
Error | 26.0 |
---|
Cost | 456 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-103}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 10^{-99}:\\
\;\;\;\;x \cdot -2\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\]
Alternative 7 |
---|
Error | 25.6 |
---|
Cost | 456 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-103}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-98}:\\
\;\;\;\;x \cdot -2\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 8 |
---|
Error | 25.3 |
---|
Cost | 456 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-103}:\\
\;\;\;\;\left(-x\right) - y\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{-99}:\\
\;\;\;\;x \cdot -2\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
Alternative 9 |
---|
Error | 30.7 |
---|
Cost | 260 |
---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-296}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\]
Alternative 10 |
---|
Error | 46.3 |
---|
Cost | 64 |
---|
\[y
\]