Skip to content

Main content

Random Decimal Rounding Boundary Corpus Generator

Generate finite neighborhoods of decimal ties and report three rounding cores' full-precision outcomes with explicit negative-zero evidence.

Loading tool…

Description

Generate finite neighborhoods of decimal ties and report three rounding cores' full-precision outcomes with explicit negative-zero evidence.

A parser corpus pairs literal input spellings or structured documents with observable parser results or explicitly constructed expectations. Successful parsing, semantic validity, and exact round-trip preservation are separate properties, so test records retain the relevant evidence.

Generate finite neighborhoods of decimal ties and report three rounding cores' full-precision outcomes with explicit negative-zero evidence.

When to use this tool

Use this generator to create reproducible decimal rounding boundary corpus cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply count, minimumAnchor, maximumAnchor, decimals, multiple, offsetFraction in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read cases. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Draw an integer rounding anchor and construct values just below, at, and above its decimal half-step. Delegate half-to-even, nearest-multiple, and floor-multiple operations and retain negativeZero flags separately from serialized numeric zero.1

Delegated operations used for this result: round half to even; round to multiple. Their calculation or parsing conventions apply to the corresponding result fields.2, 3

Input fieldMeaning and unitsAccepted input
countCountRequired. Safe integer; minimum 1; maximum 128.
minimumAnchorMinimum AnchorRequired. Safe integer.
maximumAnchorMaximum AnchorRequired. Safe integer.
decimalsDecimalsRequired. Safe integer; minimum 0; maximum 10.
multipleMultipleRequired. Finite number.
offsetFractionOffset FractionRequired. Finite number; strictly above 0; strictly below 0.5.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
casesCasesRequired. Array of Object; no unknown keys.; minimum items 3; maximum items 384.
cases[].anchorAnchorRequired. Safe integer.
cases[].relationRelationRequired. Text; one of "below", "tie", "above".
cases[].valueValueRequired. Object; no unknown keys.
cases[].value.valueValueRequired. Finite number.
cases[].value.negativeZeroNegative ZeroRequired. Boolean.
cases[].halfToEvenHalf To EvenRequired. Object; no unknown keys.
cases[].halfToEven.valueValueRequired. Finite number.
cases[].halfToEven.negativeZeroNegative ZeroRequired. Boolean.
cases[].nearestMultipleNearest MultipleRequired. Object; no unknown keys.
cases[].nearestMultiple.valueValueRequired. Finite number.
cases[].nearestMultiple.negativeZeroNegative ZeroRequired. Boolean.
cases[].floorMultipleFloor MultipleRequired. Object; no unknown keys.
cases[].floorMultiple.valueValueRequired. Finite number.
cases[].floorMultiple.negativeZeroNegative ZeroRequired. Boolean.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "count": 1,
    "minimumAnchor": -3,
    "maximumAnchor": 3,
    "decimals": 0,
    "multiple": 2,
    "offsetFraction": 0.25,
    "seed": 42
  },
  "output": {
    "cases": [
      {
        "anchor": 1,
        "relation": "below",
        "value": {
          "value": 1.25,
          "negativeZero": false
        },
        "halfToEven": {
          "value": 1,
          "negativeZero": false
        },
        "nearestMultiple": {
          "value": 2,
          "negativeZero": false
        },
        "floorMultiple": {
          "value": 0,
          "negativeZero": false
        }
      },
      {
        "anchor": 1,
        "relation": "tie",
        "value": {
          "value": 1.5,
          "negativeZero": false
        },
        "halfToEven": {
          "value": 2,
          "negativeZero": false
        },
        "nearestMultiple": {
          "value": 2,
          "negativeZero": false
        },
        "floorMultiple": {
          "value": 0,
          "negativeZero": false
        }
      },
      {
        "anchor": 1,
        "relation": "above",
        "value": {
          "value": 1.75,
          "negativeZero": false
        },
        "halfToEven": {
          "value": 2,
          "negativeZero": false
        },
        "nearestMultiple": {
          "value": 2,
          "negativeZero": false
        },
        "floorMultiple": {
          "value": 0,
          "negativeZero": false
        }
      }
    ],
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • count yields three cases. These are binary64 boundary observations rather than exact-decimal arithmetic. Offsets must remain distinguishable and multiple cannot be zero; different rounding tools intentionally use different tie conventions.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Decimal Rounding Boundary Corpus Generator — tool.io

  2. Calculation or validation: arithmetic/round-half-to-even — tool.io

  3. Calculation or validation: arithmetic/round-to-multiple — tool.io

Similar or alternative tools

  • Sequential Pattern Mining Tool

    Mine bounded frequent ordered subsequences of single-event string sequences using prefix projection, allowing arbitrary gaps and repeated events and counting each source sequence at most once per pattern.

  • Random Configuration Override Chain Fixture Generator

    Permute supplied flat configuration layers and retain first- or last-wins results, explicit null deletion and per-key winning-layer provenance.