diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-01-04 21:57:08 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-01-04 21:57:08 +0000 |
commit | 94c07fa326286d7007f85f665315269e494a89ee (patch) | |
tree | 6ad7977f9588cf996f9f234d5a4dd7963df5a051 /strtofr.c | |
parent | c9da5c3da9faa7fd86e4ce1185962b323959b2b7 (diff) | |
download | mpfr-94c07fa326286d7007f85f665315269e494a89ee.tar.gz |
Fixed return value of mpfr_strtofr in case of invalid data (it was -1,
but it should be 0 since it is a ternary value and the result is 0,
which is exact). Added test of the ternary value in this case.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5173 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'strtofr.c')
-rw-r--r-- | strtofr.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -731,7 +731,9 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, int base, res = parse_string (x, &pstr, &string, base); /* If res == 0, then it was exact (NAN or INF), so it is also the ternary value */ - if (res == 1) + if (MPFR_UNLIKELY (res == -1)) /* invalid data */ + res = 0; /* x is set to 0, which is exact, thus ternary value is 0 */ + else if (res == 1) { res = parsed_string_to_mpfr (x, &pstr, rnd); free_parsed_string (&pstr); |