You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by kumarvishal09 <gi...@git.apache.org> on 2016/10/16 06:33:50 UTC

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Github user kumarvishal09 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r83546183
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1426,4 +1423,25 @@ private static void getUnknownExpressionsList(Expression expression,
           getUnknownExpressionsList(child, lst);
         }
       }
    +  /**
    +   * 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 compare(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    if (d1 < d2) {
    --- End diff --
    
    can't we add else if and else why three if condition is required??


---
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.
---