[Win32] set_str() ignores exponent iff base > 36
Sisyphus
sisyphus1 at optusnet.com.au
Sat Dec 8 06:29:38 CET 2007
Hi,
I'm running GMP-4.2.2 that I built from source in the MSYS shell using the
MinGW port of gcc-3.4.5.
Here's the test script:
----------------------------------
#include <stdio.h>
#include <gmp.h>
int main(void) {
int ret1, ret2;
mpf_t x;
printf("%s\n", gmp_version);
mpf_set_default_prec(64);
ret1 = mpf_init_set_str(x, "ZXFY at -17", 62);
ret2 = mpf_out_str(stdout, 62, 0, x);
printf("\n%d %d\n", ret1, ret2);
}
--------------------------------
And here's the output:
--------------------------------
4.2.2
0.ZXFY at 4
0 8
--------------------------------
I can change the exponent to whatever value I choose, and recompile, but the
output doesn't vary.
If I provide the string 0.ZXFY at -17 in the above demo, then mpf_out_str()
prints 0.ZXFY at 0 as the value (again ignoring the specified exponent). For
base values <= 36, things behave correctly and as expected ... it's just
when the base exceeds 36 that the problem arises. (I haven't actually
checked each and every base in the range 2 .. 62; base 36 is fine, base 37
is not, and neither is base 62 ... that's about the extent to which I've
tested.)
Is this something that's fixable from within the GMP source ?
On Cygwin (on the same box), and built from the same source using gcc-3.4.4,
there's no such problems at all with gmp-4.2.2.
Cheers,
Rob
More information about the gmp-bugs
mailing list