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

This commit is contained in:
Rudy Celekli
2026-10-09 12:14:53 -04:00
committed by morluto
parent 2bd7de6f8c
commit 9055bd695b
4 changed files with 70 additions and 1 deletions
@@ -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");