From 287719a810fe0dc3451c472bae286f871ece0073 Mon Sep 17 00:00:00 2001 From: zimmerma Date: Thu, 11 Jan 2001 16:42:09 +0000 Subject: sprintf -> fprintf _mp_free_func -> _gmp_free_func git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@971 280ebfd0-de03-0410-8827-d642c229c3f4 --- out_str.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'out_str.c') diff --git a/out_str.c b/out_str.c index 9b7d7408b..3f7ebbbcb 100644 --- a/out_str.c +++ b/out_str.c @@ -39,7 +39,9 @@ mpfr_out_str (stream, base, n_digits, op, rnd_mode) mp_rnd_t rnd_mode; #endif { - char *s,*s0; size_t l; mp_exp_t e; + char *s, *s0; + size_t l; + mp_exp_t e; if (MPFR_IS_NAN(op)) { fprintf(stream, "NaN"); return 3; } if (!MPFR_NOTZERO(op)) { fprintf(stream, "0"); return 1; } @@ -49,7 +51,7 @@ mpfr_out_str (stream, base, n_digits, op, rnd_mode) else { fprintf(stream, "-Inf"); return 4; } } - s = mpfr_get_str(NULL, &e, base, n_digits, op, rnd_mode); + s = mpfr_get_str (NULL, &e, base, n_digits, op, rnd_mode); /* TODO: maintenir le code pour les infinis dans get_str ? */ s0 = s; /* for op=3.1416 we have s = "31416" and e = 1 */ @@ -61,12 +63,9 @@ mpfr_out_str (stream, base, n_digits, op, rnd_mode) fputc('.', stream); /* decimal point */ fputs(s, stream); /* rest of mantissa */ if (e) { - fputc((base>10) ? '@' : 'e', stream); l++; - sprintf(s, "%ld", e); - l += strlen(s); - fprintf(stream, "%s", s); + l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), e); } - (*_mp_free_func)(s0, l); + (*__gmp_free_func)(s0, l); return l; } -- cgit v1.2.1