diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-10-18 13:28:28 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-10-18 13:28:28 +0000 |
commit | 3639a4eda0ba0dcbe2a1da2d5ae6238bccdb602b (patch) | |
tree | 7cb8128507be5b92ff54303586d90c1d097db854 /strtofr.c | |
parent | fc7687382ba8c535246bc8a848321d06da2d934d (diff) | |
download | mpfr-3639a4eda0ba0dcbe2a1da2d5ae6238bccdb602b.tar.gz |
Change "unsigned int" to "int" for base in proto of strtofr.
Change set_str to use strtofr (Fix a bug too).
Limit base to 36 in strtofr (since get_str is limited to 36).
Update documentation to reflect the changes.
mpfr_get_d1 is moved to section internal in the documentation.
Update the tests.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3036 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'strtofr.c')
-rw-r--r-- | strtofr.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -271,14 +271,16 @@ parse_string (mpfr_t x, struct parsed_string *pstr, /* If base=0 or 16, it may include '0x' prefix */ prefix_str = NULL; - if ((base == 0 || base == 16) && str[0]=='0' && str[1]=='x') + if ((base == 0 || base == 16) && str[0]=='0' + && (str[1]=='x' || str[1] == 'X')) { prefix_str = str; base = 16; str += 2; } /* If base=0 or 2, it may include '0b' prefix */ - if ((base == 0 || base == 2) && str[0]=='0' && str[1]=='b') + if ((base == 0 || base == 2) && str[0]=='0' + && (str[1]=='b' || str[1] == 'B')) { prefix_str = str; base = 2; @@ -679,7 +681,7 @@ free_parsed_string (struct parsed_string *pstr) } int -mpfr_strtofr (mpfr_t x, const char *string, char **end, unsigned int base, +mpfr_strtofr (mpfr_t x, const char *string, char **end, int base, mp_rnd_t rnd) { int res = -1; @@ -689,7 +691,7 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, unsigned int base, MPFR_SET_ZERO (x); MPFR_SET_POS (x); - if (base == 0 || (base >= 2 && base <= MPFR_MAX_BASE)) + if (base == 0 || (base >= 2 && base <= /*MPFR_MAX_BASE*/36)) { res = parse_string (x, &pstr, &string, base); /* If res == 0, then it was exact (NAN or INF), |