Browse Prior Art Database

Rounding of Values that Consist of Multiple Units

IP.com Disclosure Number: IPCOM000119158D
Original Publication Date: 1997-Dec-01
Included in the Prior Art Database: 2005-Apr-01
Document File: 2 page(s) / 54K

Publishing Venue

IBM

Related People

Yorke-Smith, IE: AUTHOR

Abstract

Rounding a value which consists of multiple units using the conventional rounding method can be a slow and complex process, especially if the units use different bases. An example of such a value is date-time with format: YEAR/MONTH/DAY HOUR:MINUTE:SECOND.HUNDREDTH-SECOND

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 53% of the total text.

Rounding of Values that Consist of Multiple Units

      Rounding a value which consists of multiple units using the
conventional rounding method can be a slow and complex process,
especially if the units use different bases.  An example of such a
value is date-time with format:
  YEAR/MONTH/DAY HOUR:MINUTE:SECOND.HUNDREDTH-SECOND

      Rounding this to the second, for example, could result in all
the higher order units (even as far as the year) being updated.  For
example:
         1997/12/31 23:59:59.73
         rounded to the nearest second results in
         1998/01/01 00:00:00.00

      Described is a simple and fast way of rounding such values by
avoiding the generation of a carry which is sufficiently accurate for
many applications.

      Using time (HH:MM:SS.HH) as an example, the following
definitions are established:
  1.  A value is made up of multiple units (e.g., time is made
       up of hours, minutes, seconds and hundredths of a second).
  2.  The unit being rounded is affected by the lower order units
       (e.g., rounding to one second is affected by the hundredths
       of a second).

      The algorithm described below is for the rounding up case, with
time being used as an example:
  1.  If the unit being rounded is at its maximum value, then
       ignore the value of the units below and set them to zero,
       if appropriate.
        For example, rounding 10:59:59.57 to the nearest second
       results in 10:59:59.00.  Compare this with conventional
       rounding which would have results in carries and prod...