DeltaV TRUNC function results

Hello All,

We have observed an unusual behavior of the TRUNC function in DeltaV 13.3.1 Build 6290. The function is rounding the value to the lower digit. As shown in example, LOG2(2,8192) = 13 when applied with TRUNC gets rounded to 12.


Has anyone noticed this?

Please let me know in case any analysis has been done.

Thank you.

 

Regards,

 

Purnendu Saptarshi

Automation Engineer

m:

+1-414-520-5740

e:

purnendu.saptarshi@skellig.com

 

Purnendu Saptarshi

Automation Engineer | Skellig Automation US LLC | Greater Boston Area, MA

3 Replies

  • Hello

    The Trunc function do not round anything.

    It only take the value before the decimal delimiter.

    If your number is 12.9, it returns 12

    See then Round function if you want to see 13 for values between 12.5 and 13.499

  • LOG2(2,8192) = 13, and you would expect TRUNC(13) to be 13. However, sometimes (especially with some math functions like LOG functions), there are floating point issues. The expression may compute LOG2(2,8192) as 12.9999999, which would display as 13, but get truncated to 12. To test this, try expanding the outputs to 3 and add "'OUT3' := 13 - 'OUT1';" to the expression. If there was a floating point problem, you'll see a small, but non-0, number for OUT3. We have encountered this kind of issue before with TRUNC and we've added a small value (0.00001) before using TRUNC to offset the potential. In our application, the addition of the small number would offset the floating point issue, but would not change a real result. I tried to duplicate your particular values in DeltaV v12.3.1, but I got the correct results. However, in my test, both the "2" and the "8192" were inputs to the CALC (no hard-coded values). Another possible difference (other than DeltaV version and using an IN for "2"): was your test on a real controller or a virtual one? My test was on a real controller. I hope this gives you some avenues to pursue for trouble-shooting.
  • In reply to SBPosey:

    Yeah, rounding can produce weird results. If you want, have a look at a call I opened (NC-1500-3447) where division did not produce the same result as multiplying with the inverse of the number.