(FPCore (x) :precision binary64 (/ (- x (sin x)) (tan x)))
(FPCore (x)
:precision binary64
(fma
0.16666666666666666
(* x x)
(fma
(pow x 8.0)
-0.00023644179894179894
(fma
(pow x 6.0)
-0.0007275132275132275
(* (pow x 4.0) -0.06388888888888888)))))double code(double x) {
return (x - sin(x)) / tan(x);
}
double code(double x) {
return fma(0.16666666666666666, (x * x), fma(pow(x, 8.0), -0.00023644179894179894, fma(pow(x, 6.0), -0.0007275132275132275, (pow(x, 4.0) * -0.06388888888888888))));
}
function code(x) return Float64(Float64(x - sin(x)) / tan(x)) end
function code(x) return fma(0.16666666666666666, Float64(x * x), fma((x ^ 8.0), -0.00023644179894179894, fma((x ^ 6.0), -0.0007275132275132275, Float64((x ^ 4.0) * -0.06388888888888888)))) end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Tan[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(0.16666666666666666 * N[(x * x), $MachinePrecision] + N[(N[Power[x, 8.0], $MachinePrecision] * -0.00023644179894179894 + N[(N[Power[x, 6.0], $MachinePrecision] * -0.0007275132275132275 + N[(N[Power[x, 4.0], $MachinePrecision] * -0.06388888888888888), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - \sin x}{\tan x}
\mathsf{fma}\left(0.16666666666666666, x \cdot x, \mathsf{fma}\left({x}^{8}, -0.00023644179894179894, \mathsf{fma}\left({x}^{6}, -0.0007275132275132275, {x}^{4} \cdot -0.06388888888888888\right)\right)\right)




Bits error versus x
| Original | 30.4 |
|---|---|
| Target | 0.8 |
| Herbie | 0.3 |
Initial program 30.4
Taylor expanded in x around 0 0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2022129
(FPCore (x)
:name "ENA, Section 1.4, Exercise 4a"
:precision binary64
:pre (and (<= -1.0 x) (<= x 1.0))
:herbie-target
(* 0.16666666666666666 (* x x))
(/ (- x (sin x)) (tan x)))