\[10^{-150} < \left|x\right| \land \left|x\right| < 10^{+150}\]
\[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}
\]
↓
\[\begin{array}{l}
t_0 := \frac{x}{\mathsf{hypot}\left(x, p \cdot 2\right)}\\
t_1 := 1 + {t_0}^{3}\\
t_2 := {t_0}^{2}\\
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -1:\\
\;\;\;\;\frac{\sqrt{p \cdot \left(p \cdot 6\right)} \cdot \frac{-\sqrt{0.5}}{x}}{\sqrt{1 + \left(t_2 - t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \frac{t_1}{t_2 + \frac{1 - t_2}{t_1} \cdot \left(t_2 + \left(1 - t_0\right)\right)}}\\
\end{array}
\]
(FPCore (p x)
:precision binary64
(sqrt (* 0.5 (+ 1.0 (/ x (sqrt (+ (* (* 4.0 p) p) (* x x))))))))
↓
(FPCore (p x)
:precision binary64
(let* ((t_0 (/ x (hypot x (* p 2.0))))
(t_1 (+ 1.0 (pow t_0 3.0)))
(t_2 (pow t_0 2.0)))
(if (<= (/ x (sqrt (+ (* p (* 4.0 p)) (* x x)))) -1.0)
(/
(* (sqrt (* p (* p 6.0))) (/ (- (sqrt 0.5)) x))
(sqrt (+ 1.0 (- t_2 t_0))))
(sqrt
(* 0.5 (/ t_1 (+ t_2 (* (/ (- 1.0 t_2) t_1) (+ t_2 (- 1.0 t_0))))))))))double code(double p, double x) {
return sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
}
↓
double code(double p, double x) {
double t_0 = x / hypot(x, (p * 2.0));
double t_1 = 1.0 + pow(t_0, 3.0);
double t_2 = pow(t_0, 2.0);
double tmp;
if ((x / sqrt(((p * (4.0 * p)) + (x * x)))) <= -1.0) {
tmp = (sqrt((p * (p * 6.0))) * (-sqrt(0.5) / x)) / sqrt((1.0 + (t_2 - t_0)));
} else {
tmp = sqrt((0.5 * (t_1 / (t_2 + (((1.0 - t_2) / t_1) * (t_2 + (1.0 - t_0)))))));
}
return tmp;
}
public static double code(double p, double x) {
return Math.sqrt((0.5 * (1.0 + (x / Math.sqrt((((4.0 * p) * p) + (x * x)))))));
}
↓
public static double code(double p, double x) {
double t_0 = x / Math.hypot(x, (p * 2.0));
double t_1 = 1.0 + Math.pow(t_0, 3.0);
double t_2 = Math.pow(t_0, 2.0);
double tmp;
if ((x / Math.sqrt(((p * (4.0 * p)) + (x * x)))) <= -1.0) {
tmp = (Math.sqrt((p * (p * 6.0))) * (-Math.sqrt(0.5) / x)) / Math.sqrt((1.0 + (t_2 - t_0)));
} else {
tmp = Math.sqrt((0.5 * (t_1 / (t_2 + (((1.0 - t_2) / t_1) * (t_2 + (1.0 - t_0)))))));
}
return tmp;
}
def code(p, x):
return math.sqrt((0.5 * (1.0 + (x / math.sqrt((((4.0 * p) * p) + (x * x)))))))
↓
def code(p, x):
t_0 = x / math.hypot(x, (p * 2.0))
t_1 = 1.0 + math.pow(t_0, 3.0)
t_2 = math.pow(t_0, 2.0)
tmp = 0
if (x / math.sqrt(((p * (4.0 * p)) + (x * x)))) <= -1.0:
tmp = (math.sqrt((p * (p * 6.0))) * (-math.sqrt(0.5) / x)) / math.sqrt((1.0 + (t_2 - t_0)))
else:
tmp = math.sqrt((0.5 * (t_1 / (t_2 + (((1.0 - t_2) / t_1) * (t_2 + (1.0 - t_0)))))))
return tmp
function code(p, x)
return sqrt(Float64(0.5 * Float64(1.0 + Float64(x / sqrt(Float64(Float64(Float64(4.0 * p) * p) + Float64(x * x)))))))
end
↓
function code(p, x)
t_0 = Float64(x / hypot(x, Float64(p * 2.0)))
t_1 = Float64(1.0 + (t_0 ^ 3.0))
t_2 = t_0 ^ 2.0
tmp = 0.0
if (Float64(x / sqrt(Float64(Float64(p * Float64(4.0 * p)) + Float64(x * x)))) <= -1.0)
tmp = Float64(Float64(sqrt(Float64(p * Float64(p * 6.0))) * Float64(Float64(-sqrt(0.5)) / x)) / sqrt(Float64(1.0 + Float64(t_2 - t_0))));
else
tmp = sqrt(Float64(0.5 * Float64(t_1 / Float64(t_2 + Float64(Float64(Float64(1.0 - t_2) / t_1) * Float64(t_2 + Float64(1.0 - t_0)))))));
end
return tmp
end
function tmp = code(p, x)
tmp = sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
end
↓
function tmp_2 = code(p, x)
t_0 = x / hypot(x, (p * 2.0));
t_1 = 1.0 + (t_0 ^ 3.0);
t_2 = t_0 ^ 2.0;
tmp = 0.0;
if ((x / sqrt(((p * (4.0 * p)) + (x * x)))) <= -1.0)
tmp = (sqrt((p * (p * 6.0))) * (-sqrt(0.5) / x)) / sqrt((1.0 + (t_2 - t_0)));
else
tmp = sqrt((0.5 * (t_1 / (t_2 + (((1.0 - t_2) / t_1) * (t_2 + (1.0 - t_0)))))));
end
tmp_2 = tmp;
end
code[p_, x_] := N[Sqrt[N[(0.5 * N[(1.0 + N[(x / N[Sqrt[N[(N[(N[(4.0 * p), $MachinePrecision] * p), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
↓
code[p_, x_] := Block[{t$95$0 = N[(x / N[Sqrt[x ^ 2 + N[(p * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, 2.0], $MachinePrecision]}, If[LessEqual[N[(x / N[Sqrt[N[(N[(p * N[(4.0 * p), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], N[(N[(N[Sqrt[N[(p * N[(p * 6.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[0.5], $MachinePrecision]) / x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[(t$95$2 - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.5 * N[(t$95$1 / N[(t$95$2 + N[(N[(N[(1.0 - t$95$2), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(t$95$2 + N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}
↓
\begin{array}{l}
t_0 := \frac{x}{\mathsf{hypot}\left(x, p \cdot 2\right)}\\
t_1 := 1 + {t_0}^{3}\\
t_2 := {t_0}^{2}\\
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -1:\\
\;\;\;\;\frac{\sqrt{p \cdot \left(p \cdot 6\right)} \cdot \frac{-\sqrt{0.5}}{x}}{\sqrt{1 + \left(t_2 - t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \frac{t_1}{t_2 + \frac{1 - t_2}{t_1} \cdot \left(t_2 + \left(1 - t_0\right)\right)}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 6.0 |
|---|
| Cost | 47364 |
|---|
\[\begin{array}{l}
t_0 := \frac{x}{\mathsf{hypot}\left(x, p \cdot 2\right)}\\
t_1 := {t_0}^{2}\\
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -1:\\
\;\;\;\;\frac{\sqrt{p \cdot \left(p \cdot 6\right)} \cdot \frac{-\sqrt{0.5}}{x}}{\sqrt{1 + \left(t_1 - t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \frac{1 + {t_0}^{3}}{t_1 + \left(1 - t_0\right)}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 6.0 |
|---|
| Cost | 47300 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, p \cdot 2\right)\\
t_1 := \frac{x}{t_0}\\
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -1:\\
\;\;\;\;\frac{\sqrt{p \cdot \left(p \cdot 6\right)} \cdot \frac{-\sqrt{0.5}}{x}}{\sqrt{1 + \left({t_1}^{2} - t_1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + x \cdot \frac{0.5}{t_0}}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 6.0 |
|---|
| Cost | 20612 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{x}{\sqrt{p \cdot \left(4 \cdot p\right) + x \cdot x}} \leq -1:\\
\;\;\;\;\frac{-\sqrt{2}}{\frac{x}{\sqrt{0.5 \cdot \left(p \cdot p\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(x, p \cdot 2\right)}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 13.5 |
|---|
| Cost | 13705 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+14} \lor \neg \left(x \leq -8000000000\right):\\
\;\;\;\;\sqrt{0.5 + x \cdot \frac{0.5}{\mathsf{hypot}\left(x, p \cdot 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-p}{x}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 20.0 |
|---|
| Cost | 6860 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -1.85 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;p \leq 2.15 \cdot 10^{-266}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 6.8 \cdot 10^{-74}:\\
\;\;\;\;\frac{-p}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 35.6 |
|---|
| Cost | 388 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.38 \cdot 10^{-132}:\\
\;\;\;\;\frac{-p}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 40.9 |
|---|
| Cost | 64 |
|---|
\[1
\]