cockroachdb / cockroachdb/apd

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

Aperta
#134 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
805
Fork
48
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I attempted to run the following test:

```golang
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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.