Skip to content

default rounding mode for round callsΒ #60

@rbro

Description

@rbro

I understand the default rounding mode cannot be changed for internally reducing values to a precision, but would it be possible to set a default rounding mode for calls to ->round()? In my case, I'd like to always use a different rounding mode, but it requires me to set the rounding mode on every call to round().

I use bignumber.js which has something similar:

https://mikemcl.github.io/bignumber.js/#rounding-mode

Or is there another way this can be done without having to remember to pass the rounding mode on every call to round()? One way I thought of was if I could extend the Decimal class and override the round method, but I see the Decimal class is defined as final.

Thank you for your help.

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