Skip to content

[Enhancement] accrue action will cause precision loss #308

@yellowbean

Description

@yellowbean

Issue

The accrue action will cause precision loss

 ,testCase "multiple times on diff dates"  $
   assertEqual "accrue int on bond multiple times on diff dates"
   (B.bndDueInt (B.accrueInt (L.toDate "20210103") b1))
   (B.bndDueInt (B.accrueInt (L.toDate "20210103") (B.accrueInt (L.toDate "20210102") b1)))

A bond accrue from Sep 1 -> Sep 4 is different with accrue from Sep 1 -> Sep 2 , Sep 2 -> Sep 4 .
Because in each rounding , it will do rounding to make it like "balance with 2 decimal "

Goal

The goal is use Rational to represent accrued balance
And the the representation of Rational with 6 digits instead of form of ( x % y )

Scope

All type under Accrual class will be affected

  • Bond
  • Fee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions