You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Duncan Jones (JIRA)" <ji...@apache.org> on 2014/10/15 20:52:34 UTC

[jira] [Updated] (LANG-843) Providing new class BigDecimalUtils

     [ https://issues.apache.org/jira/browse/LANG-843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Jones updated LANG-843:
------------------------------
    Fix Version/s: Discussion

> Providing new class BigDecimalUtils
> -----------------------------------
>
>                 Key: LANG-843
>                 URL: https://issues.apache.org/jira/browse/LANG-843
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Premysl Maly
>            Priority: Minor
>              Labels: patch
>             Fix For: Review Patch, Discussion
>
>         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 was sent by Atlassian JIRA
(v6.3.4#6332)