Commit a2fb8de6 authored by Michael Beck's avatar Michael Beck
Browse files

fixed fc_val_from_str() do NOT produce values with more significant bits than requested in the mode

[r15236]
parent bd8f05b0
...@@ -1077,19 +1077,21 @@ done: ...@@ -1077,19 +1077,21 @@ done:
return result; return result;
#else #else
/* XXX excuse of an implementation to make things work */ /* XXX excuse of an implementation to make things work */
LLDBL val; LLDBL val;
char *tmp = alloca(calc_buffer_size);
(void) len; (void) len;
#ifdef HAVE_LONG_DOUBLE #ifdef HAVE_LONG_DOUBLE
val = strtold(str, NULL); val = strtold(str, NULL);
DEBUGPRINTF(("val_from_str(%s)\n", str));
fc_val_from_float(val, 15, 64, tmp);
#else #else
val = strtod(str, NULL); val = strtod(str, NULL);
#endif
DEBUGPRINTF(("val_from_str(%s)\n", str)); DEBUGPRINTF(("val_from_str(%s)\n", str));
return fc_val_from_float(val, exp_size, mant_size, result); fc_val_from_float(val, 11, 52, tmp);
#endif /* HAVE_LONG_DOUBLE */
return fc_cast(tmp, exp_size, mant_size, result);
#endif #endif
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment