14 Configuring Resource Rounding

This chapter describes how to configure balance impact rounding rules if you are using Oracle Communications Billing and Revenue Management (BRM) Pricing Center. This data is used by both real-time rating and pipeline batch rating.

Topics in this document:

Note:

If you are using Oracle Communications Pricing Design Center (PDC) to create product offerings, see "Configuring Balance Impact Rounding" in PDC Creating Product Offerings.

About Resource Rounding

BRM enables you to create various rounding rules for different resources, events, and processes such as rating and discounting. You create rounding rules for several reasons:

  • To increase the accuracy of rating and discounting results.

  • To process usage fees more efficiently. For example, an infinite number such as 5.333... is more easily processed when it is rounded.

  • To round for various currencies that use a different number of digits to the right of the decimal (for example, 10.25 dollars and 10 yen).

  • To comply with currency conversion rules.

  • To bill customers an amount that they can actually pay.

You configure rounding by editing the pin_beid file and loading the contents of the file into the /config/beid object in the BRM database. For more information, see "Configuring Resource Rounding".

About Rounding Rules

You can configure resource rounding based on the following rounding criteria:

  • The rounding scale is the number of significant digits to the right of the decimal point. For example, a scale of 2 applied to 10.321111 rounds to 10.32.

  • The rounding mode defines whether the number is rounded up, down, or not at all, based on the value of the digit following the last significant digit. See "About Rounding Modes".

  • The process to which the rounding configuration applies. You can specify one of these processes: rating, discounting, taxation, and accounts receivable (A/R). A/R includes actions such as billing, payments, adjustments, cancellations, and G/L reporting.

    Specifying the process enables you to round differently based on the operation. For example, you can round up using six decimal places for rating and round down using two decimal places for billing.

  • The event type to which the rounding configuration applies. This enables you to round differently for events that represent specific types of usage, cycle fees, discounts, and rollovers. For example, US dollars and purchase events (/event/purchase).

Table 14-1 show how a US dollars resource and purchase event combination can be rounded various ways for various processes:

Table 14-1 Currency Resource and Event Type

For a US Dollars Resource For This Process Use This Rounding Scale Use This Rounding Mode

Event type = /event/billing/product/fee/purchase

Rating

6

Down

Event type = /event/billing/product/fee/purchase

Discounting

6

Up

Event type = /event/billing/product/fee/purchase

A/R

2

Nearest

Event type = /event/billing/product/fee/purchase

Taxation

2

Nearest

You can specify any combination of scale and mode for resource, event, and process combinations.

After each process that performs rounding (rating, discounting, and so forth), the balance impact of the event contains the rounded amount.

To configure rounding, you specify the rounding rules in the resource configuration file (BRM_Home/sys/data/pricing/example/pin_beid), and then you load the file by using the load_pin_beid utility. The pin_beid file contains default rounding rules that you can use. For more information, see "Configuring Resource Rounding".

Note:

To round noncurrency aggregation counter balances for discounting purposes, use Pipeline Manager discount expressions. For more information, see "About Rounding Aggregation Counter Resources for Discounting".

How BRM Applies Rounding

Rating, discounting, and taxation produce balance impacts, which are rounded and applied to the customer's account balance. The balance impacts are rounded to the scale and mode configured for the event, resource, and process combination.

Balance impacts for an account are stored in bill items, which are associated with the customer's bill. When you run billing, the item totals are rounded according to the A/R rounding rule. Item totals are rounded before being added to the bill so that the bill itself never needs rounding. Before billing, item totals are unrounded and their amounts reflect the scale configured for the associated events.

Figure 14-1 show the general process of balance impact rounding:

Figure 14-1 BRM Balance Impact Rounding

Description of Figure 14-1 follows
Description of "Figure 14-1 BRM Balance Impact Rounding"

Both real-time rating and pipeline batch rating perform rounding. During pipeline rating, the pipeline rounds the amount in each charge and discount packet.

To round in a pipeline, you configure the Pipeline Manager rounding module. See "Setting Up Rounding in Pipeline Manager". To configure the rounding rules, see "Configuring Resource Rounding".

