Skip to content

Main content

Integer Multiple Nearest Lower Upper Tool

Compute integer multiple nearest lower upper from explicit bounded inputs.

Loading tool…

Description

Compute its nonnegative Euclidean remainder and return lower=value-remainder and upper=lower when divisible or lower+multiple otherwise, as exact decimal strings.

Exact integer arithmetic and finite numeric arithmetic have different range limits. A safe integer number is bounded by +/-9007199254740991, while supported decimal-integer text can represent larger values. Division and remainder also need a signed convention: truncating quotients and Euclidean nonnegative remainders can give different results.

Compute its nonnegative Euclidean remainder and return lower=value-remainder and upper=lower when divisible or lower+multiple otherwise, as exact decimal strings.

When to use this tool

Use Integer Multiple Nearest Lower Upper when you need this exact stated integer sign, bound, division, comparison, or factor component.

How to use the tool and how it works

  1. Enter value, multiple. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read lower, upper. Use the output convention below.

Parse a signed decimal value and positive decimal multiple. Compute its nonnegative Euclidean remainder and return lower=value-remainder and upper=lower when divisible or lower+multiple otherwise, as exact decimal strings.1

Input fieldMeaning and unitsAccepted input
valueSupplied scalar or returned value under the stated operation.Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
multipleMultipleRequired. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
Output fieldInterpretationReturned shape
lowerLowerRequired. Text; maximum UTF-16 length 8192.
upperUpperRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "value": "-7",
    "multiple": "3"
  },
  "output": {
    "lower": "-9",
    "upper": "-6"
  }
}

Limitations and assumptions

  • Negative values use mathematical lower and upper bounds, not truncation toward zero. This brackets multiples without choosing the nearer one or a midpoint rounding policy.
  • 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.

Alternative or Complementary methods

Use exact decimal-integer tools when the range exceeds safe numeric integers. State the division, remainder, midpoint, and zero convention before combining results from different operations.

References

  1. Calculation and input contract: number/integer-multiple-nearest-lower-upper — tool.io

Similar or alternative tools