UNPKG

solid-credit

Version:

Solid Credit is an advanced tool designed for the precise generation of loan amortization tables. This library encompasses a variety of loan structures, including the French, German, and American systems, in addition to offering options for grace periods.

19 lines (18 loc) 552 B
import {IcustomRounding} from "./interface/IcustomRound.interface"; export class CustomRounding implements IcustomRounding { // method public public GetroundUp(num: number): number { return this.calculateRoundUp(num); } // method protected private calculateRoundUp(num: number): number { let decimalPart = num - Math.floor(num); if (decimalPart < 0.25) { return Math.floor(num); } else if (decimalPart < 0.75) { return Math.floor(num) + 0.5; } else { return Math.ceil(num); } } }