Assuming that rounding is configured for all events and all processes (rating, discounting, taxation, and A/R), rounding is performed in the following order:

  1. Purchase and cycle fees. When a plan is purchased, the purchase and cycle fees are rounded, if necessary, and a balance impact is generated with the rounded amount. Purchase and cycle fees typically only need rounding when a user purchases or cancels a plan in the middle of the billing cycle. In this case, cycle fees and noncurrency grant amounts are prorated, if necessary, and then rounded.

  2. Usage fees. As customers use their services, the usage events are rated, the usage fees are rounded, and balance impacts are generated with the rounded amounts.

  3. Discount fees. If a usage discount applies, the discount is calculated on the rounded usage fee, and then the discount is rounded and a discount balance impact is generated with the rounded amount. If there are multiple usage discounts, each discount is rounded in sequence.

  4. Taxes. If tax should be applied to the event, the tax is calculated on the fee rounded from the previous stage, and then the tax is rounded and a balance impact is generated with the rounded amount.

  5. Billing discounts. When you run billing, if a billing-time discount applies, it is applied to the total of the rounded usage items, and then the discount is rounded and a discount balance impact is generated with the rounded amount.

  6. Bills. When the bill is generated, the total amount in each item is rounded, and then all item totals are summed and included in the bill.

  7. Rollover. If there are any rollover amounts, the rollover is calculated on the total rounded usage, and then the rollover amount is rounded and applied to the next billing cycle. For example, if 100 minutes can be rolled over and the customer used 60.4 minutes, the unused amount of 39.6 minutes is rounded and then added to the account balance for the next cycle.

    To round for rollover, you configure a rounding rule for the noncurrency resource and cycle forward event combination. Rollover is typically rounded up.

About Rounding and A/R Actions

When entering amounts for A/R actions such as adjustments and refunds, customer service representatives (CSRs) typically use natural scale: that is, the scale commonly used in the marketplace for that resource. For example, a person who purchases a book using US dollars cannot make change smaller than one cent (.01 dollars), making 2 the natural scale for US dollars. However, if a CSR reverses or adjusts an event before billing, the scale used is the one in the event's balance impact. By default, this is the natural scale, unless you change this to use a scale other than natural.

About Rounding Billed and Unbilled Items

The balance impacts of events associated with items can have a high scale. Before billing, item totals reflect the scale of their associated events. During billing, item totals are rounded using the A/R rounding configuration so that customers' bills display the natural scale for the resource. However, the events associated with billed items still retain their pre-billing scale.

If any operation is performed on billed items: for example, event-level and item-level adjustments, BRM rounds the balance impact of the operation according to the A/R rounding rule to maintain G/L integrity. Because actions on billed items are rounded when they occur, only pending items are rounded when billing is run.

About Rounding for Specific Event Types

When you configure a rounding rule for a specific event type, such as cycle or session events, that rounding rule applies to those events only for the process specified. If you do not configure a rule for every process, all other processes for that event type use the default rounding rule defined in the pin_beid file. The default rounding rule specifies natural scale for all events and the rounding mode most commonly used for the process. A rule for all events is specified by using an asterisk (*) as the default event type.

For example, given the configuration in Table 14-2, during rating, session events are rounded down and have a scale of 6. During taxation, however, session events use the default rule of rounding to the nearest with a scale of 2:

Table 14-2 Rounding for Specific Event Types

Resource Event Type Process Rounding Scale Rounding Mode

US dollars

/event/session

Rating

6

Down

US dollars

 * (all events)

Taxation

2

Nearest

About Rounding Aggregation Counter Resources for Discounting

For discount rounding, the rounding configurations in the pin_beid file are used to round only the balance impacts of discounting, not input balances such as aggregation counters. To round aggregation counter balances in a pipeline, you use pipeline discount expressions when you configure your discounts. To configure aggregation counter rounding, see "Configuring Rounding Rules for Aggregation Counter Resources".

About G/L Report Rounding

