Skip to main content
edited title
Link
Ed Ilyin
  • 317
  • 2
  • 11

What is the cheapest way to roundup() or ceil() to multiple of 100001000?

Source Link
Ed Ilyin
  • 317
  • 2
  • 11

What is the cheapest way to roundup() or ceil() to multiple of 10000?

What is the cheapest way to roundup() or ceil() to multiple of 1000?

For example if cheapest way to roundup is implemented in the ceil function:

function ceil(uint a, uint m) returns (uint) {
    //some cheap roundup to muliple function
}

then it is expected that:

  • ceil(123456,1000) == 124000
  • ceil(1,1000) == 1000
  • ceil(0,1000) == 0
  • ceil(123000,1000) == 123000