You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Sergio Peña (JIRA)" <ji...@apache.org> on 2015/07/14 18:44:05 UTC

[jira] [Assigned] (HIVE-11174) Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0 according to IEEE floating point spec)

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

Sergio Peña reassigned HIVE-11174:
----------------------------------

    Assignee: Sergio Peña

> Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0 according to IEEE floating point spec) 
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-11174
>                 URL: https://issues.apache.org/jira/browse/HIVE-11174
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 1.2.0
>            Reporter: Lenni Kuff
>            Assignee: Sergio Peña
>            Priority: Critical
>
> Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0).  This is because Hive uses Double.compareTo(), which states (http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#compareTo(java.lang.Double):
> bq. 0.0d is considered by this method to be greater than -0.0d
> The IEEE 754 floating point spec specifies that signed -0.0 and 0.0 should be treated as equal. From the Wikipedia article (https://en.wikipedia.org/wiki/Signed_zero#Comparisons):
> bq. negative zero and positive zero should compare as equal with the usual (numerical) comparison operators
> Java's compareTo method is implemented to allow for ordering of object instances (in a hash table or similar), but Hive should abide by the IEEE spec.
> How to reproduce:
> {code}
> select 1 where 0.0=-0.0;
> Returns no results.
> select 1 where -0.0<0.0;
> Returns 1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)