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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user