Open gibson042 opened 2 years ago
There should also be coverage for edge cases like "1.2000000000000001" vs. "1.2000000000000002", which are numerically equal but only one of which is a canonical numeric string in any given implementation (although which has canonical status is implementation-defined because Number::toString step 5 does not uniquely define the least significant digit of s) and therefore the other can be used as the name of properties not subject to special treatment. For example, the following expression is required to be true
:
Object.keys(
Object.assign(new Int8Array(), {"1.2000000000000001": 1, "1.2000000000000002": 2})
).length === 1
Discovered by an XS bug: https://github.com/Moddable-OpenSource/moddable/issues/886
Integer-Indexed Exotic Objects internal methods) ([[Get]], [[Set]], [[Delete]], [[Has]], etc.) require special treatment for any string-valued property recognized as a canonical numeric string by CanonicalNumericIndexString that includes silent failure when the property name is out of bounds or non-integer. Non-integer canonical numeric strings include "Infinity", "-Infinity", "NaN", "0.5", "1.2000000000000001", etc.