Code: Select all
['Element X'] = IF( ['Element A'] <> 0, ['Element B'], 0 );
Code: Select all
['Element X'] = ABS( SIGN( ['Element A'] ) ) * ['Element B'];
The claim is that the second approach is faster than an if statement because it only has to check the sign bit on the value in Element A. But I wanted to get others opinions on this. My concern is that this approach is actually slower since the true statement in the above example is always calculated even if it returns 0 using the consultants approach. Not a major issue in this simple example but it gets worse as you add complexity and possible nesting. Is anyone able to validate that this is actually faster? Or is it only faster in certain circumstances?
My other concern is that the second approach is just plain confusing and hard to read for anyone not familiar with the model.