\[-1 \leq x \land x \leq 1\]
\[\frac{\cos x - 1}{\cos^{-1} \cos x}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{-0.5 \cdot \left(x \cdot x\right)}{\left|\left(x \mathsf{rem} \left(2 \cdot \pi\right)\right)\right|}\\
\mathbf{else}:\\
\;\;\;\;x \cdot -0.5 + 0.041666666666666664 \cdot {x}^{3}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- (cos x) 1.0) (acos (cos x))))
↓
(FPCore (x)
:precision binary64
(if (<= x -5e-311)
(/ (* -0.5 (* x x)) (fabs (remainder x (* 2.0 PI))))
(+ (* x -0.5) (* 0.041666666666666664 (pow x 3.0)))))
double code(double x) {
return (cos(x) - 1.0) / acos(cos(x));
}
↓
double code(double x) {
double tmp;
if (x <= -5e-311) {
tmp = (-0.5 * (x * x)) / fabs(remainder(x, (2.0 * ((double) M_PI))));
} else {
tmp = (x * -0.5) + (0.041666666666666664 * pow(x, 3.0));
}
return tmp;
}
public static double code(double x) {
return (Math.cos(x) - 1.0) / Math.acos(Math.cos(x));
}
↓
public static double code(double x) {
double tmp;
if (x <= -5e-311) {
tmp = (-0.5 * (x * x)) / Math.abs(Math.IEEEremainder(x, (2.0 * Math.PI)));
} else {
tmp = (x * -0.5) + (0.041666666666666664 * Math.pow(x, 3.0));
}
return tmp;
}
def code(x):
return (math.cos(x) - 1.0) / math.acos(math.cos(x))
↓
def code(x):
tmp = 0
if x <= -5e-311:
tmp = (-0.5 * (x * x)) / math.fabs(math.remainder(x, (2.0 * math.pi)))
else:
tmp = (x * -0.5) + (0.041666666666666664 * math.pow(x, 3.0))
return tmp
code[x_] := N[(N[(N[Cos[x], $MachinePrecision] - 1.0), $MachinePrecision] / N[ArcCos[N[Cos[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := If[LessEqual[x, -5e-311], N[(N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision] / N[Abs[N[With[{TMP1 = x, TMP2 = N[(2.0 * Pi), $MachinePrecision]}, TMP1 - Round[TMP1 / TMP2] * TMP2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x * -0.5), $MachinePrecision] + N[(0.041666666666666664 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{\cos x - 1}{\cos^{-1} \cos x}
↓
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{-0.5 \cdot \left(x \cdot x\right)}{\left|\left(x \mathsf{rem} \left(2 \cdot \pi\right)\right)\right|}\\
\mathbf{else}:\\
\;\;\;\;x \cdot -0.5 + 0.041666666666666664 \cdot {x}^{3}\\
\end{array}