Iscript Function Trunc() Precision Not Working
Last updated on SEPTEMBER 26, 2016
Applies to:Oracle Communications Billing and Revenue Management - Version 22.214.171.124.0 and later
Information in this document applies to any platform.
***Checked for relevance on 01-May-2010***
Checked for relevance on 28-Nov-2011
The trunc() function does not work on Decimal variables in iScript and iRule scripts that a user has created following BRM documentation :
In the iScript, the following code was added:
percent_trunced = trunc(percent, 2);
logFormat( "grant unit after trunc = " + decimalToStr (percent_trunced) );
In the corresponding log file, the user got :
pts.RealtimeDiscountDsc) grant unit before trunc = 5.000000
09.01.2008 16:22:57 myhost ifw IFW NORMAL [T:7] 00387 -
pts.RealtimeDiscountDsc) grant unit after trunc = 5.000000
Also the user tried passing only the variable percent to trunc without specifying the number of digit to truncate to (so that it will take the default zero as the document suggests). Neither option worked.
Steps to Reproduce :
1) Declare a Decimal variable, say x.
2) Assign x with a value of 5 digits after the decimal point, say, 5.00000.
3) call trunc(x, 2) in an iScript
4) log the value of x before and after the trunc call with logFormat
5) Examine the log file.
6) It will show that x is not truncated after the trunc() call.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms