Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.advocacy Subject: Re: More Funny Stuff From Joel Date: 17 Jun 2024 04:25:50 GMT Lines: 57 Message-ID: References: <66699f8c$0$966$882e4bbb@reader.netnews.com> <666b0963$0$985$882e4bbb@reader.netnews.com> <666b43c2$0$966$882e4bbb@reader.netnews.com> <666c4979$0$2363133$882e4bbb@reader.netnews.com> <666c8888$0$7063$882e4bbb@reader.netnews.com> <2qtu6jdgrvmbrrcl5on1iec130l8q660jo@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net 7hjP5Qrg98t3AbChm0ehEwIT/TdI1tcBHgW6ffjyUyKg4F7l/U Cancel-Lock: sha1:wOd7HFFMrBgpYf/yC+jj6y0QYZM= sha256:GQNeqSyp+rrk2seE1urGz2eLriRmCDSHvOH1rl6QjSU= User-Agent: Pan/0.149 (Bellevue; 4c157ba) Bytes: 3462 On Sun, 16 Jun 2024 18:47:00 -0500, chrisv wrote: > Believe it or not, I realize that some software "bugs" get past warnings > and errors and testing, and make it into "released" code! I fixed a three year old bug last week that didn't throw warnings and made it past testing. if (x != last_x && y != last_y) { do some initialization } The intent was to avoid an expensive PIP search if the passed in x/y matched the previous search. There is nothing syntactically wrong with the statement and it avoided the duplication on the same address x/y. An address with a different x/y would be initialized. However, if you ran two addresses with the same y back to back the second address would return the polygon information for the first. With three years and who knows how many addresses on multiple sites, I'd give it at least a one in a million. I've fixed bugs that were over 20 years old. Bad implementation, but nothing a compiler would pick up and a very limited number of edge cases that would trigger the bug. Back at Lunar Lander: https://www.technologizer.com/2009/07/19/lunar-lander/ I downloaded the Vintage BASIC package and the 1969 version and it does run. For kicks I decided to do a Python version. I forgot how hideous BASIC was. A snippet: 140 A=120:V=1:M=33000:N=16500:G=1E-03:Z=1.8 150 PRINT L,INT(A);INT(5280*(A-INT(A))),3600*V,M-N,:INPUT K:T=10 160 IF M-N<1E-03 THEN 240 170 IF T<1E-03 THEN 150 180 S=T: IF M>=N+S*K THEN 200 190 S=(M-N)/K 200 GOSUB 420: IF I<=O THEN 340 210 IF V<=0 THEN 230 220 IF J<0 THEN 370 230 GOSUB 330: GOTO 160 240 PRINT "FUEL OUT AT";L;"SECONDS":S=(-V+SQR(V*V+2*A*G))/G ............ 420 Q=S*K/M: J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5) 430 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30):RETURN At least there are no computed GOTOs. I forget if BASIC had those or if it was a FORTRAN thing. If you're really perverted you can set up an array of function pointers in C to do it. This should be right up Dufus' line with all the math. Meanwhile I may try to figure out what the hell it's doing. I don't know if this version has the divide by 2 bug or not. Spreading out the polynomial might help. For added obfuscation 420 has Q*Q and 430 has Q^2.