G/L report rounding uses the rounding rule configured for A/R actions. The rounded totals in G/L reports might differ slightly from the total of the rounded bills. This is because item totals are rounded for billing, and journal entries are rounded for G/L reports. Also, G/L reports are rounded differently before and after billing. For more information, see "About Rounding and G/L Reports" in BRM Collecting General Ledger Data.

If there is any difference between the rounded journal entries in G/L reports and the rounded bill items, BRM records the difference in the G/L. You configure a G/L ID for the rounding difference and configure BRM to record the differences. See "Configuring to Record Rounding Differences in the G/L".

About Rounding Modes

A rounding mode defines whether a number is rounded up, down, or not at all. The rounding mode rounds to the specified scale. For example, using a scale of 2, rounding up 10.2369 results in 10.24. If the scale is 3, rounding up results in 10.237.

The following rounding mode values that you can use in the pin_beid file are defined in the BRM_Home/include/pin_bill.h file:

  • 0: PIN_BEID_ROUND_NEAREST

    This mode rounds up or down depending on the value of the digit following the last significant digit. If the additional digit is 0-4, the last significant digit remains the same. If the additional digit is 5-9, the last significant digit is rounded up. For example, if the scale is 2, 10.144 rounds to 10.14 and 10.145 rounds to 10.15. This is the most common rounding method.

  • 1: PIN_BEID_ROUND_UP

    This mode rounds up when the digit following the last significant digit is greater than 0. For example, If the scale is 2, 10.151 rounds to 10.16. If the scale is 1, it rounds to 10.2.

  • 2: PIN_BEID_ROUND_DOWN

    This mode truncates all digits following the last significant digit. For example, if the scale is 2, 10.159 rounds to 10.15. If the scale is 1, it rounds to 10.1.

  • 3: PIN_BEID_ROUND_EVEN

    This mode rounds one of three ways depending on the value of the digit following the last significant digit:

    • If it is less than 5, truncate all digits following the last significant digit.

    • If it is greater than 5, round up.

    • If it is 5, round to the nearest even digit. For example, if the scale is 2, 10.155 and 10.165 both round to 10.16 because 6 is an even number.

  • 4: PIN_BEID_ROUND_FLOOR

    This mode rounds numbers toward a negative value (that is, the rounded number is always less than the unrounded number). This enables you to round balance impacts so that customers always benefit. For example, if the scale is 2, a credit to a customer of -7.999 is rounded to -8.00, and a debit of 7.999 is rounded to 7.99.

  • The following two modes perform the same rounding as their non-alternative counterparts (ROUND_FLOOR and ROUND_DOWN), except that they compensate for possible loss of precision when rounding down by first rounding with a mode of NEAREST using a scale that is two digits greater than the scale you configure.

    • 5: PIN_BEID_ROUND_FLOOR_ALT

    • 6: PIN_BEID_ROUND_DOWN_ALT

    For more information, see "About Rounding Modes That Correct for Loss of Precision".

About Rounding Modes That Correct for Loss of Precision

Some calculations produce results that are slightly less than expected when a value is rounded down. For example, when BRM prorates a $60.00 cycle fee for 20 out of 30 active days, the calculation is (20/30) * $60.00. The expected result is a fee of $40.00. However, because 20/30 evaluates to 0.666..., when this is multiplied by 60 and rounded down, the actual result is a fee of $39.99.

BRM provides two alternative rounding modes that compensate for possible precision loss when rounding down: ROUND_DOWN_ALT and ROUND_FLOOR_ALT. These modes perform the same rounding as their non-alternative counterparts (ROUND_DOWN and ROUND_FLOOR) after first compensating for loss of precision.

Note:

ROUND_DOWN_ALT and ROUND_FLOOR_ALT are not supported in the BRM PCM Java API and in discount expressions.

When these modes are used, if a decimal should be rounded down, BRM performs two rounding functions: The decimal is rounded by using the ROUND_NEAREST rounding mode and a scale that is two more than the scale that you request. It is then rounded down.

For example, if you configure the rounding mode as ROUND_DOWN_ALT and a rounding scale of 2, and the decimal to round is 7.999..., BRM truncates the infinite decimal to the system maximum and then rounds this decimal to the nearest using a scale of 4 (2 more than the configured scale of 2), which results in 8.0000. This decimal is then rounded down using the configured scale of 2, resulting in 8.00 as shown in Table 14-3:

