Module fraction::division

source ·
Expand description

Lossless integer division

  • The algorithm uses stack only, no introduced heap allocations for calculation (although underlying integer type implementation may perform those)
  • Linear complexity, O(n)
  • Abstract from a particular integer implementation, may be used on primitive types (as i32 or u32) as well as complex ones (num::BigInt, num::BigUint) Thus can be efficiently used on any integer type implementing a bunch of required traits (which all primitive ints and num::bigint implement out of the box). Although in that case the underlying math will be using heap.

Structs§

Functions§