Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Float data type issue

Hi,
I have column with the datatype float(8,6), in the initial load the value it takes as 1.299999 and in the second run it gives the values as 1.299998. What could be the issue behind this inconsistency.This causes our insert update stratergy to fail.
Labels (2)
5 Replies
_AnonymousUser
Specialist III
Specialist III
Author

In Source database the value is 1.3 but Talend is reading it as 1.299999 which seems to be a bug. Any idea how this could be handled.
Anonymous
Not applicable

hi,
you have to use BigDecimal to keep all precision on decimal.
Float & Double in Java could round number.
http://docs.oracle.com/javase/6/docs/api/java/math/BigDecimal.html
regards
laurent
_AnonymousUser
Specialist III
Specialist III
Author

Hi,
After using data type as bigdecimal,Talend won't allow to perform *,/ oprations and abs() function on that column.
Please help me on this.
Anonymous
Not applicable

Hi you can use code like
  row1.nb.compareTo(new BigDecimal("0"))<=0?row1.nb.multiply(new BigDecimal("-1")):row1.nb

to replace abs()
alevy
Specialist
Specialist

row.column1.abs()
row.column1.multiply(row.column2)
row.column1.divide(row.column2)
See the Java docs.