We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point precision rears its ugly head:
Incompatible files Different values in column: Field{name=float64_nullable, type=FloatingPoint{2}, children=[], layout=TypeLayout{[{width=1,type=VALIDITY}, {width=64,type=DATA}]}} at index 1: 912.4140000000002 != 912.414 10:23:45.863 [main] ERROR org.apache.arrow.tools.Integration - Incompatible files java.lang.IllegalArgumentException: Different values in column: Field{name=float64_nullable, type=FloatingPoint{2}, children=[], layout=TypeLayout{[{width=1,type=VALIDITY}, {width=64,type=DATA}]}} at index 1: 912.4140000000002 != 912.414
Reporter: Wes McKinney / @wesm Assignee: Julien Le Dem / @julienledem
Note: This issue was originally created as ARROW-401. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered:
Julien Le Dem / @julienledem: PR: #223
Sorry, something went wrong.
Jacques Nadeau / @jacques-n: This is what I've used elsewhere before:
boolean evaluateEquality(Float f1, Float f2) { if(f1.isNaN()){ return f2.isNaN(); } if(f1.isInfinite()){ return f2.isInfinite(); } if ((f1 + f2) / 2 != 0) { return Math.abs(f1 - f2) / ((f1 + f2) / 2) < 1.0E-6; } else { return !(f1 != 0); } }
boolean evaluateEquality(Double f1, Double f2) { if(f1.isNaN()){ return f2.isNaN(); } if(f1.isInfinite()){ return f2.isInfinite(); } if ((f1 + f2) / 2 != 0) { return Math.abs(f1 - f2) / ((f1 + f2) / 2) < 1.0E-12; } else { return !(f1 != 0); } } }
Julien Le Dem / @julienledem: what is the source for those? Any details on why = 0) as opposed to f1 == 0 for example?
Jacques Nadeau / @jacques-n: I wrote it based initially on the code here: https://github.com/mapr/drill-test-framework/blob/master/framework/src/main/java/org/apache/drill/test/framework/ColumnList.java#L115
Don't remember offhand the f1 != 0. What are the rules about NaN and Infinite in the case of a floating point negation?
Julien Le Dem / @julienledem: this method will return early if f1 is NAN or infinite so there's no special case here.
Jacques Nadeau / @jacques-n: good point :D
Julien Le Dem / @julienledem: Issue resolved by pull request 223 #223
julienledem
No branches or pull requests
Floating point precision rears its ugly head:
Reporter: Wes McKinney / @wesm
Assignee: Julien Le Dem / @julienledem
PRs and other links:
Note: This issue was originally created as ARROW-401. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: