You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Alan Gates (JIRA)" <ji...@apache.org> on 2010/01/15 06:42:54 UTC
[jira] Resolved: (PIG-82) Loose floating point precision
[ https://issues.apache.org/jira/browse/PIG-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alan Gates resolved PIG-82.
---------------------------
Resolution: Won't Fix
Loss of precision is a known issue with floating point numbers. The correct solution here is to introduce a fixed point type, similar to SQL's decimal.
> Loose floating point precision
> ------------------------------
>
> Key: PIG-82
> URL: https://issues.apache.org/jira/browse/PIG-82
> Project: Pig
> Issue Type: Improvement
> Components: data
> Affects Versions: 0.1.0
> Reporter: Daeho Baek
>
> Pig looses floating point precision during conversion between binary and string conversion.
> Here is an example code.
> words = LOAD '/user/daeho/words.txt' as (word);
> numWords = FOREACH (GROUP words ALL) GENERATE COUNT($1);
> weight = FOREACH numWords GENERATE 1.0 / $0;
> wordsWithWeight = CROSS words, weight;
> sumWeight = FOREACH (GROUP wordsWithWeight ALL) GENERATE SUM($1.$1);
> dump sumWeight;
> sumWeight is not 1 even though words.txt has 118 lines.
> Can we store floating point as binary format?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.