commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Premysl Maly (JIRA)" <>
Subject [jira] [Updated] (LANG-843) Providing new class BigDecimalUtils
Date Mon, 08 Oct 2012 08:34:02 GMT


Premysl Maly updated LANG-843:

    Attachment: equalsUtils.patch

The patch itself. Contains the improvements offered to Commons lang 3.1 version
> Providing new class BigDecimalUtils
> -----------------------------------
>                 Key: LANG-843
>                 URL:
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Premysl Maly
>            Priority: Minor
>              Labels: patch
>             Fix For: 3.1
>         Attachments: equalsUtils.patch
>   Original Estimate: 0h
>  Remaining Estimate: 0h
> Creating Utils class BigDecimalUtils and offering a new implementation of method equals()
in ObjectUtils.
> Quoting the javaDoc from BigDecimalUtils:
> Provides some extra functionality over the BigDecimal class type Comparing two different
BigDecimals may be tricky, because yet the value is same, the format may differ and then the
equals method implemented on BigDecimal does not return expected results.
>    BigDecimal first = new BigDecimal("0.10");
>    BigDecimal second = new BigDecimal("0.100");
> first.equals(second); will return false, because those two numbers are not using the
same format, even though the values are both "0.1".
>   Usage examples:
>   Compare a number to 1: if(BigDecimalUtils.equals(someNumber, BigDecimal.ONE))
>   compare two numbers whether they are the same value or both null: if(BigDecimalUtils.equals(someNumber,
anotherNumber, NullsEquality.EQUALS))

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message