Browse Prior Art Database

# Numeric Field Compare Algorithm

IP.com Disclosure Number: IPCOM000087246D
Original Publication Date: 1977-Jan-01
Included in the Prior Art Database: 2005-Mar-03
Document File: 1 page(s) / 12K

IBM

## Related People

Byrum, JC: AUTHOR [+4]

## Abstract

Unformatted numeric fields, including alphabetic characters, such as dollar signs and commas, are compared for sorting and qualifying purposes without time-consuming conversion of the fields to binary numbers.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 91% of the total text.

Page 1 of 1

Numeric Field Compare Algorithm

Unformatted numeric fields, including alphabetic characters, such as dollar signs and commas, are compared for sorting and qualifying purposes without time-consuming conversion of the fields to binary numbers.

All of the numeric fields are normalized during an initial scan of each of the fields. During the scans, each alphabetic character and leading zero is removed and a count of significant digits is developed representative of the number of digits encountered before either a period (decimal point) is encountered or the end of the field is reached. A hyphen associated with a field indicates that the number in the field is negative. The fields are then ready for comparison. Examples of the result of the initial normalizing scans are shown below:. Original Number Significant Digits Normalized Number

2.34 1 234

10.25 2 1025

.023 0 023

\$10 2 10

10.0 2 10

010. 2 10

The significant digit counts are compared first. If they are equal, the compare proceeds to the normalized numbers, which are compared character-for- character until a determination of greater than, equal to, or less than is made.

The comparison of signed fields is as follows: If both fields are positive (not negative), the comparison proceeds as described immediately above. If field A is positive and field B is negative, A is greater than B and no further comparison is necessary. If both fields are negative, the comparison proceeds as described above for the case in which...