Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\tan \left(x + \varepsilon\right) - \tan x
\]
↓
\[\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
t_1 := 1 - \tan x \cdot \tan \varepsilon\\
t_2 := \frac{\sin x}{\cos x}\\
\mathbf{if}\;\varepsilon \leq -4.25 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(\left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \varepsilon \cdot \left(t_2 + {t_2}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1} - \tan x\\
\end{array}
\]
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x))) ↓
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps)))
(t_1 (- 1.0 (* (tan x) (tan eps))))
(t_2 (/ (sin x) (cos x))))
(if (<= eps -4.25e-7)
(- (/ t_0 t_1) (tan x))
(if (<= eps 8.2e-7)
(*
eps
(+
(+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0)))
(* eps (+ t_2 (pow t_2 3.0)))))
(- (* t_0 (/ 1.0 t_1)) (tan x)))))) double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
↓
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double t_1 = 1.0 - (tan(x) * tan(eps));
double t_2 = sin(x) / cos(x);
double tmp;
if (eps <= -4.25e-7) {
tmp = (t_0 / t_1) - tan(x);
} else if (eps <= 8.2e-7) {
tmp = eps * ((1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.0))) + (eps * (t_2 + pow(t_2, 3.0))));
} else {
tmp = (t_0 * (1.0 / t_1)) - tan(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
↓
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = tan(x) + tan(eps)
t_1 = 1.0d0 - (tan(x) * tan(eps))
t_2 = sin(x) / cos(x)
if (eps <= (-4.25d-7)) then
tmp = (t_0 / t_1) - tan(x)
else if (eps <= 8.2d-7) then
tmp = eps * ((1.0d0 + ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0))) + (eps * (t_2 + (t_2 ** 3.0d0))))
else
tmp = (t_0 * (1.0d0 / t_1)) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
↓
public static double code(double x, double eps) {
double t_0 = Math.tan(x) + Math.tan(eps);
double t_1 = 1.0 - (Math.tan(x) * Math.tan(eps));
double t_2 = Math.sin(x) / Math.cos(x);
double tmp;
if (eps <= -4.25e-7) {
tmp = (t_0 / t_1) - Math.tan(x);
} else if (eps <= 8.2e-7) {
tmp = eps * ((1.0 + (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0))) + (eps * (t_2 + Math.pow(t_2, 3.0))));
} else {
tmp = (t_0 * (1.0 / t_1)) - Math.tan(x);
}
return tmp;
}
def code(x, eps):
return math.tan((x + eps)) - math.tan(x)
↓
def code(x, eps):
t_0 = math.tan(x) + math.tan(eps)
t_1 = 1.0 - (math.tan(x) * math.tan(eps))
t_2 = math.sin(x) / math.cos(x)
tmp = 0
if eps <= -4.25e-7:
tmp = (t_0 / t_1) - math.tan(x)
elif eps <= 8.2e-7:
tmp = eps * ((1.0 + (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) + (eps * (t_2 + math.pow(t_2, 3.0))))
else:
tmp = (t_0 * (1.0 / t_1)) - math.tan(x)
return tmp
function code(x, eps)
return Float64(tan(Float64(x + eps)) - tan(x))
end
↓
function code(x, eps)
t_0 = Float64(tan(x) + tan(eps))
t_1 = Float64(1.0 - Float64(tan(x) * tan(eps)))
t_2 = Float64(sin(x) / cos(x))
tmp = 0.0
if (eps <= -4.25e-7)
tmp = Float64(Float64(t_0 / t_1) - tan(x));
elseif (eps <= 8.2e-7)
tmp = Float64(eps * Float64(Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0))) + Float64(eps * Float64(t_2 + (t_2 ^ 3.0)))));
else
tmp = Float64(Float64(t_0 * Float64(1.0 / t_1)) - tan(x));
end
return tmp
end
function tmp = code(x, eps)
tmp = tan((x + eps)) - tan(x);
end
↓
function tmp_2 = code(x, eps)
t_0 = tan(x) + tan(eps);
t_1 = 1.0 - (tan(x) * tan(eps));
t_2 = sin(x) / cos(x);
tmp = 0.0;
if (eps <= -4.25e-7)
tmp = (t_0 / t_1) - tan(x);
elseif (eps <= 8.2e-7)
tmp = eps * ((1.0 + ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))) + (eps * (t_2 + (t_2 ^ 3.0))));
else
tmp = (t_0 * (1.0 / t_1)) - tan(x);
end
tmp_2 = tmp;
end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
↓
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.25e-7], N[(N[(t$95$0 / t$95$1), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 8.2e-7], N[(eps * N[(N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(t$95$2 + N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]]
\tan \left(x + \varepsilon\right) - \tan x
↓
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
t_1 := 1 - \tan x \cdot \tan \varepsilon\\
t_2 := \frac{\sin x}{\cos x}\\
\mathbf{if}\;\varepsilon \leq -4.25 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(\left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \varepsilon \cdot \left(t_2 + {t_2}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1} - \tan x\\
\end{array}