Use ceil for round calculations #427

Closed
4miners opened this Issue Feb 8, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@4miners
Member

4miners commented Feb 8, 2017

Currently we use that formula for calculating round:
Math.floor(height / 101) + (height % 101 > 0 ? 1 : 0);
We can replace it with:
Math.ceil(height / 101);
That will give us exact same results when height>=0 (always is).
Should be replaced in entire system, including SQL queries.

Issue pointed by @simonmorgenthaler

Edit:
For SQL queries: CEIL(height / 101::float)

@4miners 4miners added the enhancement label Feb 8, 2017

@karmacoma karmacoma added this to Backlog in Version 0.7.0 Feb 8, 2017

@4miners 4miners self-assigned this Feb 14, 2017

@karmacoma karmacoma moved this from Backlog to In Progress in Version 0.7.0 Feb 16, 2017

@4miners 4miners added the ready label Feb 21, 2017

@karmacoma karmacoma added this to the Version 0.7.0 milestone Feb 22, 2017

@karmacoma karmacoma added *easy and removed ready labels Feb 22, 2017

@karmacoma karmacoma closed this in #439 Feb 23, 2017

karmacoma added a commit that referenced this issue Feb 23, 2017

Merge pull request #439 from 4miners/427_ceil-for-rounds
Use ceil for round calculations - Closes #427

@karmacoma karmacoma removed this from In Progress in Version 0.7.0 Feb 23, 2017

@4miners

This comment has been minimized.

Show comment
Hide comment
@4miners

4miners Mar 7, 2017

Member

Performance of aggregateBlocksReward SQL query is bad after changes, need to be fixed.

Member

4miners commented Mar 7, 2017

Performance of aggregateBlocksReward SQL query is bad after changes, need to be fixed.

@4miners 4miners reopened this Mar 7, 2017

@karmacoma karmacoma added this to In Progress in Version 0.7.0 Mar 7, 2017

@karmacoma karmacoma closed this in #464 Mar 7, 2017

karmacoma added a commit that referenced this issue Mar 7, 2017

Merge pull request #464 from 4miners/427_quickfix
Fix performance of aggregateBlocksReward SQL query - Closes #427

@karmacoma karmacoma removed this from In Progress in Version 0.7.0 Mar 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment