Fix errol0_dtoa for DBL_MAX

When `val` is DBL_MAX, we get +inf from `ECMA_NEXT_FLOAT (val)`.
It is necessary to handle this case specially.

Related issue: #1054

JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
This commit is contained in:
Hanjoung Lee
2016-06-16 13:16:35 +09:00
parent 378d7f78ca
commit 7a3ed2650d
2 changed files with 27 additions and 1 deletions
+7 -1
View File
@@ -164,7 +164,13 @@ ecma_errol0_dtoa (ecma_number_t val, /**< ecma number */
ecma_high_prec_t high_bound, low_bound;
high_bound.value = mid.value;
high_bound.offset = mid.offset + (ECMA_NEXT_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);
high_bound.offset = mid.offset;
if (ECMA_NEXT_FLOAT (val) != INFINITY)
{
high_bound.offset += (ECMA_NEXT_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);
}
low_bound.value = mid.value;
low_bound.offset = mid.offset + (ECMA_PREV_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);