Skip to content

Scale can cause unitiuitve negative decimal precision error #322

Open
@Snipesy

Description

@Snipesy

Using the scale method on a BigDecimal can throw the "Negative decimal precision is not allowed." exception even if the new scale satisfies that condition.

 val b = BigDecimal.fromDouble(
    0.05,
    decimalMode = DecimalMode(
        decimalPrecision = 5,
        roundingMode = RoundingMode.ROUND_HALF_FLOOR,
        scale = 6
    )
)
val c = b.scale(2) // <- Throws here?

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