summaryrefslogtreecommitdiff
path: root/out_str.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-01-11 16:42:09 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-01-11 16:42:09 +0000
commit287719a810fe0dc3451c472bae286f871ece0073 (patch)
treecc4abb1824604d29c4d249460931156db5895339 /out_str.c
parentb74081b8ae84e33c86f9a8939b9fcddd8efbf1cd (diff)
downloadmpfr-287719a810fe0dc3451c472bae286f871ece0073.tar.gz
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
Diffstat (limited to 'out_str.c')
-rw-r--r--out_str.c13
1 files changed, 6 insertions, 7 deletions
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;
}