Devon,

You could include an 'E' case to your rounding - I discovered it 
during years of mining phone bills when my organization was 
making >500k calls per month (making it well worth analysis - for 
which j was a wonderful tool!) I found several phone companies whose 
"rounding" algorithm was simply ceiling. That is, if a call should 
have cost 8.1 cents, they would bill it at 9 cents.  Reasonable 
companies (e.g. AT&T) kept accuracy by using 10000*cents for the 
stored call charge - but carriers who outsourced their billing to EDS 
for processing got the benefit of what I dubbed "Ross Perot 
rounding". (hence my suggestion of an 'E' case).

In our case, I sometimes asked for refunds around $3,000 per month 
because of this rounding error - that made working on analyzing the 
bill well worth while. What boggled my mind was that I had the 
incentive (and the data on both sides of the calls) to dig into this 
- but our few 100k calls was spit in the ocean compared to the 
general public who collectively made many more calls. It is a lot 
like the old chestnut of rounding down on savings account interest - 
nice profit for not much work....



At 08:43  -0400 2009/03/16, Devon McCormick wrote:
>Any simple "round to integer" will do.  Mine is more elaborate but
>unnecessary for this example:
>
>roundNums=: 3 : 0"1 0
>NB.* roundNums: round numbers y to precision x, e.g.
>NB. 0.1 roundNums 1.23 3.14159 2.718 -> 1.2 3.1 2.7.
>NB. Optional 2nd left argument is single letter specifying
>NB. type of rounding: Up, Down, or Banker's.  Default
>NB. banker's rounding (round halves up or down depending on
>NB. parity of next (scaled) digit) tends to randomize bias.
>    1 roundNums y
>:
>    RT=. 'B'                  NB. Default to Banker's rounding
>    TO=. x                   NB. Precision to which to round.
>    if. (2=#x)*.1=L. x do. 'TO RT'=. x end.
>    scaled=. y%TO            NB. For Banker's: round down if last digit even,
>    select. RT
>    case. 'B' do. RN=. 0.5*(0~:2|<.scaled)+.0.5~:1|scaled   NB. up if odd.
>    case. 'D' do. RN=. (0.5=1|scaled){0 _0.5       NB. Round halves down.
>    case. 'U' do. RN=. 0.5                         NB. Round halves up.
>    end.
>    TO*<.scaled+RN
>)
>
>
>On Sun, Mar 15, 2009 at 11:21 PM, Bill Harris <
>[email protected]> wrote:
>
>>  Bill Harris <[email protected]> writes:
>>
>>  > Devon McCormick <[email protected]> writes:
>>
>>  >>    BGYPAL3=: roundNums |:BGYPAL3
>>  >
>>  > Tips as to what roundNums is?
>>
>>  Something like 1 & round perhaps? :-)
>>
>>  Bill
>>  --
>>  Bill Harris                      http://facilitatedsystems.com/weblog/
>>  Facilitated Systems                              Everett, WA 98208 USA
>>  http://facilitatedsystems.com/                  phone: +1 425 337-5541
>>  ----------------------------------------------------------------------
>>  For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
>--
>Devon McCormick, CFA
>^me^ at acm.
>org is my
>preferred e-mail
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to