Question

Dividing using Expression Evaluator


Badge +1
Hi,

 

 

I am using ExpressionEvaluator to do a simple division: AttributeX/AttributeY.  However, I keep getting 0 as the resultant value.

 

 

When I try ExpressionEvaluator to do 5/10 it also returns 0.  But when I test 10/2 it returns 5.  Therefore I am assuming it has something to do with floats.

 

 

What should I do to get this to work?

 

 

Thanks,

3 replies

Userlevel 4
Badge +13
Hi,

 

The decimal trap no longer exists in FME 2015 so you are using an older version....see the following:https://knowledge.safe.com/communityanswers?id=906a0000000d7vTAAQ

 

Just add a decimal to one of the operands to resolve this, or upgrade to 2015

 

 
Badge +1
Ah ok thanks Itay, I hadn't come across this decimal trap before.
Badge +3
it is ancient issue. It is not a trap at all. It is logic.

 

In older version you should always add a *1.0 to the dividor.

Reply