mpfr sin(pi) != 0
Torbjorn Granlund
tg at gmplib.org
Thu Mar 1 20:58:08 CET 2012
Jacopo Nespolo <j.nespolo at gmail.com> writes:
this is slightly, but not so much, off topic, as it is a problem
related to mpfr rather than gmp strictly speaking.
I found myself calculating
sin(pi * n * x)
with n in N and x in R. I used mpfr_const_pi for pi.
Sometimes it happens that n*x = 1, and this screwed the whole
calculation because i would get 10^-(a lot, according to working
precision) instead of zero. This was also a particularly unlucky case,
because it happened to be in the subdiagonal of a sparse matrix,
surrounded by zeros, thus the diagonalisation algorithms in Eigen
considered important to keep it.
Do you think it could be worth it to file a bug, at least to warn
about the issue in the documentation of the trigonometric functions,
or it is just expected behaviour and I got fool because I'm a newbie?
After having read and reread your text, I fail to understand what you're
trying to say.
But it seems very clear that whatever problems you might have
encountered, they are not GMP-related.
--
Torbjörn
More information about the gmp-discuss
mailing list