fix(javascript): avoid positive-zero evidence for signed zero

This commit is contained in:
Rudy Celekli authored and morluto committed 2026-10-10 01:45:00 +08:00
1 parent 2bd7de6f8c
commit 9055bd695b
4 files changed
+70 -1

No files matched your search

@@ -21,6 +21,11 @@ export const semanticPrimitiveSet = (
status: "unknown",
reason: "Nonfinite numbers are outside the JSON primitive lattice.",
};
if (typeof value === "number" && Object.is(value, -0))
return {
status: "unknown",
reason: "Negative zero cannot be preserved by JSON primitive evidence.",
};
uniqueValues.add(value);
if (uniqueValues.size > SEMANTIC_PRIMITIVE_CANDIDATE_LIMIT)
return semanticResourceLimitUnknown("primitive-candidates");