Oh by the way, I have added an inspector to the data just before trying Expression evaluator or Attribute Creator and both the HF and Population attribute information are showing as (64 bit real). The output values are also set as numbers.
I have tracked it down.I think I may have hit a bug in FME.
I tried the following caluculations where
HF = 1 and Population = 1000
HF + Population = 1001
HF * Population = 1000
HF / Population = 0 , this should be 0.001.
Si,
In your calculation try *1000.000 (for example) as opposed to 1000 OR somewhere in your calculation put in *1.000
This should then make FME reveal the decimal places you require
...............
Hope this helps
Howard L'
Hi,
Probably both HF and Population values don't have decimal places.
The / operator returns integer when both operands are integer.
e.g. "1 / 2" returns "0", it doesn't return "0.5".
Even though the data type is shown as "64 bit real" in Data Inspector, it will be interpreted as integer when the expression is evaluated, if it doesn't have decimal places.
To avoid the "integer division trap", try adding decimal places to at least one operand of the / operator.
e.g.
Rate = 1000
.0 * HF / Population
Rate = @double(HF) / Population * 1000
Rate = (HF + 0.0) / Population * 1000
and so on.
It's the spec of the / operator in FME 2014 or earlier.
But be aware that the spec has been changed in FME 2015.
In FME 2015, "1 / 2" returns "0.5".
Takashi
Thanks for the response.
Used Rate = (HF + 0.0) / Population * 1000 as a work around.