[
https://issues.apache.org/jira/browse/HIVE-17724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16194757#comment-16194757
]
Andrew Sherman commented on HIVE-17724:
---------------------------------------
I run Java code:
{quote}long l = 1507284611L;
float f = l;
System.out.println("f = " + f);
System.out.printf("%f\n", f);{quote}
and get
{quote}f = 1.50728461E9
1507284608.000000{quote}
Floats are precise only to about 7 digits. So probably this is just a
limitation of the type.
See
https://stackoverflow.com/questions/13542944/how-many-significant-digits-have-floats-and-doubles-in-java
> Cast from string to float gives strange result
> ----------------------------------------------
>
> Key: HIVE-17724
> URL: https://issues.apache.org/jira/browse/HIVE-17724
> Project: Hive
> Issue Type: Bug
> Affects Versions: 1.1.0
> Environment: Hive 1.1.0-cdh5.10.0
> Subversion
> file:///data0/jenkins/workspace/generic-package-ubuntu64-14-04/CDH5.10.0-Packaging-Hive-2017-01-20_11-52-43/hive-1.1.0+cdh5.10.0+859-1.cdh5.10.0.p0.71~trusty
> -r Unknown
> Reporter: David Scarlatti
>
> this query:"select CAST ('1507284611' as int), CAST ('1507284611' as bigint),
> CAST ('1507284611' as float), CAST ('1507284611' as double), CAST
> ('1507284611' as decimal)"
> returns
> 1507284611 1507284611 1507284608 1507284611 1507284611
> cast as float is the only one changing the numeric value.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)