Wondering what’s next for npm?Check out our public roadmap! »

    @writetome51/get-rounded-up-down
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.1 • Public • Published

    getRounded(num): number

    Avoids cumulative rounding errors only by changing rounding rules when
    the fraction part of num is .5 :

    • If num's whole number is even, `num` is rounded toward zero.
    • If num's whole number is odd, `num` is rounded away from zero.

    getRoundedDown(num): number

    Behaves same as Math.floor() .

    getRoundedUp(num): number

    Behaves same as Math.ceil() .

    For all 3 functions, num must be a finite number of type 'number'.

    Installation

    npm i @writetome51/get-rounded-up-down

    Loading

    import { getRounded, getRoundedDown, getRoundedUp } 
        from '@writetome51/get-rounded-up-down';

    Install

    npm i @writetome51/get-rounded-up-down

    DownloadsWeekly Downloads

    3

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    4.57 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar