summaryrefslogtreecommitdiff
path: root/src/get_d128.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-06-20 17:01:09 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-06-20 17:01:09 +0000
commit7b003e384833581665c115720cdc73fbda7a6972 (patch)
tree7d51a40e2f867f7d3b7457418358dbfe5cbf5a8f /src/get_d128.c
parent4cd859de27089c5b4b34e1f3c07a1513ad9326ac (diff)
downloadmpfr-7b003e384833581665c115720cdc73fbda7a6972.tar.gz
[src/get_d128.c] avoid using doubles
[tests/tget_set_d128.c] improve test coverage git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12798 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/get_d128.c')
-rw-r--r--src/get_d128.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/get_d128.c b/src/get_d128.c
index d01f7dba2..ee80fd4b0 100644
--- a/src/get_d128.c
+++ b/src/get_d128.c
@@ -101,7 +101,7 @@ string_to_Decimal128 (char *s) /* portable version */
char m[35];
long n = 0; /* mantissa length */
char *endptr[1];
- _Decimal128 x = 0.0dl;
+ _Decimal128 x = 0;
int sign = 0;
/* read sign */
@@ -158,7 +158,7 @@ string_to_Decimal128 (char *s) /* portable version */
exp -= 6176;
for (n = 0; n < 34; n++)
- x = (_Decimal128) 10.0 * x + (_Decimal128) (m[n] - '0');
+ x = (_Decimal128) 10 * x + (_Decimal128) (m[n] - '0');
/* multiply by 10^exp */
if (exp > 0)
@@ -301,27 +301,27 @@ string_to_Decimal128 (char *s) /* portable version */
}
if (exp <= -16)
{
- x /= (_Decimal128) 10000000000000000.0;
+ x /= ten16;
exp += 16;
}
if (exp <= -8)
{
- x /= (_Decimal128) 100000000.0;
+ x /= ten8;
exp += 8;
}
if (exp <= -4)
{
- x /= (_Decimal128) 10000.0;
+ x /= ten4;
exp += 4;
}
if (exp <= -2)
{
- x /= (_Decimal128) 100.0;
+ x /= ten2;
exp += 2;
}
if (exp <= -1)
{
- x /= (_Decimal128) 10.0;
+ x /= ten;
exp += 1;
}
}