Skip to main content
Question

Dividing using Expression Evaluator


Forum|alt.badge.img+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

fmelizard
Safer
Forum|alt.badge.img+19
  • Safer
  • July 1, 2015
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

 

 

Forum|alt.badge.img+1
  • Author
  • July 1, 2015
Ah ok thanks Itay, I hadn't come across this decimal trap before.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • July 3, 2015
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.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings