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
- Enter totalUnits, shareFraction, quantumUnits. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| totalUnits | Total Units | Required. Safe integer; minimum 0. |
| shareFraction | Share Fraction | Required. Finite number; minimum 0; maximum 1. |
| quantumUnits | Positive safe whole rounding increment; the rounded allocation can exceed totalUnits. | Required. Safe integer; minimum 1. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| idealUnits | Ideal Units | Required. Finite number. |
| nearestQuantumUnits | Nearest Quantum Units | Required. Safe integer. |
| signedRoundingError | Signed Rounding Error | Required. Finite number. |
{
"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
Similar or alternative tools
- SKU Case Each Quantity Remainder
Split available individual units into whole cases and a remainder.
- Percentage Reduction Remaining Base
Separate a percentage reduction from its remaining original base.