Skip Menu |

This queue is for tickets about the Math-MPFR CPAN distribution.

Report information
The Basics
Id: 30746
Status: resolved
Priority: 0/
Queue: Math-MPFR

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.10
  • 1.11
  • 2.01
Fixed in: (no value)



Subject: Win32, buffering problem with Rmpfr_out_str
## Bug Demo Script ## use warnings; use Math::MPFR qw (:mpfr); die "**USAGE: perl script.pl prec **" unless @ARGV; Rmpfr_set_default_prec($ARGV[0]); $string = '9' x 4096 . '8' x 5; $mpfr = Math::MPFR->new($string); Rmpfr_out_str($mpfr, 10, 0, GMP_RNDN); __END__ Perl 5.8.8, mpfr-2.3.0, gmp-4.2.2 (but probably applies to earlier versions of all three). Affects Win32 only (I think). For precisions less than 204096, the outptut is as expected. But for precisions greater than or equal to 204096, the mantissa is truncated to the first 4098 characters (4099 characters if $mpfr is negative). That is, each fputc() in mpfr_out_str() functions correctly, but the fputs() only releases the next 4096 characters - which, I suspect, is all that the buffer holds. For example, if precision is set to 204095, Rmpfr_out_str() returns 61446, and the following *61446-character* string is output: 9.99....998888800.....00e4100 That is as it should be. But if precision is set to 204096, Rmpfr_out_str() returns 61447, and the following *4103-character* string is output: 9.99....998e4100 Even if I change the 3rd arg from "0" to "61441", the output doesn't alter. I can't find a fix for the problem (from within either perl, XS or the mpfr source). Annoyingly, I also can't reproduce the problem outside of mpfr. Programs written in C aren't affected - the behaviour relates only to Math::MPFR. In short, I don't know why it happens, and I've filed this bug report in the hopes that someone might stumble across it and provide/suggest a solution. Cheers, Rob
Nearly 7 years later, and the problem seems to be no longer present. Of course, by now, I'm using a different version of Windows (Windows 7), mpfr-3.2.x and gmp-6.0.0a. I've no idea what fixed it (or precisely when it was fixed), and currently plan to make no further investigation. Cheers, Rob
Closing because: a) it's no longer an issue; b) no-one (including me) is interested Cheers, Rob