Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a tMap with runs a calculation and stores it in a float variable before its outputted to excel. My problem is that the output appears as if its rounded but I can't figure out why
My calculation starts by adding 3 integers and stores that result in a variable "IntValue"
Var.IntValue is then divided it by both 11 and 12 and stores those in float variables Float11 & Float12 respectively.
When I output Var.Float11 and Var.Float12 to a generic schema based output table to Columns of type float I get whole numbers (no decimal values) in both excel and csv file.
If I calculate the formula in Excel myself I get more expected values which include decimal places.
Where in Talend am I going wrong that I don't get the same result?
Also if add a tRowLog to output the flow the column in question is also a whole number
My solution was to change the tMap Variable Counted from int to float (in the image attached earlier). That means the calculations where I divide by other numbers is based on a float as input instead of an integer value. I assumed only the end result needed to be floating and not the dividend.
Hello,
Would you mind posting your tMap setting screenshots into forum?
Best regards
Sabrina
Hi Sabrina,
Attached is the Variables Table and the output schema settings of the relevant tMap. Is that what you mean?
Also if add a tRowLog to output the flow the column in question is also a whole number
My solution was to change the tMap Variable Counted from int to float (in the image attached earlier). That means the calculations where I divide by other numbers is based on a float as input instead of an integer value. I assumed only the end result needed to be floating and not the dividend.
use value like 11.0 instead of 11.
In Java , if you divide Int to Int , it will be rounded before Type Conversion.
check result of below commands
System.out.println(11/10);
System.out.println(11/10.0);