-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
When doing RoundCeiling operation to 0.002 with precision set to -1, we get 0 instead of 0.1.
However for RoundCeiling(1.002, -1) we get 1.1.
func TestDecimal_RoundCeil_Bug(t *testing.T) {
var num apd.Decimal
_, _, err := num.SetString("0.002")
if err != nil {
t.Fatal(err)
}
ctx := apd.Context{
Precision: 100,
Rounding: apd.RoundCeiling,
MaxExponent: 1000,
MinExponent: -1000,
Traps: apd.DefaultTraps,
}
_, err = ctx.Quantize(&num, &num, -1)
if err != nil {
t.Fatal(err)
}
if num.String() != "0.1" {
t.Errorf("Expected 0.1, got %s", num.String())
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels