---
# System prepended metadata

title: Untitled

---

```
floor(ceil(2^k / d) * n / 2^k) = floor((2^k + r) / d * n / 2^k)
```
RHS = `floor(ceil(2^k / d) * n / 2^k)` 
RHS = `floor((floor(2^k / d)+1) * n / 2^k)`
* While `2^k` can be divided by d with no remender it is equal to LHS

RHS = `floor((floor(2^k / d)) * n / 2^k + n/2^k)`
* `RHS=floor((2^k + r) / d * n / 2^k + n/2^k)`
* `RHS=floor((2^k) / d * n / 2^k+ r / d * n / 2^k + n/2^k)`
* `RHS=n/d+floor(((r / d) +1) * n / 2^k)`

RHS = `n/d+floor(n/2^k)`

refer to [jemalloc/internal/div.h](https://github.com/jemalloc/jemalloc/blob/dev/include/jemalloc/internal/div.h)
* We bound n < 2^32, and don't support dividing by one.

RHS = `n/d`

LHS = `floor((2^k + r) / d * n / 2^k)`
LHS = `floor(floor((2^k) / d) * n / 2^k)`
LHS = `n/d`