Accurate Identification

Accurate Identification

Post by Gary L. Smi » Mon, 28 Jul 1997 04:00:00



: If all Y2K code could be accurately and readily identified, how difficult
: would it be to develop an automated tool that would correct all Y2K errors
: with either century windows or four digit year expansion?

Based on my limited experience so far, correction is orders of magnitude more
complex than detection.  Of the eleven modules I've corrected in the last
couple of months, there was only one situation where the same change
applied to two modules.  I believe that others in our organization with
larger Y2K responsibilities are getting similar results.

--



 
 
 

Accurate Identification

Post by Eric Buckle » Tue, 29 Jul 1997 04:00:00



> If all Y2K code could be accurately and readily identified, how difficult
> would it be to develop an automated tool that would correct all Y2K errors
> with either century windows or four digit year expansion?

Have a go at this one:

        days = (!(year|3) && year) ? 29 : 28;

Is the year 2 or 4 digit?
Assuming it is 2 (the code makes no sense otherwise), how do propose to
fix the algorithm (the error has nothing to do with the year
representation)?

I don't think an automated process could answer the first question. The
second question would not even be asked.

Let's try another:

        display.year = year % 100;
        t.tm_year = year % 100;

How is this process to know that the first is fixed by:

        display.year = year;

and the second is fixed by:

        t.tm_year = year - 1900;

In short, you have to have an intelligent set of eyes looking at these
pieces of code. An automated process could easily leave these examples
in worse shape than they started. Incidentally, if you think these
examples are contrived, it's time you started reviewing some code.
________________________
Eric Buckley
Comsys Millenium Services
eMail: remove NoSpam from above
Standard disclaimer - I speak for myself and nobody else.

 
 
 

Accurate Identification

Post by Robert Hellma » Thu, 31 Jul 1997 04:00:00





>> If all Y2K code could be accurately and readily identified, how difficult
>> would it be to develop an automated tool that would correct all Y2K errors
>> with either century windows or four digit year expansion?

>Have a go at this one:

>    days = (!(year|3) && year) ? 29 : 28;

I think you meant:
        days = (!(year&3) && year) ? 29 : 28;

The expression !(year&3) is true if both of the least significant 2 bits
are both 0.  Or more simply, the year is evenly divisible by 4.  If that
is true and year is non-zero, days is 29.  Otherwise, it's 28.  As
previously mentioned in this group, the year 2000, will be a leap year,
so it's broken in that way too.

Of course, this code is so convoluted that it's understandable
how the mistake was made.

 
 
 

Accurate Identification

Post by Eric Buckle » Thu, 31 Jul 1997 04:00:00




> >       days = (!(year|3) && year) ? 29 : 28;

> I think you meant:
>         days = (!(year&3) && year) ? 29 : 28;

Yes, I did mean &. It's not the first time I've goofed up code on a NG
post (kind of hard to test it.)

Quote:> Of course, this code is so convoluted that it's understandable
> how the mistake was made.

I would never actually write something like that. But I know others who
would and would be proud of it. Our overworked "Stupidity" thread is
essentially a defense of this type of hack. Experienced programmers
clean up the mess these clever newbies leave behind.

________________________
Eric Buckley
Comsys Millenium Services
eMail: remove NoSpam from above
Standard disclaimer - I speak for myself and nobody else.

 
 
 

Accurate Identification

Post by Steve Dove » Fri, 01 Aug 1997 04:00:00



> Have a go at this one:
>         days = (!(year|3) && year) ? 29 : 28;
> Is the year 2 or 4 digit?
> Assuming it is 2 (the code makes no sense otherwise), how do propose to
> fix the algorithm (the error has nothing to do with the year
> representation)?
> I don't think an automated process could answer the first question. The
> second question would not even be asked.
> Let's try another:
>         display.year = year % 100;
>         t.tm_year = year % 100;
> How is this process to know that the first is fixed by:
>         display.year = year;
> and the second is fixed by:
>         t.tm_year = year - 1900;

> In short, you have to have an intelligent set of eyes looking at these
> pieces of code. An automated process could easily leave these examples
> in worse shape than they started. Incidentally, if you think these
> examples are contrived, it's time you started reviewing some code.

Excellent examples Eric!
This is where an SB tool could really*you up after The Day.
There are only two tools that can handle this type of problem,
a software tool written by a good programmer to help *find* the
code that needs work, and the other main tool called your brain.
Anything else is suspect.

Cheers,
Steve

 
 
 

1. Accurate floating point numbers?

Hi there,

I tried to implement the algorithm from "How to Print Floating Point Numbers
Accurately" from Guy Steele and Jon L. White (ACM SIGPLAN '90 pp112-126).
After long debugging I came to the conclusion that the algorithm has a problem
with the detection of rounding up early enough when using fixed precision.

Does anyone know something about problems with that algorithm? Some Modula 3
libraries refer to the article, but I couldn't find any sources.

Holger Klawitter

--
Holger Klawitter <*>                 Putting a computer in front of a child and
Intern. Computer Science Inst.      expecting it to teach him is like putting a
(510) 643 9153 x. 116               book under his pillow, only more expensive.
http://www.icsi.berkeley.edu/~holger                                --Anonymous

2. Drums

3. How accurate is tuning for a typical soundcard/PC combination?

4. what the heck was that msg "Re: let's arrive in the think plains..."

5. Which Microphone most accurate- if NO backgraound noises?

6. exp(-0.2s)

7. Voice Recognition: Accurate?

8. mvsound.sys in 2.1 GA + MMPM

9. ACEXML classes make accurate XML error reporting difficult

10. Timers not accurate on Win32

11. Electric self-reporting accurate

12. Re; Yeah, The NERC Report Was Accurate............

13. Shortest, Oldest, Accurate Date Algorithms Listed Here