Skip to content

Context.Rem fails for Rem(100E100, 10) #134

Description

@NoamTD

I attempted to run the following test:

func TestRem(t *testing.T) {
	a := apd.New(100, 100)
	b := apd.New(10, 1)
	var rem apd.Decimal
	_, err := apd.BaseContext.Rem(&rem, a, b)
	if err != nil {
		t.Fatal(err)
	}

	if !rem.IsZero() {
		t.Fatal("expected zero")
	}
}

I would expect this test to pass, but it fails:

=== RUN   TestRem
    rem_test.go:72: division impossible
--- FAIL: TestRem (0.00s)

FAIL

apd.BaseContext.Rem returns division impossible, which (I believe) is an incorrect result in this case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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