summaryrefslogtreecommitdiff
path: root/strtofr.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-30 17:17:36 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-30 17:17:36 +0000
commit071e51aa76bcb58b832e48bfd4d6b1c9e9fff833 (patch)
treef28362a4efce761f5a2a934b4942f9376d2bcefb /strtofr.c
parentef49e886933b3a88f5c8a7e1d22811df1afd77d6 (diff)
downloadmpfr-071e51aa76bcb58b832e48bfd4d6b1c9e9fff833.tar.gz
strtofr.c: minor change (in the style); a comment was ambiguous.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5146 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'strtofr.c')
-rw-r--r--strtofr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/strtofr.c b/strtofr.c
index ade78a906..6713195be 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -716,14 +716,17 @@ int
mpfr_strtofr (mpfr_t x, const char *string, char **end, int base,
mp_rnd_t rnd)
{
- int res = -1;
+ int res;
struct parsed_string pstr;
/* If an error occured, it must return 0 */
MPFR_SET_ZERO (x);
MPFR_SET_POS (x);
- if (base == 0 || (base >= 2 && base <= /*MPFR_MAX_BASE*/36))
+ /* Though bases up to MPFR_MAX_BASE are supported, we require a lower
+ limit: 36. For such values <= 36, parsing is case-insensitive. */
+ MPFR_ASSERTN (MPFR_MAX_BASE >= 36);
+ if (base == 0 || (base >= 2 && base <= 36))
{
res = parse_string (x, &pstr, &string, base);
/* If res == 0, then it was exact (NAN or INF),
@@ -747,6 +750,9 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, int base,
}
#endif
}
+ else
+ res = -1;
+
if (end != NULL)
*end = (char *) string;
return res;