(FPCore (x) :precision binary64 (- 1.0 (cos x)))
(FPCore (x) :precision binary64 (fma (pow x 6.0) 0.001388888888888889 (fma x (* x 0.5) (* (pow x 4.0) -0.041666666666666664))))
double code(double x) {
return 1.0 - cos(x);
}
double code(double x) {
return fma(pow(x, 6.0), 0.001388888888888889, fma(x, (x * 0.5), (pow(x, 4.0) * -0.041666666666666664)));
}
function code(x) return Float64(1.0 - cos(x)) end
function code(x) return fma((x ^ 6.0), 0.001388888888888889, fma(x, Float64(x * 0.5), Float64((x ^ 4.0) * -0.041666666666666664))) end
code[x_] := N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[Power[x, 6.0], $MachinePrecision] * 0.001388888888888889 + N[(x * N[(x * 0.5), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \cos x
\mathsf{fma}\left({x}^{6}, 0.001388888888888889, \mathsf{fma}\left(x, x \cdot 0.5, {x}^{4} \cdot -0.041666666666666664\right)\right)




Bits error versus x
| Original | 30.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 30.0
Taylor expanded in x around 0 0.0
Simplified0.0
Applied egg-rr0.3
Taylor expanded in x around 0 0.6
Simplified0.0
Final simplification0.0
herbie shell --seed 2022160
(FPCore (x)
:name "ENA, Section 1.4, Mentioned, A"
:precision binary64
:pre (and (<= -0.01 x) (<= x 0.01))
:herbie-target
(/ (* (sin x) (sin x)) (+ 1.0 (cos x)))
(- 1.0 (cos x)))