mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix float point number comparsion (#3596)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
This commit is contained in:
parent
aa17a4fa5d
commit
19c61e14c0
@ -98,9 +98,12 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
|
||||
ecma_number_t x_num = ecma_get_number_from_value (x);
|
||||
ecma_number_t y_num = ecma_get_number_from_value (y);
|
||||
|
||||
if (ecma_number_is_nan (x_num) == ecma_number_is_nan (y_num))
|
||||
bool is_x_nan = ecma_number_is_nan (x_num);
|
||||
bool is_y_nan = ecma_number_is_nan (y_num);
|
||||
|
||||
if (is_x_nan || is_y_nan)
|
||||
{
|
||||
return true;
|
||||
return is_x_nan && is_y_nan;
|
||||
}
|
||||
|
||||
if (ecma_number_is_zero (x_num)
|
||||
|
||||
@ -23,6 +23,9 @@ assert(Object.is(null, null) === true);
|
||||
assert(Object.is(2, 8) === false);
|
||||
assert(Object.is(8, 8) === true);
|
||||
|
||||
assert(Object.is(3.14, 6.28) === false);
|
||||
assert(Object.is(3.14, 3.14) === true);
|
||||
|
||||
assert(Object.is('foo', 'foo') === true);
|
||||
assert(Object.is('foo', 'bar') === false);
|
||||
assert(Object.is(new String('foo'), 'foo') === false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user