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 [email protected]
This commit is contained in:
1 parent
378d7f78ca
commit
7a3ed2650d
2 files changed
+27
-1
No files matched your search
@@ -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