Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site amdahl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!amdahl!canopus From: canopus@amdahl.UUCP (Frank Dibbell) Newsgroups: net.sources Subject: Fix to Comet Halley program Message-ID: <1390@amdahl.UUCP> Date: Thu, 11-Apr-85 12:56:20 EST Article-I.D.: amdahl.1390 Posted: Thu Apr 11 12:56:20 1985 Date-Received: Sat, 13-Apr-85 04:28:12 EST Distribution: net Organization: Amdahl Corp, Sunnyvale CA Lines: 40 Alas, a small bug was discovered in the Halley's Comet progam which I posted last week. The program works fine for every year but 1986! For 1986, it will give random results. To fix the problem, make the following change: In the section titled: /* CALCULATE COMET POSITION */ change from: if (Y > 1986) Z = 1984, S = 0; change to : if (Y >= 1986) Z = 1984, S = 0; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * All of our systems have different attributes, and its difficult, if not impossible, to produce a single version of a program that will run on everyone's machine. With this in mind, I will pass along some helpful hints supplied to me by others, when dealing with halley.c: 1. Some systems require the following include to define "tolower()": #include 2. On some systems the "tolower()" function is defined only for upper case. In order to exit the halley program, then, the following code modification will be required: change from: if (c = (tolower(getchar())) != 'x') continue; else break; change to : c = getchar(); if (isupper(c)) c = tolower(c); if (c != 'x' ) continue; else break; If anything anything else pops up, I'll probably put it into net.sources.bugs where it belongs! -- Frank Dibbell (408-746-6493) {whatever}!amdahl!canopus [R.A. 6h 22m 30s Dec. -52d 36m] [Generic disclaimer.....]