Table 14-3 Rounding Modes That Correct for Precision

Do This Why

7.999...

Original decimal

7.99999999999999

Truncated to the system max

8.0000

ROUND_NEAREST, using requested scale + 2

8.00

ROUND_DOWN to the requested scale of 2

Had the original decimal of 7.999... not been rounded to the nearest first and only rounded down, the result would be 7.99.

To compensate for possible loss of precision, the alternative rounding modes consider two decimal places more than the non-alternative rounding modes. Therefore, the greatest amount that will be modified by using the alternative rounding modes, and still compensate for loss of precision, is less than the greatest amount that will be modified by using the non-alternative rounding modes.

When Rounding Is Not Applied

When the requested rounding scale is greater than the scale of the number being processed, rounding is not required. This occurs when:

  • You configure a rounding scale equal to or greater than the maximum number of digits allowed by the system. For example, if the system allows 15 digits and you set the rounding scale to 15 or greater, rounding has no effect.

  • You call a rounding function and request a scale that is equal to or greater than the current scale of the decimal: for example, when the decimal is 10.89766 and the scale requested is 5 or greater.

  • A computation or expression results in a decimal with a scale that is equal to or less than the configured or requested scale: for example, when a computation results in the decimal 1.98 and the configured scale is 2 or greater.

Configuring Resource Rounding

To set up rounding, perform the following tasks:

About Configuring Rounding Rules

You define rounding rules in the balance element ID (BEID) configuration file (BRM_Home/sys/data/pricing/example/pin_beid) and then run the load_pin_beid utility to load the contents of the file into the /config/beid object in the BRM database. See "Configuring Rounding Rules".

The pin_beid file contains default rounding rules based on the most commonly used rounding for the resource and operation. The default rules specify a configuration for all events by using an asterisk (*) as the default event type. For an explanation of the configuration syntax and fields, see the pin_beid file.

You configure rounding for resource and event type combinations (for example, US dollars and /event/session/telco/gsm events). For each resource and event combination, you specify a rounding scale, a rounding mode, and the process for which this rule applies. For the process, you specify one of these enumerated values in the pin_beid file:

  • Rating = 0

  • Discount = 1

  • Taxation = 2

  • A/R = 3

To configure an event and resource rule for every process, you add an entry for each process.

