Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\frac{1 - \cos x}{x \cdot x}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.0045 \lor \neg \left(x \leq 0.0047\right):\\
\;\;\;\;\frac{\frac{\cos x + -1}{x}}{-x}\\
\mathbf{else}:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x))) ↓
(FPCore (x)
:precision binary64
(if (or (<= x -0.0045) (not (<= x 0.0047)))
(/ (/ (+ (cos x) -1.0) x) (- x))
(+ 0.5 (* (* x x) -0.041666666666666664)))) double code(double x) {
return (1.0 - cos(x)) / (x * x);
}
↓
double code(double x) {
double tmp;
if ((x <= -0.0045) || !(x <= 0.0047)) {
tmp = ((cos(x) + -1.0) / x) / -x;
} else {
tmp = 0.5 + ((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 ((x <= (-0.0045d0)) .or. (.not. (x <= 0.0047d0))) then
tmp = ((cos(x) + (-1.0d0)) / x) / -x
else
tmp = 0.5d0 + ((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 ((x <= -0.0045) || !(x <= 0.0047)) {
tmp = ((Math.cos(x) + -1.0) / x) / -x;
} else {
tmp = 0.5 + ((x * x) * -0.041666666666666664);
}
return tmp;
}
def code(x):
return (1.0 - math.cos(x)) / (x * x)
↓
def code(x):
tmp = 0
if (x <= -0.0045) or not (x <= 0.0047):
tmp = ((math.cos(x) + -1.0) / x) / -x
else:
tmp = 0.5 + ((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 ((x <= -0.0045) || !(x <= 0.0047))
tmp = Float64(Float64(Float64(cos(x) + -1.0) / x) / Float64(-x));
else
tmp = Float64(0.5 + Float64(Float64(x * 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 ((x <= -0.0045) || ~((x <= 0.0047)))
tmp = ((cos(x) + -1.0) / x) / -x;
else
tmp = 0.5 + ((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[Or[LessEqual[x, -0.0045], N[Not[LessEqual[x, 0.0047]], $MachinePrecision]], N[(N[(N[(N[Cos[x], $MachinePrecision] + -1.0), $MachinePrecision] / x), $MachinePrecision] / (-x)), $MachinePrecision], N[(0.5 + N[(N[(x * x), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]]
\frac{1 - \cos x}{x \cdot x}
↓
\begin{array}{l}
\mathbf{if}\;x \leq -0.0045 \lor \neg \left(x \leq 0.0047\right):\\
\;\;\;\;\frac{\frac{\cos x + -1}{x}}{-x}\\
\mathbf{else}:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\
\end{array}