Skip to content

Main content

Fractional Share Integer Quantum Error

Quantize an explicit fractional allocation to the nearest integer quantum with half ties upward and retain the signed rounding error.

Loading tool…

Description

Round a fractional allocation to a supplied integer quantum.

Proportions depend on the order of a ratio, its denominator and whether an input is a decimal fraction or a percentage number. Inverting a zero-crossing interval is undefined, and rounding an ideal share to a quantum can exceed a total. Supplied conservation, tax or mixing assumptions need explicit units and boundaries before interpretation.

Round a fractional allocation to a supplied integer quantum.

When to use this tool

Use Fractional Share Integer Quantum Error when you already have totalUnits, shareFraction, quantumUnits and need to round a fractional allocation to a supplied integer quantum.

How to use the tool and how it works

  1. Enter totalUnits, shareFraction, quantumUnits. 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 idealUnits, nearestQuantumUnits, signedRoundingError. Use the output convention below.

Require safe whole total>=0/quantum>=1 and shareFraction in [0,1]. ideal=total*share; nearest=Math.round(ideal/quantum)*quantum; error=nearest-ideal.1

Input fieldMeaning and unitsAccepted input
totalUnitsTotal UnitsRequired. Safe integer; minimum 0.
shareFractionShare FractionRequired. Finite number; minimum 0; maximum 1.
quantumUnitsPositive safe whole rounding increment; the rounded allocation can exceed totalUnits.Required. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
idealUnitsIdeal UnitsRequired. Finite number.
nearestQuantumUnitsNearest Quantum UnitsRequired. Safe integer.
signedRoundingErrorSigned Rounding ErrorRequired. Finite number.
json
{
  "input": {
    "totalUnits": 101,
    "shareFraction": 0.25,
    "quantumUnits": 5
  },
  "output": {
    "idealUnits": 25.25,
    "nearestQuantumUnits": 25,
    "signedRoundingError": -0.25
  }
}

Limitations and assumptions

  • Nonnegative midpoint ties round upward. The rounded allocation may exceed total and is not a multi-party allocation or arbitrary-precision integer result.
  • 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

Write the numerator, denominator and ratio direction explicitly before rebasing or inverting a quantity. Use a full allocation or mass balance for multiple components, and account for quantum remainders jointly when rounded shares must add to a fixed total.

References

  1. Calculation and input contract: proportions/fractional-share-integer-quantum-error — tool.io

Similar or alternative tools