heff@flnexus.ATT.COM (Paul K Heffner) (06/18/87)
A couple of people at our site have invested in Turbo C and seem generally pleased with the package as a really serious compiler (especially for the price). It does, however, seem to have a serious bug with the floating point division routines. If your program does division on two constants: float x; x = 5.0/4.0; The result will be as if the division was inverted (i.e x = 4.0/5.0) Spencer Katt commented on this in PC Week this week. If you're using Turbo C for serious programming, you should exercise caution if doing such calculations. (I assume Borland is working on a fix....) Paul Heffner, AT&T, Orlando
robj@ur-tut.UUCP (Bob Johnson) (06/19/87)
My copy of Turbo C arrived yesterday. I tried the exercise that Katt said would fail, but mine gave the right answer. I didn't have much time, but I played with a few floating divisions with both hardware and software 8087 options set, and got the right answer for each test. Maybe an early distribution bug?
darrylo@hpsrlc.HP.COM (Darryl Okahata) (06/19/87)
In comp.sys.ibm.pc, heff@flnexus.ATT.COM (Paul K Heffner) writes: > A couple of people at our site have invested in Turbo C and seem generally > pleased with the package as a really serious compiler (especially for > the price). It does, however, seem to have a serious bug with the floating > point division routines. If your program does division on two constants: > > float x; > > x = 5.0/4.0; > > The result will be as if the division was inverted (i.e x = 4.0/5.0) > > Spencer Katt commented on this in PC Week this week. If you're using > Turbo C for serious programming, you should exercise caution if doing > such calculations. (I assume Borland is working on a fix....) > > Paul Heffner, > AT&T, Orlando > ---------- Borland has had a fix for this for a few weeks now. I really wonder about the publishing lead time for PC Week (I like to call it "PC Leak"), as the Turbo C compilers that you can buy right now have the bug FIXED. I bought my copy of Turbo C about THREE WEEKS ago, and it had this bug fixed. What I don't like is that Borland doesn't change the revision number if a bug gets fixed; one version of Turbo C V1.00 may have a bug fixed, while another V1.00 version may still have it. The only way to tell the compilers apart is to look at the file modification date, which gets trashed if someone patches their compiler. Borland has issued a few DEBUG.COM-type patches (which have to be applied manually -- ugh!) to fix bugs like this floating-point bug, and a few others. Unfortunately, they make these patches available on Compuserve, which many people here, I believe, do not have access to. -- Darryl Okahata ... hplabs!hpcea!hpsrla!darrylo Disclaimer I: the above is the author's personal opinion and is not the opinion or policy of his employer or of the little green men that have been following him all day. Disclaimer II: I have no connections with Borland, other than being a mostly satisfied customer.
jpn@teddy.UUCP (John P. Nelson) (06/23/87)
>It [Turbo C] does, however, seem to have a serious bug with the floating >point division routines. If your program does division on two constants: > >float x; > >x = 5.0/4.0; > >The result will be as if the division was inverted (i.e x = 4.0/5.0) And here is the patch. Apparently only the earliest copies are afflicted with the bug. Enjoy. PRODUCT : TURBO C VERSION : 1.0 OS : PC-DOS DATE : MAY 20, 1987 PAGE : 1/2 TITLE : FLOATING POINT EVALUATION - PATCH The following patch solves a problem with dividing floating point evaluation. To apply this patch, you will need to use the DOS utility DEBUG.COM. You may obtain a copy of DEBUG.COM from one of your original PC-DOS or MS-DOS diskettes. NOTE: 1. Do not patch your original Turbo C disk, use a working or backup copy of TCC.EXE and TC.EXE for this patch. 2. DEBUG is not sensitive to upper and lower case. All ad- dresses are listed in upper case for ease of readibility. 3. XXXX,YYYY,ZZZZ are hexidecimal digits returned by DEBUG. You must replace these digits accordingly when typing in your commands. 4. While in DEBUG, the prompt will appear as a dash (-). 5. If you do not receive the appropriate response,press "q" followed by <Enter>, to exit from DEBUG. Check your version number and, if correct, try again. 6. TCC.EXE and TC.EXE will not fit together onto a 360K disk. To patch both programs on a floppy disk, you may need to copy TCC.EXE and DEBUG.COM onto one disk and perform the patch. Save the patched version of TCC.EXE to another disk. Repeat the same steps using TC.EXE. At the DOS prompt, type the following information exactly as it appears (Conclude each line by pressing <Enter>). PRODUCT : TURBO C VERSION : 1.0 OS : PC-DOS DATE : MAY 20, 1987 PAGE : 2/2 TITLE : DIVISION OF CONSTANTS - PATCH Patch for TCC.EXE Type the following: You will see: ren tcc.exe tcc.xex<Enter> A> debug tcc.xex<Enter> - r<Enter> ... CS=XXXX ... - h XXXX 2420<Enter> YYYY ZZZZ - e YYYY:369<Enter> YYYY:0369 0A. 6<Enter> - e YYYY:36F<Enter> YYYY:036F 06. A<Enter> - w<Enter> Writing 2948A bytes q<Enter> A> ren tcc.xex tcc.exe<Enter> Patch for TC.EXE Type the following: You will see: ren tc.exe tc.xex<Enter> A> debug tc.xex<Enter> - r<Enter> ... CS=XXXX ... - h XXXX 2D01<Enter> YYYY ZZZZ - e YYYY:35E<Enter> YYYY:035E 0A. 6<Enter> - e YYYY:364<Enter> YYYY:0364 06. A<Enter> - w<Enter> Writing 38759 bytes q<Enter> A> ren tc.xex tc.exe<Enter>