Systemicbeta

Floor Division

systemic:core-fdivMath

Inputs

NameTypeDescription
First ValueNumber seriesThe value to be divided (the dividend).
Second ValueNumber seriesThe value to divide by (the divisor).

Outputs

NameTypeDescription
QuotientNumber seriesThe whole-number result of the floor division for each bar.

Cost

7
credits per run
1,000
bars

0.199 + 0.00608·n credits for n bars, rounded up. The marks are each plan's limit of bars.

Floor Division divides two values and rounds the result down to a whole number, always toward negative infinity.


The Formula

Qi=⌊AiBi⌋Q_i = \left\lfloor \frac{A_i}{B_i} \right\rfloor

Where:

  • AA = First Value (numerator)
  • BB = Second Value (denominator)
  • ⌊⋅⌋\lfloor \cdot \rfloor = Floor function (round down toward −∞)

Floor vs. Regular Division

ExpressionRegular DivisionFloor Division
7 ÷ 32.333...2
10 ÷ 42.52
−7 ÷ 3−2.333...−3
−10 ÷ −42.52

Key insight: Floor division rounds toward negative infinity, not toward zero. So −7 ÷ 3 = −3 (not −2).


Worked Example

Calculating how many complete lots fit into the available capital:

Available CapitalLot SizeFloor DivisionInterpretation
10,0003,00033 complete lots
10,0004,00022 complete lots
10,0007,00011 complete lot
5,5002,00022 complete lots (remainder 1,500)

Practical Applications

1. Lot Sizing and Position Calculation

To calculate how many whole shares or contracts a given capital covers:

Position Size = Floor(Capital Available ÷ Price per Unit)

The result is a whole number of units, with no fractions.

2. Time Bucketing

Grouping data into time buckets:

Hourly Bucket = Floor(Minutes Since Start ÷ 60)
Weekly Bucket = Floor(Days Since Start ÷ 7)

3. Price Level Discretization

Rounding prices to tick sizes or round numbers:

Tick Level = Floor(Price ÷ Tick Size)

4. Ratio Thresholds

Counting how many times one value "fits into" another:

Multiplier = Floor(Target ÷ Baseline)

Edge Cases

SituationResultNotes
Division by zeroemptyThe result is undefined, so no value is invented
Both values zeroemptySame rule
Negative numeratorRounds down (toward −∞)−7 ÷ 3 = −3
Negative denominatorStandard floor behavior7 ÷ −3 = −3
Very large valuesValid whole numberMay lose precision for extremely large numbers
Decimal inputsTreated as real numbersDecimals are not stored exactly, so a result can be one lower than expected (1 ÷ 0.1 gives 9)

Missing Data

  • If either input is empty (null) on a bar, for example a data gap or a closed-market day, the quotient is empty on that bar. No substitute value is used.
  • Division by zero is different from missing data: both inputs exist, but the result is undefined. The output is also empty on that bar.

Key Takeaways

PropertyValue
Output TypeWhole number, or empty when it cannot be calculated
Rounding DirectionAlways toward −∞
Zero DivisionReturns empty (undefined result)
Missing InputsReturn empty on the same bar
Best forLot sizing, bucketing, discretization

Further Reading

© 2026 WanoLabs. All rights reservedBeta v0.1.5