Skip to content

Main content

Signed Remainder Convention Residual Tool

Calculate signed remainder convention residual from explicit caller-supplied inputs.

Loading tool…

Description

Return truncatedRemainder=dividend%divisor using truncation toward zero, euclideanRemainder=(r+abs(divisor)) modulo abs(divisor), and residual=truncated-euclidean, all as decimal strings.

A rational number is represented by an integer numerator and a nonzero integer denominator. Sign placement, reduction by a greatest common divisor, and the chosen division or rounding convention affect intermediate representations. Exact integer text preserves arithmetic that could be lost in a floating-point conversion.

Return truncatedRemainder=dividend%divisor using truncation toward zero, euclideanRemainder=(r+abs(divisor)) modulo abs(divisor), and residual=truncated-euclidean, all as decimal strings.

When to use this tool

Use Signed Remainder Convention Residual when you need this particular exact fraction comparison, reduction, sign, denominator, or rounding component.

How to use the tool and how it works

  1. Enter dividend, divisor. 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 truncatedRemainder, euclideanRemainder, residual. Use the output convention below.

Parse signed decimal-integer dividend and divisor and reject divisor zero. Return truncatedRemainder=dividend%divisor using truncation toward zero, euclideanRemainder=(r+abs(divisor)) modulo abs(divisor), and residual=truncated-euclidean, all as decimal strings.1

Input fieldMeaning and unitsAccepted input
dividendSigned integer dividend in the representation declared below.Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
divisorNonzero integer divisor in the representation declared below.Required. 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
truncatedRemainderTruncated RemainderRequired. Text; maximum UTF-16 length 8192.
euclideanRemainderEuclidean RemainderRequired. Text; maximum UTF-16 length 8192.
residualTruncated remainder minus Euclidean remainder, as exact decimal text.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "dividend": "-8",
    "divisor": "3"
  },
  "output": {
    "truncatedRemainder": "-2",
    "euclideanRemainder": "1",
    "residual": "-3"
  }
}

Limitations and assumptions

  • The conventions differ for negative dividends with nonzero remainder. Outputs are exact integer text; this does not choose which remainder convention an external language or application requires.
  • 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

Reduce fractions where the interpretation requires it and choose a consistent denominator-sign and division convention. Use a complete rational operation when one denominator or determinant term is insufficient.

References

  1. Calculation and input contract: number/signed-remainder-convention-residual — tool.io

Similar or alternative tools