Note:

  • You do not need to configure rounding for all of the processes. However, you must configure rounding for every resource and event type that has a balance impact.

  • If you add resources that are not already in the pin_beid file, you should always include a default rounding configuration for that resource that applies to all event types. Any event type that is not explicitly specified for the resource uses this default rounding rule.

  • You can use a single asterisk (*) to denote a default value such as any event type. However, in combination with other characters, you must use valid regular expressions. For example, specifying /event/* is incorrect; specifying /event/(.)* is correct.

Note:

You can use regular expressions in the rounding configurations. For example, /event/session/(.)* matches all session events.

For more information, see "Configuring Rounding Rules".

Prioritizing Rounding Rules

BRM applies the first matching rounding rule in the /config/beid file. Therefore, if you have more than one rule that matches an event, resource, and process combination, add them in order of priority in the pin_beid file. For example, a configuration that matches a specific event type should be added before a configuration that matches all event types.

If there is no rounding rule in the /config/beid object that matches the resource, event, and process combination, and no default rule that applies to all events, the event is not rounded.

About Rounding Mode Values

The rounding modes you specify in the pin_beid file have corresponding modes in the following API components. However, their values are not all the same:

  • The BRM decimal data type functions. When BRM invokes a decimal data type function, it converts the rounding mode in the /config/beid object into the corresponding rounding parameter used by the decimal data type function. If you call decimal data type functions in custom applications, specify the function's rounding mode, not the BEID rounding mode.

  • The BAS Decimal class. The FCT_Rounding pipeline module converts the rounding mode in the /config/beid object into the corresponding rounding mode used by the BAS rounding method in Pipeline Manager. If you use the BAS Decimal rounding method in custom pipeline modules and iScripts, you should include the FCT_Rounding module in your pipeline. Otherwise, you will need to convert the rounding mode in the /config/beid object into the BAS rounding mode before calling the BAS rounding method.

Table 14-4 shows the BEID rounding modes and the corresponding rounding parameters for the decimal data type functions and the BAS rounding modes:

Table 14-4 BEID Rounding Modes

BEID Rounding Mode (specified in pin_bill.h) Rounding Mode Parameter for pbo_decimal functions BAS Decimal Rounding Mode

0: PIN_BEID_ROUND_NEAREST

5: ROUND_HALF_UP

0: PLAIN

1: PIN_BEID_ROUND_UP

1: ROUND_UP

1: UP

2: PIN_BEID_ROUND_DOWN

2: ROUND_DOWN

2: DOWN and TRUNCATE

3: PIN_BEID_ROUND_EVEN

7: ROUND_HALF_EVEN

3: BANKERS

4: PIN_BEID_ROUND_FLOOR

4: ROUND_FLOOR

101: FLOOR

5: PIN_BEID_ROUND_FLOOR_ALT

8: ROUND_FLOOR_ALT

103: FLOOR_ALT

6:PIN_BEID_ROUND_DOWN_ALT

9: ROUND_DOWN_ALT

102: DOWN_ALT

N/A

3: ROUND_CEILING

N/A

N/A

6: ROUND_HALF_DOWN

N/A

N/A

10: ROUND_UNNECESSARY

N/A

Configuring Rounding Rules

To configure rounding rules, you edit the BEID configuration file and then run the load_pin_beid utility to load the contents of the file into the /config/beid object in the BRM database.

Note:

The load_pin_beid utility needs a configuration (pin.conf) file in the directory from which you run the utility.

To configure resource rounding:

  1. Edit the pin_beid file in BRM_Home/sys/data/pricing/example. The pin_beid file includes instructions.

    Note:

    The load_pin_beid utility overwrites the existing resources. If you are updating resources, you cannot load new resources only. You must load complete sets of resources each time you run the load_pin_beid utility.

  2. Save the pin_beid file.

  3. Use the following command to run the load_pin_beid utility:

    load_pin_beid pin_beid 
    

    If you do not run the utility from the directory in which the file is located, you must include the complete path to the file. For example:

    load_pin_beid BRM_Home/sys/data/pricing/example/pin_beid 

    Note:

    If you copy the pin_beid file to the directory from which you run the load_pin_beid utility, you do not have to specify the path or file name. The file must be named pin_beid.

    For more information, see "load_pin_beid".

  4. Stop and restart the Connection Manager (CM).

To verify that the network elements were loaded, you can display the /config/beid object by using Object Browser, or use the robj command with the testnap utility.

After loading the pin_beid file, functions that calculate fees and discounts use the rounding rules in the /config/beid object.

Configuring Rounding Rules for Aggregation Counter Resources

You use Pricing Center to configure rounding rules for aggregation counter resources. When you set up your discount configurations, use discount expressions to specify how to round the resource. Use the following discount expression syntax:

round(expression, rounding_scale, rounding_mode)

where expression defines the resource balance to round. This can be any discount expression. To round an aggregation balance, use the Bal expression. For more information, see the discussion about setting up discounts in the Pricing Center Help.

For example, to round a balance down to two decimal places for an aggregation counter resource with ID 100099, use the following expression:

round( Bal(1000099), 2, ROUND_DOWN )
About Rounding Modes for Discount Expressions

Rounding modes for discount expressions are equivalent to those you specify in the pin_beid file, but they have slightly different names. Table 14-5 lists the rounding mode values you can specify in discount expressions and their pin_beid file counterpart.

Table 14-5 Rounding Modes for Discount Expressions

Discount Expression Rounding Mode Rounding Mode Used in the pin_beid File

ROUND_PLAIN

Nearest

ROUND_UP

Up

ROUND_DOWN

Down

ROUND_BANKERS

Even

For a definition of what these modes represent, see "About Rounding Modes".

Configuring to Record Rounding Differences in the G/L

To record any difference between rounded bill items and the rounded total in the G/L, perform the following tasks:

For information about how rounding is performed in G/L reports, see the discussion about rounding and G/L reports in BRM Collecting General Ledger Data.

Defining a G/L ID for Rounding Differences

You define a G/L ID for rounding to include the rounding difference in G/L reports so that they can be accurately reconciled.

To define G/L IDs, you edit the G/L ID configuration file and then run the load_pin_glid utility to load the contents of the file into the /config/glid object in the BRM database.

Note:

The load_pin_glid utility needs a configuration (pin.conf) file in the directory from which you run the utility.

To define a rounding G/L ID:

  1. If necessary, edit the G/L ID configuration file in BRM_Home/sys/data/pricing/example/pin_glid. If the following entry is not present, add it:

    #=================================================================
    # G/L ID for rounding adjustments 
    #=================================================================
    glid 
    id 1512 
    descr Rounding Epsilon
    gl_acct billed         gross    rounding.debit    rounding.credit
    gl_acct billed         net      rounding.debit    rounding.credit
    gl_acct billed         disc     rounding.credit   rounding.debit
    gl_acct billed_earned  gross    rounding.debit    rounding.credit
    gl_acct billed_earned  net      rounding.debit    rounding.credit
    gl_acct billed_earned  disc     rounding.credit   rounding.debit
    gl_acct unbilled       gross    rounding.debit    rounding.credit
    gl_acct unbilled       net      rounding.debit    rounding.credit
    gl_acct unbilled       disc     rounding.credit   rounding.debit 
    gl_acct unbilled_earned gross   rounding.debit    rounding.credit
    gl_acct unbilled_earned net     rounding.debit    rounding.credit
    gl_acct unbilled_earned disc    rounding.credit   rounding.debit
    )

    Note:

    The load_pin_glid utility overwrites existing G/L IDs. If you are updating G/L IDs, you cannot load new G/L IDs only. You must load complete sets of G/L IDs each time you run the load_pin_glid utility.

  2. Save and close the file.

  3. Use the following command to run the load_pin_glid utility:

    load_pin_glid pin_glid_file 
      

For more information, see the discussion about loading general ledger configuration data in BRM Collecting General Ledger Data.

Mapping the Rounding G/L ID to an Event

Because the rounding difference is not a rated event, you must map the G/L ID to an event type. G/L ID mapping is defined in the reasons.locale file. You can find a sample of this file in the BRM_Home/sys/msgs/reasoncodes directory. The sample file is named reasons.en_US and contains the following default entry for the rounding G/L ID mapping:

DOMAIN = "Others" ;
STR
     EVENT-GLID
          . . . 
          /event/journal/epsilon"        1512 ;
     EVENT-GLID-END

Note:

/event/journal/epsilon is a dummy event type used for reference only.

To change the G/L ID for rounding, you must edit and reload the file. The G/L ID you define in the reasons.locale and pin_glid files must match. See "Configuring to Record Rounding Differences in the G/L".

To map the G/L ID for rounding to an event, you use the load_localized_strings utility to load the contents of the file into the /config/map_glid object. When you run the load_localized_strings utility, use this command:

load_localized_strings reasons.locale

Note:

If you are loading a localized version of this file, use the correct file extension for your locale.

Note:

The load_localized_strings utility overwrites the existing G/L ID maps. If you are updating this object, you cannot load new G/L ID maps only. You must load complete sets of G/L ID maps each time you run the load_localized_strings utility.

For information on loading the reasons.locale file, see the discussion about creating a localized version of BRM in BRM Developer's Guide.

Configuring BRM to Record Rounding Differences

By default, rounding differences are not recorded in G/L reports. You can enable this feature by modifying a field in the billing instance of the /config/business_params object.

You modify the /config/business_params object using the pin_bus_params utility.

To enable BRM to record rounding differences:

  1. Use the following command to create an editable XML file from the billing instance of the /config/business_params object:

    pin_bus_params -r BusParamsBilling bus_params_billing.xml 
    

    This command creates the XML file named bus_params_billing.xml.out in your working directory. If you do not want this file in your working directory, specify the full path as part of the file name.

  2. Search the XML file for the following line:

    <GenerateJournalEpsilon>disabled</GenerateJournalEpsilon>
    
  3. Change disabled to enabled.

    Note:

    BRM uses the XML in this file to overwrite the existing billing instance of the /config/business_params object. If you delete or modify any other parameters in the file, these changes affect the associated aspects of the BRM billing configuration.

  4. Save and close the file.

  5. Use the following command to load the change into the /config/business_params object:

    pin_bus_params bus_params_billing.xml 
    

    You should run this command from the BRM_Home/sys/data/config directory, which includes support files used by the utility.

  6. Read the object with the testnap utility or Object Browser to verify that all fields are correct.

  7. Stop and restart the Connection Manager (CM).

  8. (Multischema systems only) Run the pin_multidb script with the -R CONFIG parameter. For more information, see the discussion about pin_multidb in BRM System Administrator's Guide.

Setting Up Rounding in Pipeline Manager

Pipeline Manager uses the rounding rules specified in the /config/beid object when applying rounding. To round balance impacts in Pipeline Manager, you configure the FCT_Rounding module. See "About Configuring the FCT_Rounding Module".

You can also set up separate rounding rules when defining pricing. See "About Rounding Rules in Pricing".

Rounding rules can conflict. For more information, see "Avoiding Rounding Conflicts in Pipeline Manager".

About Configuring the FCT_Rounding Module

The FCT_Rounding module finds the rounding rule in the /config/beid object based on the event, balance element, and process (rating, discounting, or taxation) combination and then rounds the amount in the relevant EDR packet.

Add FCT_Rounding to the pipeline after the processing module for which it is rounding:

  • To round for rating, add this module after the FCT_RateAdjust module.

  • To round for taxation, add this module after the ISC_TaxCalc iScript module.

  • To round for real-time discounting, add this module after the FCT_Discount module.

  • To round for batch discounting, add this module after the FCT_Discount module and before the FCT_ApplyBalance module.

You specify the process for which this module is rounding in the Mode entry of the module registry:

  • Rating = Round the balance impact of rating.

  • Taxation = Round the balance impact of taxation.

  • Discounting = Round the balance impact of discounting.

For more information, see "Avoiding Rounding Conflicts in Pipeline Manager".

About Rounding Rules in Pricing

You specify one of these rounding methods when defining pricing:

  • None: Only the rounding rules configured in FCT_Rounding are used.

  • Plain: Round up if the last significant digit is 5 or greater.

  • Up: Always round up to the next highest digit.

  • Down: Always round down to the next lowest digit.

  • Bank: If the last significant digit is 5, make it even.

If you specify a rounding method other than None for pricing, Pipeline Manager will use that rounding method during rating.

For more information, see "Avoiding Rounding Conflicts in Pipeline Manager".

Avoiding Rounding Conflicts in Pipeline Manager

For Pipeline Manager, it is possible to specify rounding rules in two places that apply to the same event. Pipeline Manager uses different rounding rules at different points in the rating process:

  • The rounding method specified for the pricing is used by the rating module.

  • The rounding method specified for the balance element and event is used in the FCT_Rounding module, which is usually run after the FCT_RateAdjust and FCT_Discount modules in the pipeline.

Because rounding can take place at these different points in the pipeline, you can get unexpected results. To avoid conflicts between different rounding rules, you can do one of the following:

  • Choose None for the rounding method in the pricing. If you do this, only the rounding rules configured in FCT_Rounding are used.

  • If you select a rounding method other than None in the pricing, ensure that the selected method is consistent with the rounding method that FCT_Rounding will use.

Rounding Examples

Rounding is performed after rating, discounting, taxation, and A/R actions such as billing and adjustments.

Table 14-6 shows the resulting balance impacts of rounded charges for rating, discounting, taxation, and billing. This example rounds to the nearest mode and uses these scales:

  • 2 for purchase events, taxation, and A/R

  • 5 for rating and discounting

    Table 14-6 Rounding Examples

    Action / Process Calculated Charge Rounded Charge & Balance Impact Account Balance

    Purchase plan

    Rate cycle fee

    9.95

    9.95

    9.95

    Use service

    Rate usage

    5.23456789

    5.23457

    15.18456

    Discount usage fee 10%

    0.523456789

    0.52346

    14.66111

    Tax usage event 3% (after discount)

    0.1413333

    = 3% * (rounded usage fee - rounded discount)

    0.14

    14.80111

    Run billing

    Apply billing-time discount of 5% off total usage

    0.24250...

    = 5% * usage item total after A/R rounding

    (The usage total does not include the cycle fee.)

    0.2425

    14.55861

    Create bill

    14.55861

    = Total of all items

    14.56

    (No balance impact)

    14.56

Correcting for Precision Loss When Rounding Down

This example shows the results of rounding when you use the ROUND_DOWN_ALT and ROUND_FLOOR_ALT modes. For more information, see "About Rounding Modes That Correct for Loss of Precision".

The ROUND_DOWN_ALT and ROUND_FLOOR_ALT modes produce different results than ROUND_DOWN and ROUND_FLOOR only when the three digits following the last significant digit are 995 or greater. (The last significant digit is the digit in the decimal place corresponding to the scale: If the scale is 2, the last significant digit in the number 1.23456 is 3.)

For example:

Table 14-7 shows some rounding results of the ROUND_DOWN_ALT and ROUND_FLOOR_ALT modes as compared to their non-alternative rounding counterparts (ROUND_DOWN and ROUND_FLOOR) for various decimal values and rounding scales.

Table 14-7 Rounding Results

Decimal Scale Rounding Mode Rounding Mode Rounding Mode Rounding Mode
NA NA DOWN DOWN_ALT FLOOR FLOOR_ALT

1.5256

2

1.52

1.52

1.52

1.52

-1.5256

0

-1

-1

-2

-2

12.8999...

0

12

12

12

12

12.8999...

1

12.8

12.9

12.8

12.9

12.8999...

2

12.89

12.90

12.89

12.90

-12.8999...

1

-12.8

-12.9

-12.8

-12.9

-12.8999...

2

-12.89

-12.900

-12.89

-12.90

-6.9990

2

-6.99

-6.99

-7.00

-7.00

-6.9990

3

-6.999

-6.999

-6.999

-6.999

7.999...

0

7

8

7

8

7.999...

1

7.9

8.0

7.9

8.0

7.999...

2

7.99

8.00

7.99

8.00

-7.999...

0

-7

-8

-8

-8

-7.999...

2

-7.99

-8.00

-8.00

-8.00

Rounding Using Different Modes

The aggregated effects of rounding on the final balance impact is determined by the mode and scale that you configure. The higher the scale, the less effect the rounding mode has on the final balance impact.

For example, Table 14-8 shows the impact of various rounding mode combinations for rating a usage fee of $1.1234567 that includes a 10% discount. Both rating and discounting use a scale of 6:

Table 14-8 Rounding Modes

Processing Stage (Rating and Discounting) Rating: Round DownDiscounting: Round Down Rating: Round DownDiscounting: Round Up Rating: Round UpDiscounting: Round Down Rating: Round UpDiscounting: Round Up

Round for rating

1.123456

1.123456

1.123457

1.123457

Calculate 10% discount

.1123456

.1123456

.1123457

.1123457

Round discounted amount

.112345

.112346

.112345

.112346

Apply discount to usage fee to get final balance impact

1.011111

1.011110

1.011112

1.011111

In this example, the difference in the final balance impacts is small because the scale is high and probably will not change the final amount on the bill. However, when many events are summed in an item, or the scale is small, such as 2 or 3, the differences become greater.

Note:

If you calculate the discount without rounding the event, the configuration where rating is rounded down and discounting is rounded up returns the most accurate result. Therefore, this is the best mode configuration to use when you discount events.

Modifying a Rounding Rule

To modify a rounding rule, you must change the rule in the pin_beid file and reload the file by running the load_pin_beid utility. See "Configuring Resource Rounding".