Description
Label whether a supplied number retains the negative-zero sign.
Number representation separates exact integer text, finite floating-point values and display spelling. Rational comparison can use exact cross products without decimal conversion, while floor/ceiling outputs still have a finite safe-integer range. Leading zeros and negative zero carry representational information that a numeric conversion or serializer can discard.
Label whether a supplied number retains the negative-zero sign.
When to use this tool
Use Negative Zero Signbit Preservation Label when you already have value and need to label whether a supplied number retains the negative-zero sign.
How to use the tool and how it works
- Enter value. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read label, negativeZero. Inspect negativeZero before interpreting the associated values.
Use Object.is(value,-0); return label -0 and negativeZero=true only for negative zero, otherwise String(value) and false.1
Ordinary JavaScript JSON serialization writes numeric negative zero as 0. Preserve the incoming -0 until execution if the sign distinction matters; the returned text and flag retain it.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| value | Finite numeric value. To detect negative zero, -0 must reach the tool without prior conversion to +0. | Required. Finite number. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| label | -0 only for an incoming negative zero; otherwise the normal JavaScript number spelling. | Required. Text; maximum UTF-16 length 8192. |
| negativeZero | Object.is(value,-0); string and boolean outputs preserve this distinction. | Required. Boolean. |
{
"input": {
"value": -2
},
"output": {
"label": "-2",
"negativeZero": false
}
} Limitations and assumptions
- The input path must preserve negative zero. JSON.stringify converts numeric -0 to 0; the label and Boolean cannot recover a sign already lost before execution.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use exact integer or rational arithmetic when exact large-number comparison is needed. Keep original token spelling for formatting questions, and verify that any transport or serialization step preserves distinctions such as leading zeros and negative zero.
References
-
Calculation and input contract: number/negative-zero-signbit-preservation-label — tool.io
-
ECMAScript: JSON serialization of numbers — Ecma International
Similar or alternative tools
- Integer Floor Ceiling Bracket Pair
Calculate floor and ceiling integers for a supplied finite number.
- Positional Digit Leading Zero Count
Count leading zeros in a positional decimal-digit transcription.