LETTERS

The History of C

Dear DDJ,

In his April 1996 "C Programming" column, Al Stevens makes some guesses about the history of the C '\n' newline character and its different treatment in MS-DOS and UNIX. His guess about the behavior of the DecWriter is a good one, but unfortunately off base. The original DecWriter behaved the same way the Teletype behaved. The only reason I know of for the UNIX custom of using a single-byte line separator is to save bytes of memory and disk space.

Lloyd Miller

Calgary, Alberta

Canada

lloyd@lfmcal.cuc.ab.ca

Intel v. Schwartz

Dear DDJ,

I read with interest Jonathan Erickson's March 1996 editorial regarding the conviction of Randal Schwartz, and I think that some of the facts were missing.

The first count involved Mr. Schwartz placing a gate through Intel's firewall. This action violated company policy and the defendant had been told on three separate occasions that this violated policy; the last time he was told that if he wanted this gate he would need to obtain security clearance. Mr. Schwartz's response was to move the gate to a little-used lab computer in the SSD division of Intel (defendant's work no longer involved SSD). When questioned by the police, Mr. Schwartz said that he knew his actions were against Intel policy and "technically illegal," but he knew he could do it so he did.

Counts two and three charged the defendant with appropriating to his own use a password file and passwords (theft). Your editorial left out the fact that Mr. Schwartz was not a system administrator for the machine that he copied the initial password file from and then ran Crack against. Also, you do not mention that he then used one of the passwords as his own and entered an area of Intel (SSD) where he was not employed and copied that password file and ran Crack against it. The records showed that he had done this twice over a five-week span. [Mr. Schwartz] was not a systems administrator for any of the machines or password files that he ran Crack against and Mr. Schwartz told the police "I needed them in case they caught me doing it [gate] and I knew they would shut me down, so the more passwords I had, the longer I could continue doing what I wanted to do."

Thomas J. Tintera

Washington County Dist. Attorney's Office

Hillsboro, Oregon

tom_tintera@co.washington.or.us

Compact Logarithms

Dear DDJ,

The Turbo Pascal program in Example 1 is an alternative to that presented in "A Compact Logarithm Algorithm," by John K. DeVos (DDJ, March 1996). This program is a fixed-point implementation of approximation #2522 from Computer Approximations, by John F. Hart, et al. (John Wiley & Sons, 1968) and is scaled to preserve John's interface conventions.

My Table 1 presents error performance results for this program corresponding to those in Table 1 of John's article. They are typically about an order of magnitude better. The article's average absolute error is actually the average error. The correct average absolute error for log2K is 0.000237.

The timing for the John's log2K routine and my log2 routine was tested by generating 10,000 random numbers in the argument range and calling the function using an AT clone without numeric coprocessor. The average timing for the routines is corrected for driver overhead: log2K, 395 msec; log2, 180 msec. Note that some time is spent in log2K executing while (x j++);. The Hart book presents a number of useful approximations for elementary functions.

Adam Fritz

Afton, New York

Executable Content and Knuth

Dear DDJ,

There are two subjects on which I would like to comment.

I suspect that this example of prior art is a grey area where "the header" is not actually part of the message itself but is, in essence, the data set of a "common program" which is sent to remote sites and is acted on or executed there, at the many stages of the message switching route(s).

Historical note: This common program equipment was based on state sequencers made with relays and single diode ROMs (early logic gates). As they were processing and reprocessing linear paper tape, these stored-program computers were about as close to real life working Turing Machines as you could get.

I have soapboxed for many years that reputable computer scientists should get out of their cloisters and condemn bad practices or dangerous trendy fads when they erupt like poisoned mushrooms onto us hapless working programmers and our users.

For example, when many multitasking OSs were already around, who in the Ivory Tower Club spoke out against MS-DOS, where you needed to read four books on undocumented DOS features to implement a simple printer spooler. Its direct descendants also teeter on feet of undocumented clay.

Edgar Dystra, Nicholas Wirth, and Donald Knuth: All of us who hope to save our users from undeserved system crashes, or errors from whatever flavor OS or application, salute you.

Len Spyker

Karrinyup, Australia

redmond@iinet.net.au

VHDL Development Kit

Dear DDJ,

I appreciated Phil Tomson's article "VHDL for Hardware Design" (DDJ, June 1996). Readers might like to know that Cypress Semiconductor (1-800-858-1810) offers its "Warp2" VHDL product for a $100 or so, which seems like a deal to me. It comes with two manuals and includes an interesting tutorial, and seems to work fine on a 386/33 with 4 MBs of RAM running Windows 3.1 (it unfortunately crashed under Windows 95).

The "catch" of course is that output

from the product mostly supports various wonderful high-capacity Cypress products.

Nevertheless, as a learning tool it's still cheap, and the tutorial is based on the common 22V10 part, producing output which I could burn with standard PLD equipment (approximately $1000) into an Atmel ATF22V10B part.

J.G. Owen

Huntington Station, New York

71121.625@compuserve.com

Year 2000 and Counting

Dear DDJ,

Your recent coverage of the Year-2000 problem ("Editorial" in June 1996 and "Programming Paradigms" in July 1996) was timely and appropriate. TransCentury Data Systems, the company I work for, was one of the earliest companies to address the Year-2000 crisis. Our TransCentury Calendar Routines was launched in 1993. More recently, TransCentury has released a tool called the Date Logic Generator, which facilitates the process of creating (and testing) business date logic commonly used within financial systems. Included among our clients are Aetna Insurance, Motorola, and the U.S. Government Printing Office.

Raquel M. Alcaraz

San Francisco, California

http://www.transcentury.com

JavaScript Fix

Dear DDJ,

The code for the interactive questionnaire presented by Tom Tessier in his article "Sharing Data Between Web Page Frames Using JavaScript" (DDJ, May 1996) has a small bug. The link that is used to reset the page loads into the frame from which it is selected. Thus, every time you reset, the frame gets a slight bit smaller. This did not present a big problem with Tom's code, but when I modified the code to use two frames instead of only one with a hidden frame, it became a large problem. After much searching I found a Netscape addition to the <A> tag that fixes this problem. Use TARGET="_top" within the <A> tag. This reloads the page frames into the entire netscape window. The code looks like this: document.write ('<A HREF="index.html"TARGET="_top">

Return to the Main Page</A>').

Mark H. Burge

State College, Pennsylvania

74534.672@compuserve.com

Table 1: Compact logarithms.

Argument range tested:     3 to 32767
Highest relative error:     @ log2(4377) is 0.000195 percent
Lowest relative error:     @ log2(5) is -0.001393 percent   
Highest absolute error:     @ log2(16977) is 0.000024
Lowest absolute error:     @ log2(30873) is -0.000065
Average absolute error:     0.000024  
RMS absolute error:     0.000029

Example 1: Compact logarithms.

function log2 (x : integer) : longint ;
   { log2 @b14, x @b0 }
const
   p00 : longint = $B269C753 ; { @b29 }
   p01 : longint = $D266424D ; { @b29 }
   p02 : longint = $0000F660 ; { @b14 }
   q00 : longint = $00003FFE ; { @b15 }
   q01 : longint = $00016CBD ; { @b15 }
 { q02 : longint = $40000000 ;   @b30 }
var
   ex : longint ;              { exponent @b14 }
   xn : longint ;              { x normalized @b15 }
begin
                               { normalize x }
   ex := $0003C000 ;
   xn := longint(x) ;
   while (xn and $4000) = 0 do begin
      ex := ex - $4000 ;
      xn := xn shl 1    end ;

                               { compute log2 @b14 }
   log2 := ex + (((p02*xn + p01) shr 15)*xn + p00) div
                 (((xn + q01)*xn shr 15) + q00)

end ;