summaryrefslogtreecommitdiff
path: root/set_d64.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-05-27 13:17:03 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-05-27 13:17:03 +0000
commit7f60244ed55c022d23dfa2ff83374898d3d38fb3 (patch)
tree57b4fda529190d1de361ade3c3c0a89ff20e01a6 /set_d64.c
parent5dfa09f9107f20ff61eab588b8b1d991d1a02b07 (diff)
downloadmpfr-7f60244ed55c022d23dfa2ff83374898d3d38fb3.tar.gz
set_d64.c: Partial revert of r6190 to fix problem in a simpler way: the decimal digits can be stored in array of char (no need to be unsigned).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6248 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_d64.c')
-rw-r--r--set_d64.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/set_d64.c b/set_d64.c
index aaa776b72..3535e49a1 100644
--- a/set_d64.c
+++ b/set_d64.c
@@ -110,7 +110,7 @@ decimal64_to_string (char *s, _Decimal64 d)
{
union ieee_double_extract x;
union ieee_double_decimal64 y;
- unsigned char *t;
+ char *t;
unsigned int Gh; /* most 5 significant bits from combination field */
int exp; /* exponent */
mp_limb_t rp[2];
@@ -137,7 +137,7 @@ decimal64_to_string (char *s, _Decimal64 d)
sprintf (s, "-Inf");
return;
}
- t = (unsigned char*)s;
+ t = s;
if (x.s.sig)
*t++ = '-';
@@ -198,24 +198,24 @@ decimal64_to_string (char *s, _Decimal64 d)
}
else
{
- i = mpn_get_str (t, 10, rp, rn);
+ i = mpn_get_str ((unsigned char*)t, 10, rp, rn);
}
while (i-- > 0)
*t++ += '0';
#endif /* DPD or BID */
exp -= 398; /* unbiased exponent */
- t += sprintf ((char *)t, "E%d", exp);
+ t += sprintf (t, "E%d", exp);
}
int
mpfr_set_decimal64 (mpfr_ptr r, _Decimal64 d, mp_rnd_t rnd_mode)
{
char s[23]; /* need 1 character for sign,
- 16 characters for mantissa,
- 1 character for exponent,
- 4 characters for exponent (including sign),
- 1 character for terminating \0. */
+ 16 characters for mantissa,
+ 1 character for exponent,
+ 4 characters for exponent (including sign),
+ 1 character for terminating \0. */
decimal64_to_string (s, d);
return mpfr_set_str (r, s, 10, rnd_mode);