tajo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DaeMyung Kang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAJO-391) Change setting default type in query from FLOAT4 to FLOAT8
Date Fri, 06 Dec 2013 15:59:35 GMT

    [ https://issues.apache.org/jira/browse/TAJO-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13841370#comment-13841370
] 

DaeMyung Kang commented on TAJO-391:
------------------------------------

[~jihoonson] Thank you for your advice. Yes. you are right. bug in Floating point., even though
we use type casting, it can cause precision problem
when casting small size to large size.

so next code doesn't work with our expect.

public static void main(String[] args) {
		float f = 0.4f;
		double d = 0.4;
		System.out.println((f));
		System.out.println(((double)f));
		System.out.println((d));
		System.out.println(((float)d));
		System.out.println(Math.sin(f));
		System.out.println(Math.sin((double)f));
		System.out.println(Math.sin(d));
		System.out.println(Math.sin((float)d));
}

0.4
0.4000000059604645(only case when casting small size to large size)
0.4
0.4
0.3894183477986018
0.3894183477986018
0.3894183423086505
0.3894183477986018

and currently tajo just parse FLOAT4 only in shell.
Thank you. 



> Change setting default type in query from FLOAT4 to FLOAT8
> ----------------------------------------------------------
>
>                 Key: TAJO-391
>                 URL: https://issues.apache.org/jira/browse/TAJO-391
>             Project: Tajo
>          Issue Type: Improvement
>            Reporter: DaeMyung Kang
>            Assignee: DaeMyung Kang
>            Priority: Minor
>         Attachments: TAJO-391.patch
>
>
> FLOAT4 is default parsed float type in tajo.
> but it can cause some trobles when we use it as FLOAT8.
> for examples.
> 0.4(f) will changed to 0.40000000000005(d)
> so it cause different result from java.Math functions.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message