gmp 4.2.4 - mpf_add two large negative floats - strange result

James Youngman jay at gnu.org
Wed Jan 21 09:32:05 CET 2009


On Wed, Jan 21, 2009 at 7:36 AM, Bruce M. Axtens <bruce.axtens at gmail.com> wrote:
> G'day everyone,
>
> I'm summing two negative floats:
>
> char * lhs = "-2234.6016114467412141";
> char * rhs = "-4939600281397002.2812";
>
> According to Perl, using bignum and Math::BigFloat, the answer is
>
> -4939600281399236.8828114467412141
>
> However, according to GMP, using the code below, the answer is
>
> -4939600281399236.88281
>
> Where have I gone wrong? What happened to the remaining "14467412141"?

At a guess, http://en.wikipedia.org/wiki/Significant_figures#Superfluous_precision


More information about the gmp-discuss mailing list