Add Decimal64.scaleTo() 79/101279/6
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 May 2022 08:27:47 +0000 (10:27 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 25 May 2022 11:19:32 +0000 (13:19 +0200)
commitc6624c7716ea59e4df3cb7bf90d172e81a544be5
treedf53f256790db30e5f39e19d31b055ede039ad2c
parent2933aef94f3b2f142c55652b398cafd0ff6a6536
Add Decimal64.scaleTo()

Decimal64.valueOf(String) results in variable-scale results, based on
the input string. This is sub-optimal when we want to compare values
of particular type -- those should be governed by fraction-digits and
hence, for example "2.00" and "2.0" should be normalized to the same
scale.

Introduce Decimal64.scaleTo(), which can be used to adjust the scale
of an existing Decimal64.

JIRA: YANGTOOLS-1440
Change-Id: Icbc215dff6d8146996c5be1040751fd1e14b6cfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Decimal64.java
common/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/YT1440Test.java [new file with mode: 0644]