carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sujith71955 <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...
Date Thu, 01 Dec 2016 18:21:41 GMT
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r90505720
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -411,4 +411,24 @@ private static String parseStringToBigDecimal(String value, CarbonDimension
dime
         }
         return null;
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compareDoubleWithNan(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2)))
{
    +      return 0;
    +    }
    +    else if (d1 < d2) {
    +      return -1;
    +    }
    +    else  {
    --- End diff --
    
    yes, i think we can remove the  unnecessary else  statement itself.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message