\[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\]
↓
\[\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -10:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) + -1, x\right)\\
\end{array}
\]
(FPCore (x)
:precision binary64
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -10.0)
(copysign (log (/ 1.0 (+ (* x -2.0) (/ -0.5 x)))) x)
(if (<= t_0 5e-7)
(copysign (+ x (* -0.16666666666666666 (* x (* x x)))) x)
(copysign (+ (+ 1.0 (log (+ x (hypot 1.0 x)))) -1.0) x)))))double code(double x) {
return copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
}
↓
double code(double x) {
double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -10.0) {
tmp = copysign(log((1.0 / ((x * -2.0) + (-0.5 / x)))), x);
} else if (t_0 <= 5e-7) {
tmp = copysign((x + (-0.16666666666666666 * (x * (x * x)))), x);
} else {
tmp = copysign(((1.0 + log((x + hypot(1.0, x)))) + -1.0), x);
}
return tmp;
}
public static double code(double x) {
return Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
}
↓
public static double code(double x) {
double t_0 = Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -10.0) {
tmp = Math.copySign(Math.log((1.0 / ((x * -2.0) + (-0.5 / x)))), x);
} else if (t_0 <= 5e-7) {
tmp = Math.copySign((x + (-0.16666666666666666 * (x * (x * x)))), x);
} else {
tmp = Math.copySign(((1.0 + Math.log((x + Math.hypot(1.0, x)))) + -1.0), x);
}
return tmp;
}
def code(x):
return math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
↓
def code(x):
t_0 = math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
tmp = 0
if t_0 <= -10.0:
tmp = math.copysign(math.log((1.0 / ((x * -2.0) + (-0.5 / x)))), x)
elif t_0 <= 5e-7:
tmp = math.copysign((x + (-0.16666666666666666 * (x * (x * x)))), x)
else:
tmp = math.copysign(((1.0 + math.log((x + math.hypot(1.0, x)))) + -1.0), x)
return tmp
function code(x)
return copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x)
end
↓
function code(x)
t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x)
tmp = 0.0
if (t_0 <= -10.0)
tmp = copysign(log(Float64(1.0 / Float64(Float64(x * -2.0) + Float64(-0.5 / x)))), x);
elseif (t_0 <= 5e-7)
tmp = copysign(Float64(x + Float64(-0.16666666666666666 * Float64(x * Float64(x * x)))), x);
else
tmp = copysign(Float64(Float64(1.0 + log(Float64(x + hypot(1.0, x)))) + -1.0), x);
end
return tmp
end
function tmp = code(x)
tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0)))));
end
↓
function tmp_2 = code(x)
t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0)))));
tmp = 0.0;
if (t_0 <= -10.0)
tmp = sign(x) * abs(log((1.0 / ((x * -2.0) + (-0.5 / x)))));
elseif (t_0 <= 5e-7)
tmp = sign(x) * abs((x + (-0.16666666666666666 * (x * (x * x)))));
else
tmp = sign(x) * abs(((1.0 + log((x + hypot(1.0, x)))) + -1.0));
end
tmp_2 = tmp;
end
code[x_] := N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]}, If[LessEqual[t$95$0, -10.0], N[With[{TMP1 = Abs[N[Log[N[(1.0 / N[(N[(x * -2.0), $MachinePrecision] + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 5e-7], N[With[{TMP1 = Abs[N[(x + N[(-0.16666666666666666 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[(N[(1.0 + N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
↓
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -10:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\left(1 + \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) + -1, x\right)\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.2 |
|---|
| Cost | 19784 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.96:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\
\mathbf{elif}\;x \leq 0.00106:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.3 |
|---|
| Cost | 13576 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.3 |
|---|
| Cost | 13576 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.96:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{x \cdot -2 + \frac{-0.5}{x}}\right), x\right)\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 11.2 |
|---|
| Cost | 13320 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.4 |
|---|
| Cost | 13320 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(x \cdot \left(x \cdot x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 22.5 |
|---|
| Cost | 13124 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 26.3 |
|---|
| Cost | 13060 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 30.4 |
|---|
| Cost | 6528 |
|---|
\[\mathsf{copysign}\left(x, x\right)
\]