Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Use ceil for round calculations #427

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

Use ceil for round calculations #427

4miners opened this issue Feb 8, 2017 · 1 comment
Assignees
Milestone

Comments

@4miners
Copy link
Contributor

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 self-assigned this Feb 14, 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 added a commit that referenced this issue Feb 23, 2017
Use ceil for round calculations - Closes #427
@4miners
Copy link
Contributor Author

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 added a commit that referenced this issue Mar 7, 2017
Fix performance of aggregateBlocksReward SQL query - Closes #427
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants