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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r90466152
 
    --- 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) {
    --- End diff --
   
    move to previous line


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---