
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
def code(x, eps): return math.tan((x + eps)) - math.tan(x)
function code(x, eps) return Float64(tan(Float64(x + eps)) - tan(x)) end
function tmp = code(x, eps) tmp = tan((x + eps)) - tan(x); end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan \left(x + \varepsilon\right) - \tan x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
def code(x, eps): return math.tan((x + eps)) - math.tan(x)
function code(x, eps) return Float64(tan(Float64(x + eps)) - tan(x)) end
function tmp = code(x, eps) tmp = tan((x + eps)) - tan(x); end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan \left(x + \varepsilon\right) - \tan x
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (tan x)))
(t_1 (fma -1.0 (tan x) (tan x)))
(t_2 (+ (tan x) (tan eps)))
(t_3 (pow (cos x) 2.0))
(t_4 (pow (sin x) 2.0))
(t_5 (+ (cos x) (/ t_4 (cos x)))))
(if (<= eps -4.8e-5)
(+ (fma t_2 (/ 1.0 (- 1.0 (* (tan x) (tan eps)))) t_0) t_1)
(if (<= eps 5e-5)
(+
(fma
(pow eps 3.0)
(+
0.3333333333333333
(-
(/ t_4 (/ (pow (cos x) 3.0) t_5))
(* -0.3333333333333333 (/ t_4 t_3))))
(/ eps (/ (cos x) t_5)))
(/ (pow eps 2.0) (/ t_3 (* (sin x) t_5))))
(+ t_1 (fma t_2 (/ -1.0 (fma (tan x) (tan eps) -1.0)) t_0))))))
double code(double x, double eps) {
double t_0 = -tan(x);
double t_1 = fma(-1.0, tan(x), tan(x));
double t_2 = tan(x) + tan(eps);
double t_3 = pow(cos(x), 2.0);
double t_4 = pow(sin(x), 2.0);
double t_5 = cos(x) + (t_4 / cos(x));
double tmp;
if (eps <= -4.8e-5) {
tmp = fma(t_2, (1.0 / (1.0 - (tan(x) * tan(eps)))), t_0) + t_1;
} else if (eps <= 5e-5) {
tmp = fma(pow(eps, 3.0), (0.3333333333333333 + ((t_4 / (pow(cos(x), 3.0) / t_5)) - (-0.3333333333333333 * (t_4 / t_3)))), (eps / (cos(x) / t_5))) + (pow(eps, 2.0) / (t_3 / (sin(x) * t_5)));
} else {
tmp = t_1 + fma(t_2, (-1.0 / fma(tan(x), tan(eps), -1.0)), t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(-tan(x)) t_1 = fma(-1.0, tan(x), tan(x)) t_2 = Float64(tan(x) + tan(eps)) t_3 = cos(x) ^ 2.0 t_4 = sin(x) ^ 2.0 t_5 = Float64(cos(x) + Float64(t_4 / cos(x))) tmp = 0.0 if (eps <= -4.8e-5) tmp = Float64(fma(t_2, Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), t_0) + t_1); elseif (eps <= 5e-5) tmp = Float64(fma((eps ^ 3.0), Float64(0.3333333333333333 + Float64(Float64(t_4 / Float64((cos(x) ^ 3.0) / t_5)) - Float64(-0.3333333333333333 * Float64(t_4 / t_3)))), Float64(eps / Float64(cos(x) / t_5))) + Float64((eps ^ 2.0) / Float64(t_3 / Float64(sin(x) * t_5)))); else tmp = Float64(t_1 + fma(t_2, Float64(-1.0 / fma(tan(x), tan(eps), -1.0)), t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = (-N[Tan[x], $MachinePrecision])}, Block[{t$95$1 = N[(-1.0 * N[Tan[x], $MachinePrecision] + N[Tan[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[x], $MachinePrecision] + N[(t$95$4 / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.8e-5], N[(N[(t$95$2 * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[eps, 5e-5], N[(N[(N[Power[eps, 3.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[(t$95$4 / N[(N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision] / t$95$5), $MachinePrecision]), $MachinePrecision] - N[(-0.3333333333333333 * N[(t$95$4 / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps / N[(N[Cos[x], $MachinePrecision] / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[eps, 2.0], $MachinePrecision] / N[(t$95$3 / N[(N[Sin[x], $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 * N[(-1.0 / N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\tan x\\
t_1 := \mathsf{fma}\left(-1, \tan x, \tan x\right)\\
t_2 := \tan x + \tan \varepsilon\\
t_3 := {\cos x}^{2}\\
t_4 := {\sin x}^{2}\\
t_5 := \cos x + \frac{t_4}{\cos x}\\
\mathbf{if}\;\varepsilon \leq -4.8 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(t_2, \frac{1}{1 - \tan x \cdot \tan \varepsilon}, t_0\right) + t_1\\
\mathbf{elif}\;\varepsilon \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left({\varepsilon}^{3}, 0.3333333333333333 + \left(\frac{t_4}{\frac{{\cos x}^{3}}{t_5}} - -0.3333333333333333 \cdot \frac{t_4}{t_3}\right), \frac{\varepsilon}{\frac{\cos x}{t_5}}\right) + \frac{{\varepsilon}^{2}}{\frac{t_3}{\sin x \cdot t_5}}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t_2, \frac{-1}{\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)}, t_0\right)\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (tan x)))
(t_1 (fma -1.0 (tan x) (tan x)))
(t_2 (+ (tan x) (tan eps)))
(t_3 (/ (pow (sin x) 2.0) (cos x)))
(t_4 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -0.00034)
(+ (fma t_2 (/ 1.0 t_4) t_0) t_1)
(if (<= eps 0.00044)
(/
(fma
eps
(+ (cos x) t_3)
(*
(pow eps 3.0)
(- (* 0.3333333333333333 (cos x)) (* -0.3333333333333333 t_3))))
(* t_4 (cos x)))
(+ t_1 (fma t_2 (/ -1.0 (fma (tan x) (tan eps) -1.0)) t_0))))))
double code(double x, double eps) {
double t_0 = -tan(x);
double t_1 = fma(-1.0, tan(x), tan(x));
double t_2 = tan(x) + tan(eps);
double t_3 = pow(sin(x), 2.0) / cos(x);
double t_4 = 1.0 - (tan(x) * tan(eps));
double tmp;
if (eps <= -0.00034) {
tmp = fma(t_2, (1.0 / t_4), t_0) + t_1;
} else if (eps <= 0.00044) {
tmp = fma(eps, (cos(x) + t_3), (pow(eps, 3.0) * ((0.3333333333333333 * cos(x)) - (-0.3333333333333333 * t_3)))) / (t_4 * cos(x));
} else {
tmp = t_1 + fma(t_2, (-1.0 / fma(tan(x), tan(eps), -1.0)), t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(-tan(x)) t_1 = fma(-1.0, tan(x), tan(x)) t_2 = Float64(tan(x) + tan(eps)) t_3 = Float64((sin(x) ^ 2.0) / cos(x)) t_4 = Float64(1.0 - Float64(tan(x) * tan(eps))) tmp = 0.0 if (eps <= -0.00034) tmp = Float64(fma(t_2, Float64(1.0 / t_4), t_0) + t_1); elseif (eps <= 0.00044) tmp = Float64(fma(eps, Float64(cos(x) + t_3), Float64((eps ^ 3.0) * Float64(Float64(0.3333333333333333 * cos(x)) - Float64(-0.3333333333333333 * t_3)))) / Float64(t_4 * cos(x))); else tmp = Float64(t_1 + fma(t_2, Float64(-1.0 / fma(tan(x), tan(eps), -1.0)), t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = (-N[Tan[x], $MachinePrecision])}, Block[{t$95$1 = N[(-1.0 * N[Tan[x], $MachinePrecision] + N[Tan[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -0.00034], N[(N[(t$95$2 * N[(1.0 / t$95$4), $MachinePrecision] + t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[eps, 0.00044], N[(N[(eps * N[(N[Cos[x], $MachinePrecision] + t$95$3), $MachinePrecision] + N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(0.3333333333333333 * N[Cos[x], $MachinePrecision]), $MachinePrecision] - N[(-0.3333333333333333 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 * N[(-1.0 / N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\tan x\\
t_1 := \mathsf{fma}\left(-1, \tan x, \tan x\right)\\
t_2 := \tan x + \tan \varepsilon\\
t_3 := \frac{{\sin x}^{2}}{\cos x}\\
t_4 := 1 - \tan x \cdot \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -0.00034:\\
\;\;\;\;\mathsf{fma}\left(t_2, \frac{1}{t_4}, t_0\right) + t_1\\
\mathbf{elif}\;\varepsilon \leq 0.00044:\\
\;\;\;\;\frac{\mathsf{fma}\left(\varepsilon, \cos x + t_3, {\varepsilon}^{3} \cdot \left(0.3333333333333333 \cdot \cos x - -0.3333333333333333 \cdot t_3\right)\right)}{t_4 \cdot \cos x}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t_2, \frac{-1}{\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)}, t_0\right)\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (tan x)))
(t_1 (fma -1.0 (tan x) (tan x)))
(t_2 (+ (tan x) (tan eps)))
(t_3 (+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0)))))
(if (<= eps -7.8e-7)
(+ (fma t_2 (/ 1.0 (- 1.0 (* (tan x) (tan eps)))) t_0) t_1)
(if (<= eps 2.35e-7)
(+ (* eps t_3) (/ (* (pow eps 2.0) (* (sin x) t_3)) (cos x)))
(+ t_1 (fma t_2 (/ -1.0 (fma (tan x) (tan eps) -1.0)) t_0))))))
double code(double x, double eps) {
double t_0 = -tan(x);
double t_1 = fma(-1.0, tan(x), tan(x));
double t_2 = tan(x) + tan(eps);
double t_3 = 1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.0));
double tmp;
if (eps <= -7.8e-7) {
tmp = fma(t_2, (1.0 / (1.0 - (tan(x) * tan(eps)))), t_0) + t_1;
} else if (eps <= 2.35e-7) {
tmp = (eps * t_3) + ((pow(eps, 2.0) * (sin(x) * t_3)) / cos(x));
} else {
tmp = t_1 + fma(t_2, (-1.0 / fma(tan(x), tan(eps), -1.0)), t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(-tan(x)) t_1 = fma(-1.0, tan(x), tan(x)) t_2 = Float64(tan(x) + tan(eps)) t_3 = Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0))) tmp = 0.0 if (eps <= -7.8e-7) tmp = Float64(fma(t_2, Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), t_0) + t_1); elseif (eps <= 2.35e-7) tmp = Float64(Float64(eps * t_3) + Float64(Float64((eps ^ 2.0) * Float64(sin(x) * t_3)) / cos(x))); else tmp = Float64(t_1 + fma(t_2, Float64(-1.0 / fma(tan(x), tan(eps), -1.0)), t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = (-N[Tan[x], $MachinePrecision])}, Block[{t$95$1 = N[(-1.0 * N[Tan[x], $MachinePrecision] + N[Tan[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -7.8e-7], N[(N[(t$95$2 * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[eps, 2.35e-7], N[(N[(eps * t$95$3), $MachinePrecision] + N[(N[(N[Power[eps, 2.0], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 * N[(-1.0 / N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\tan x\\
t_1 := \mathsf{fma}\left(-1, \tan x, \tan x\right)\\
t_2 := \tan x + \tan \varepsilon\\
t_3 := 1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\mathbf{if}\;\varepsilon \leq -7.8 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(t_2, \frac{1}{1 - \tan x \cdot \tan \varepsilon}, t_0\right) + t_1\\
\mathbf{elif}\;\varepsilon \leq 2.35 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot t_3 + \frac{{\varepsilon}^{2} \cdot \left(\sin x \cdot t_3\right)}{\cos x}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t_2, \frac{-1}{\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)}, t_0\right)\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (tan x)))
(t_1 (fma -1.0 (tan x) (tan x)))
(t_2 (+ (tan x) (tan eps)))
(t_3 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -4.1e-7)
(+ (fma t_2 (/ 1.0 t_3) t_0) t_1)
(if (<= eps 6.4e-7)
(/ (* eps (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))) (* t_3 (cos x)))
(+ t_1 (fma t_2 (/ -1.0 (fma (tan x) (tan eps) -1.0)) t_0))))))
double code(double x, double eps) {
double t_0 = -tan(x);
double t_1 = fma(-1.0, tan(x), tan(x));
double t_2 = tan(x) + tan(eps);
double t_3 = 1.0 - (tan(x) * tan(eps));
double tmp;
if (eps <= -4.1e-7) {
tmp = fma(t_2, (1.0 / t_3), t_0) + t_1;
} else if (eps <= 6.4e-7) {
tmp = (eps * (cos(x) + (pow(sin(x), 2.0) / cos(x)))) / (t_3 * cos(x));
} else {
tmp = t_1 + fma(t_2, (-1.0 / fma(tan(x), tan(eps), -1.0)), t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(-tan(x)) t_1 = fma(-1.0, tan(x), tan(x)) t_2 = Float64(tan(x) + tan(eps)) t_3 = Float64(1.0 - Float64(tan(x) * tan(eps))) tmp = 0.0 if (eps <= -4.1e-7) tmp = Float64(fma(t_2, Float64(1.0 / t_3), t_0) + t_1); elseif (eps <= 6.4e-7) tmp = Float64(Float64(eps * Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x)))) / Float64(t_3 * cos(x))); else tmp = Float64(t_1 + fma(t_2, Float64(-1.0 / fma(tan(x), tan(eps), -1.0)), t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = (-N[Tan[x], $MachinePrecision])}, Block[{t$95$1 = N[(-1.0 * N[Tan[x], $MachinePrecision] + N[Tan[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.1e-7], N[(N[(t$95$2 * N[(1.0 / t$95$3), $MachinePrecision] + t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[eps, 6.4e-7], N[(N[(eps * N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 * N[(-1.0 / N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\tan x\\
t_1 := \mathsf{fma}\left(-1, \tan x, \tan x\right)\\
t_2 := \tan x + \tan \varepsilon\\
t_3 := 1 - \tan x \cdot \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.1 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(t_2, \frac{1}{t_3}, t_0\right) + t_1\\
\mathbf{elif}\;\varepsilon \leq 6.4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(\cos x + \frac{{\sin x}^{2}}{\cos x}\right)}{t_3 \cdot \cos x}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t_2, \frac{-1}{\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)}, t_0\right)\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps)))
(t_1 (- 1.0 (* (tan x) (tan eps))))
(t_2 (/ 1.0 t_1)))
(if (<= eps -3.3e-7)
(+ (fma t_0 t_2 (- (tan x))) (fma -1.0 (tan x) (tan x)))
(if (<= eps 3.8e-7)
(/ (* eps (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))) (* t_1 (cos x)))
(- (* t_0 t_2) (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 = 1.0 / t_1;
double tmp;
if (eps <= -3.3e-7) {
tmp = fma(t_0, t_2, -tan(x)) + fma(-1.0, tan(x), tan(x));
} else if (eps <= 3.8e-7) {
tmp = (eps * (cos(x) + (pow(sin(x), 2.0) / cos(x)))) / (t_1 * cos(x));
} else {
tmp = (t_0 * t_2) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) t_1 = Float64(1.0 - Float64(tan(x) * tan(eps))) t_2 = Float64(1.0 / t_1) tmp = 0.0 if (eps <= -3.3e-7) tmp = Float64(fma(t_0, t_2, Float64(-tan(x))) + fma(-1.0, tan(x), tan(x))); elseif (eps <= 3.8e-7) tmp = Float64(Float64(eps * Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x)))) / Float64(t_1 * cos(x))); else tmp = Float64(Float64(t_0 * t_2) - tan(x)); end return tmp end
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[(1.0 / t$95$1), $MachinePrecision]}, If[LessEqual[eps, -3.3e-7], N[(N[(t$95$0 * t$95$2 + (-N[Tan[x], $MachinePrecision])), $MachinePrecision] + N[(-1.0 * N[Tan[x], $MachinePrecision] + N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.8e-7], N[(N[(eps * N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * t$95$2), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
t_1 := 1 - \tan x \cdot \tan \varepsilon\\
t_2 := \frac{1}{t_1}\\
\mathbf{if}\;\varepsilon \leq -3.3 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_2, -\tan x\right) + \mathsf{fma}\left(-1, \tan x, \tan x\right)\\
\mathbf{elif}\;\varepsilon \leq 3.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(\cos x + \frac{{\sin x}^{2}}{\cos x}\right)}{t_1 \cdot \cos x}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_2 - \tan x\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* (tan x) (tan eps)))))
(if (or (<= eps -5.2e-7) (not (<= eps 9.5e-7)))
(- (* (+ (tan x) (tan eps)) (/ 1.0 t_0)) (tan x))
(/ (* eps (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))) (* t_0 (cos x))))))
double code(double x, double eps) {
double t_0 = 1.0 - (tan(x) * tan(eps));
double tmp;
if ((eps <= -5.2e-7) || !(eps <= 9.5e-7)) {
tmp = ((tan(x) + tan(eps)) * (1.0 / t_0)) - tan(x);
} else {
tmp = (eps * (cos(x) + (pow(sin(x), 2.0) / cos(x)))) / (t_0 * cos(x));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (tan(x) * tan(eps))
if ((eps <= (-5.2d-7)) .or. (.not. (eps <= 9.5d-7))) then
tmp = ((tan(x) + tan(eps)) * (1.0d0 / t_0)) - tan(x)
else
tmp = (eps * (cos(x) + ((sin(x) ** 2.0d0) / cos(x)))) / (t_0 * cos(x))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 - (Math.tan(x) * Math.tan(eps));
double tmp;
if ((eps <= -5.2e-7) || !(eps <= 9.5e-7)) {
tmp = ((Math.tan(x) + Math.tan(eps)) * (1.0 / t_0)) - Math.tan(x);
} else {
tmp = (eps * (Math.cos(x) + (Math.pow(Math.sin(x), 2.0) / Math.cos(x)))) / (t_0 * Math.cos(x));
}
return tmp;
}
def code(x, eps): t_0 = 1.0 - (math.tan(x) * math.tan(eps)) tmp = 0 if (eps <= -5.2e-7) or not (eps <= 9.5e-7): tmp = ((math.tan(x) + math.tan(eps)) * (1.0 / t_0)) - math.tan(x) else: tmp = (eps * (math.cos(x) + (math.pow(math.sin(x), 2.0) / math.cos(x)))) / (t_0 * math.cos(x)) return tmp
function code(x, eps) t_0 = Float64(1.0 - Float64(tan(x) * tan(eps))) tmp = 0.0 if ((eps <= -5.2e-7) || !(eps <= 9.5e-7)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) * Float64(1.0 / t_0)) - tan(x)); else tmp = Float64(Float64(eps * Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x)))) / Float64(t_0 * cos(x))); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 - (tan(x) * tan(eps)); tmp = 0.0; if ((eps <= -5.2e-7) || ~((eps <= 9.5e-7))) tmp = ((tan(x) + tan(eps)) * (1.0 / t_0)) - tan(x); else tmp = (eps * (cos(x) + ((sin(x) ^ 2.0) / cos(x)))) / (t_0 * cos(x)); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eps, -5.2e-7], N[Not[LessEqual[eps, 9.5e-7]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(N[(eps * N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \tan x \cdot \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -5.2 \cdot 10^{-7} \lor \neg \left(\varepsilon \leq 9.5 \cdot 10^{-7}\right):\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) \cdot \frac{1}{t_0} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(\cos x + \frac{{\sin x}^{2}}{\cos x}\right)}{t_0 \cdot \cos x}\\
\end{array}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -6e-9)
(- (* t_0 (/ 1.0 (- 1.0 (* (tan x) (tan eps))))) (tan x))
(if (<= eps 8e-31)
(/ eps (/ (cos x) (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))))
(- (- (tan x)) (/ t_0 (fma (tan x) (tan eps) -1.0)))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -6e-9) {
tmp = (t_0 * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x);
} else if (eps <= 8e-31) {
tmp = eps / (cos(x) / (cos(x) + (pow(sin(x), 2.0) / cos(x))));
} else {
tmp = -tan(x) - (t_0 / fma(tan(x), tan(eps), -1.0));
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -6e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps))))) - tan(x)); elseif (eps <= 8e-31) tmp = Float64(eps / Float64(cos(x) / Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x))))); else tmp = Float64(Float64(-tan(x)) - Float64(t_0 / fma(tan(x), tan(eps), -1.0))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -6e-9], N[(N[(t$95$0 * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 8e-31], N[(eps / N[(N[Cos[x], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Tan[x], $MachinePrecision]) - N[(t$95$0 / N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -6 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 8 \cdot 10^{-31}:\\
\;\;\;\;\frac{\varepsilon}{\frac{\cos x}{\cos x + \frac{{\sin x}^{2}}{\cos x}}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\tan x\right) - \frac{t_0}{\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)}\\
\end{array}
\end{array}
(FPCore (x eps) :precision binary64 (if (or (<= eps -6.5e-9) (not (<= eps 8e-31))) (- (* (+ (tan x) (tan eps)) (/ 1.0 (- 1.0 (* (tan x) (tan eps))))) (tan x)) (/ eps (/ (cos x) (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -6.5e-9) || !(eps <= 8e-31)) {
tmp = ((tan(x) + tan(eps)) * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x);
} else {
tmp = eps / (cos(x) / (cos(x) + (pow(sin(x), 2.0) / cos(x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-6.5d-9)) .or. (.not. (eps <= 8d-31))) then
tmp = ((tan(x) + tan(eps)) * (1.0d0 / (1.0d0 - (tan(x) * tan(eps))))) - tan(x)
else
tmp = eps / (cos(x) / (cos(x) + ((sin(x) ** 2.0d0) / cos(x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -6.5e-9) || !(eps <= 8e-31)) {
tmp = ((Math.tan(x) + Math.tan(eps)) * (1.0 / (1.0 - (Math.tan(x) * Math.tan(eps))))) - Math.tan(x);
} else {
tmp = eps / (Math.cos(x) / (Math.cos(x) + (Math.pow(Math.sin(x), 2.0) / Math.cos(x))));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -6.5e-9) or not (eps <= 8e-31): tmp = ((math.tan(x) + math.tan(eps)) * (1.0 / (1.0 - (math.tan(x) * math.tan(eps))))) - math.tan(x) else: tmp = eps / (math.cos(x) / (math.cos(x) + (math.pow(math.sin(x), 2.0) / math.cos(x)))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -6.5e-9) || !(eps <= 8e-31)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) * Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps))))) - tan(x)); else tmp = Float64(eps / Float64(cos(x) / Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -6.5e-9) || ~((eps <= 8e-31))) tmp = ((tan(x) + tan(eps)) * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x); else tmp = eps / (cos(x) / (cos(x) + ((sin(x) ^ 2.0) / cos(x)))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -6.5e-9], N[Not[LessEqual[eps, 8e-31]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(eps / N[(N[Cos[x], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -6.5 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 8 \cdot 10^{-31}\right):\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) \cdot \frac{1}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{\varepsilon}{\frac{\cos x}{\cos x + \frac{{\sin x}^{2}}{\cos x}}}\\
\end{array}
\end{array}
(FPCore (x eps) :precision binary64 (if (or (<= eps -6e-9) (not (<= eps 8e-31))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (/ eps (/ (cos x) (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -6e-9) || !(eps <= 8e-31)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = eps / (cos(x) / (cos(x) + (pow(sin(x), 2.0) / cos(x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-6d-9)) .or. (.not. (eps <= 8d-31))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else
tmp = eps / (cos(x) / (cos(x) + ((sin(x) ** 2.0d0) / cos(x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -6e-9) || !(eps <= 8e-31)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else {
tmp = eps / (Math.cos(x) / (Math.cos(x) + (Math.pow(Math.sin(x), 2.0) / Math.cos(x))));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -6e-9) or not (eps <= 8e-31): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) else: tmp = eps / (math.cos(x) / (math.cos(x) + (math.pow(math.sin(x), 2.0) / math.cos(x)))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -6e-9) || !(eps <= 8e-31)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); else tmp = Float64(eps / Float64(cos(x) / Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -6e-9) || ~((eps <= 8e-31))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x); else tmp = eps / (cos(x) / (cos(x) + ((sin(x) ^ 2.0) / cos(x)))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -6e-9], N[Not[LessEqual[eps, 8e-31]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(eps / N[(N[Cos[x], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -6 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 8 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{\varepsilon}{\frac{\cos x}{\cos x + \frac{{\sin x}^{2}}{\cos x}}}\\
\end{array}
\end{array}
(FPCore (x eps) :precision binary64 (if (or (<= eps -3.7e-6) (not (<= eps 1.2e-6))) (tan eps) (/ eps (/ (cos x) (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -3.7e-6) || !(eps <= 1.2e-6)) {
tmp = tan(eps);
} else {
tmp = eps / (cos(x) / (cos(x) + (pow(sin(x), 2.0) / cos(x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-3.7d-6)) .or. (.not. (eps <= 1.2d-6))) then
tmp = tan(eps)
else
tmp = eps / (cos(x) / (cos(x) + ((sin(x) ** 2.0d0) / cos(x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -3.7e-6) || !(eps <= 1.2e-6)) {
tmp = Math.tan(eps);
} else {
tmp = eps / (Math.cos(x) / (Math.cos(x) + (Math.pow(Math.sin(x), 2.0) / Math.cos(x))));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -3.7e-6) or not (eps <= 1.2e-6): tmp = math.tan(eps) else: tmp = eps / (math.cos(x) / (math.cos(x) + (math.pow(math.sin(x), 2.0) / math.cos(x)))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -3.7e-6) || !(eps <= 1.2e-6)) tmp = tan(eps); else tmp = Float64(eps / Float64(cos(x) / Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -3.7e-6) || ~((eps <= 1.2e-6))) tmp = tan(eps); else tmp = eps / (cos(x) / (cos(x) + ((sin(x) ^ 2.0) / cos(x)))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -3.7e-6], N[Not[LessEqual[eps, 1.2e-6]], $MachinePrecision]], N[Tan[eps], $MachinePrecision], N[(eps / N[(N[Cos[x], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.7 \cdot 10^{-6} \lor \neg \left(\varepsilon \leq 1.2 \cdot 10^{-6}\right):\\
\;\;\;\;\tan \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\frac{\varepsilon}{\frac{\cos x}{\cos x + \frac{{\sin x}^{2}}{\cos x}}}\\
\end{array}
\end{array}
(FPCore (x eps) :precision binary64 (if (or (<= eps -7.6e-6) (not (<= eps 5.2e-6))) (tan eps) (* eps (+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -7.6e-6) || !(eps <= 5.2e-6)) {
tmp = tan(eps);
} else {
tmp = eps * (1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-7.6d-6)) .or. (.not. (eps <= 5.2d-6))) then
tmp = tan(eps)
else
tmp = eps * (1.0d0 + ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -7.6e-6) || !(eps <= 5.2e-6)) {
tmp = Math.tan(eps);
} else {
tmp = eps * (1.0 + (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -7.6e-6) or not (eps <= 5.2e-6): tmp = math.tan(eps) else: tmp = eps * (1.0 + (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -7.6e-6) || !(eps <= 5.2e-6)) tmp = tan(eps); else tmp = Float64(eps * Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -7.6e-6) || ~((eps <= 5.2e-6))) tmp = tan(eps); else tmp = eps * (1.0 + ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -7.6e-6], N[Not[LessEqual[eps, 5.2e-6]], $MachinePrecision]], N[Tan[eps], $MachinePrecision], N[(eps * N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -7.6 \cdot 10^{-6} \lor \neg \left(\varepsilon \leq 5.2 \cdot 10^{-6}\right):\\
\;\;\;\;\tan \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)\\
\end{array}
\end{array}
(FPCore (x eps) :precision binary64 (tan eps))
double code(double x, double eps) {
return tan(eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan(eps)
end function
public static double code(double x, double eps) {
return Math.tan(eps);
}
def code(x, eps): return math.tan(eps)
function code(x, eps) return tan(eps) end
function tmp = code(x, eps) tmp = tan(eps); end
code[x_, eps_] := N[Tan[eps], $MachinePrecision]
\begin{array}{l}
\\
\tan \varepsilon
\end{array}
(FPCore (x eps) :precision binary64 eps)
double code(double x, double eps) {
return eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps
end function
public static double code(double x, double eps) {
return eps;
}
def code(x, eps): return eps
function code(x, eps) return eps end
function tmp = code(x, eps) tmp = eps; end
code[x_, eps_] := eps
\begin{array}{l}
\\
\varepsilon
\end{array}
(FPCore (x eps) :precision binary64 (/ (sin eps) (* (cos x) (cos (+ x eps)))))
double code(double x, double eps) {
return sin(eps) / (cos(x) * cos((x + eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin(eps) / (cos(x) * cos((x + eps)))
end function
public static double code(double x, double eps) {
return Math.sin(eps) / (Math.cos(x) * Math.cos((x + eps)));
}
def code(x, eps): return math.sin(eps) / (math.cos(x) * math.cos((x + eps)))
function code(x, eps) return Float64(sin(eps) / Float64(cos(x) * cos(Float64(x + eps)))) end
function tmp = code(x, eps) tmp = sin(eps) / (cos(x) * cos((x + eps))); end
code[x_, eps_] := N[(N[Sin[eps], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * N[Cos[N[(x + eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)}
\end{array}
herbie shell --seed 2023350
(FPCore (x eps)
:name "2tan (problem 3.3.2)"
:precision binary64
:herbie-target
(/ (sin eps) (* (cos x) (cos (+ x eps))))
(- (tan (+ x eps)) (tan x)))