Skip to content

QuoRem returns remainder with incorrect scale #187

Open
@SoMuchForSubtlety

Description

@SoMuchForSubtlety

With the following code, I would expect a quotient of 1 and a remainder of 0.2. What I actually get is 1 and 2.

one := decimal.New(1, 0)
original := decimal.New(12, 1)
quo := &decimal.Big{}
rem := &decimal.Big{}
quo.QuoRem(original, one, rem)
fmt.Println("QuoRem:", quo, rem)

Calling QuoInt and Rem separately yields the expected result.

https://go.dev/play/p/7gQD6VoFgp6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions