Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
hive
hive
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 51
    • Issues 51
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 17
    • Merge Requests 17
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • hive
  • hivehive
  • Issues
  • #120

Closed
Open
Opened Feb 21, 2021 by Howo@howoDeveloper

Proposals payment floating point truncation error

proposals are all getting slightly underpaid:

example with a proposal with 2400 a day:

uint32_t passed_time_seconds = ( head_time - db.get_dynamic_global_properties().last_budget_time ).to_seconds();

passed_time_seconds = 3600 (always is one hour)

uint128_t ratio = ( passed_time_seconds * HIVE_100_PERCENT ) / daily_seconds;

ratio= 3600 * 10000 / 86400 = 416.666666667
ratio gets truncated to 416

asset period_pay = asset( ( ratio * _item.daily_pay.amount.value ).to_uint64() / HIVE_100_PERCENT, _item.daily_pay.symbol );

period_pay = 416 * 2400 / 10000 = 99.84 when it should be 416.666666667 * 2400 / 10000 = 100

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: hive/hive#120