Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/04/06 07:54
Read: times


 
#115537 - Something like this
Responding to: ???'s previous message
If the two dates are:

date1: Y3 Y2 Y1 Y9 M1 M0 D1 D0
date2: y3 y2 y1 y9 m1 m0 d1 d0

Where Y3 is the most-significant digit of the year, etc
IF Y3 > y3
THEN comparison is complete - date1 is the greater
ELSE IF Y3 < y3
     THEN comparison is complete - date2 is the greater
     ELSE most-significant digits are the same; try the next-most-significant
etc, etc,...

Exactly the same approach can be used if 2 BCD digits are packed into 1 byte:

date1: Y3Y2 Y1Y9 M1M0 D1D0
date2: y3y2 y1y9 m1m0 d1d0

Where Y3Y2 is the most-significant digit pair of the year, etc

IF Y3Y2 > y3y2
THEN comparison is complete - date1 is the greater
ELSE IF Y3Y2 < y3y2
     THEN comparison is complete - date2 is the greater
     ELSE most-significant digits are the same; try the next-most-significant
etc, etc,...

It even works if the digits are ASCII-coded characters..

List of 7 messages in thread
TopicAuthorDate
BCD magnitude comparisons !            01/01/70 00:00      
   This or that            01/01/70 00:00      
      No conversion necessary!            01/01/70 00:00      
         Something like this            01/01/70 00:00      
            RE: Something like this            01/01/70 00:00      
         Because            01/01/70 00:00      
   Julian date?            01/01/70 00:00      

Back to Subject List