(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
:precision binary64
(if (<= x -3367994.866451633)
(+ 1.0 (/ (- (tan x) (sin x)) x))
(if (<= x 1.4775726691068876e-10)
(+ (* (* x x) (fma (* x x) -0.009642857142857142 0.225)) -0.5)
(expm1 (log1p (/ (- x (sin x)) (- x (tan x))))))))double code(double x) {
return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
double tmp;
if (x <= -3367994.866451633) {
tmp = 1.0 + ((tan(x) - sin(x)) / x);
} else if (x <= 1.4775726691068876e-10) {
tmp = ((x * x) * fma((x * x), -0.009642857142857142, 0.225)) + -0.5;
} else {
tmp = expm1(log1p(((x - sin(x)) / (x - tan(x)))));
}
return tmp;
}
function code(x) return Float64(Float64(x - sin(x)) / Float64(x - tan(x))) end
function code(x) tmp = 0.0 if (x <= -3367994.866451633) tmp = Float64(1.0 + Float64(Float64(tan(x) - sin(x)) / x)); elseif (x <= 1.4775726691068876e-10) tmp = Float64(Float64(Float64(x * x) * fma(Float64(x * x), -0.009642857142857142, 0.225)) + -0.5); else tmp = expm1(log1p(Float64(Float64(x - sin(x)) / Float64(x - tan(x))))); end return tmp end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := If[LessEqual[x, -3367994.866451633], N[(1.0 + N[(N[(N[Tan[x], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4775726691068876e-10], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.009642857142857142 + 0.225), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(Exp[N[Log[1 + N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]]]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -3367994.866451633:\\
\;\;\;\;1 + \frac{\tan x - \sin x}{x}\\
\mathbf{elif}\;x \leq 1.4775726691068876 \cdot 10^{-10}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \mathsf{fma}\left(x \cdot x, -0.009642857142857142, 0.225\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x - \sin x}{x - \tan x}\right)\right)\\
\end{array}
if x < -3367994.8664516332Initial program 0.0
Taylor expanded in x around inf 0.0
Simplified0.0
Applied egg-rr0.0
if -3367994.8664516332 < x < 1.4775726691068876e-10Initial program 62.7
Taylor expanded in x around 0 0.8
Taylor expanded in x around 0 0.8
Simplified0.8
if 1.4775726691068876e-10 < x Initial program 0.9
Applied egg-rr0.9
Final simplification0.6
herbie shell --seed 2022190
(FPCore (x)
:name "sintan (problem 3.4.5)"
:precision binary64
(/ (- x (sin x)) (- x (tan x))))