Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\frac{1 - \cos x}{x \cdot x}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{1 - \cos x}{x \cdot x} \leq 0.498:\\
\;\;\;\;\frac{\sin x \cdot \tan \left(\frac{x}{2}\right)}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.5 + \left(0.001388888888888889 \cdot {x}^{4} + x \cdot \left(x \cdot -0.041666666666666664\right)\right)\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x))) ↓
(FPCore (x)
:precision binary64
(if (<= (/ (- 1.0 (cos x)) (* x x)) 0.498)
(/ (* (sin x) (tan (/ x 2.0))) (* x x))
(+
0.5
(+
(* 0.001388888888888889 (pow x 4.0))
(* x (* x -0.041666666666666664)))))) double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
double tmp;
if (((1.0 - cos(x)) / (x * x)) <= 0.498) {
tmp = (sin(x) * tan((x / 2.0))) / (x * x);
} else {
tmp = 0.5 + ((0.001388888888888889 * pow(x, 4.0)) + (x * (x * -0.041666666666666664)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - cos(x)) / (x * x)
end function
↓
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 - cos(x)) / (x * x)) <= 0.498d0) then
tmp = (sin(x) * tan((x / 2.0d0))) / (x * x)
else
tmp = 0.5d0 + ((0.001388888888888889d0 * (x ** 4.0d0)) + (x * (x * (-0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double x) {
return (1.0 - Math.cos(x)) / (x * x);
}
↓
public static double code(double x) {
double tmp;
if (((1.0 - Math.cos(x)) / (x * x)) <= 0.498) {
tmp = (Math.sin(x) * Math.tan((x / 2.0))) / (x * x);
} else {
tmp = 0.5 + ((0.001388888888888889 * Math.pow(x, 4.0)) + (x * (x * -0.041666666666666664)));
}
return tmp;
}
def code(x):
return (1.0 - math.cos(x)) / (x * x)
↓
def code(x):
tmp = 0
if ((1.0 - math.cos(x)) / (x * x)) <= 0.498:
tmp = (math.sin(x) * math.tan((x / 2.0))) / (x * x)
else:
tmp = 0.5 + ((0.001388888888888889 * math.pow(x, 4.0)) + (x * (x * -0.041666666666666664)))
return tmp
function code(x)
return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
↓
function code(x)
tmp = 0.0
if (Float64(Float64(1.0 - cos(x)) / Float64(x * x)) <= 0.498)
tmp = Float64(Float64(sin(x) * tan(Float64(x / 2.0))) / Float64(x * x));
else
tmp = Float64(0.5 + Float64(Float64(0.001388888888888889 * (x ^ 4.0)) + Float64(x * Float64(x * -0.041666666666666664))));
end
return tmp
end
function tmp = code(x)
tmp = (1.0 - cos(x)) / (x * x);
end
↓
function tmp_2 = code(x)
tmp = 0.0;
if (((1.0 - cos(x)) / (x * x)) <= 0.498)
tmp = (sin(x) * tan((x / 2.0))) / (x * x);
else
tmp = 0.5 + ((0.001388888888888889 * (x ^ 4.0)) + (x * (x * -0.041666666666666664)));
end
tmp_2 = tmp;
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
↓
code[x_] := If[LessEqual[N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision], 0.498], N[(N[(N[Sin[x], $MachinePrecision] * N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(N[(0.001388888888888889 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{1 - \cos x}{x \cdot x}
↓
\begin{array}{l}
\mathbf{if}\;\frac{1 - \cos x}{x \cdot x} \leq 0.498:\\
\;\;\;\;\frac{\sin x \cdot \tan \left(\frac{x}{2}\right)}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.5 + \left(0.001388888888888889 \cdot {x}^{4} + x \cdot \left(x \cdot -0.041666666666666664\right)\right)\\
\end{array}