Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!panews!ibmpa.awdpa.ibm.com!eclarke From: eclarke@ibmpa.awdpa.ibm.com (Eric S. Clarke) Newsgroups: comp.sys.ibm.pc.misc Subject: Re: Borland C++ and Floating Point Math Message-ID: <1991Apr17.100203@ibmpa.awdpa.ibm.com> Date: 17 Apr 91 17:02:03 GMT References: <14197@ccncsu.ColoState.EDU> <1602@msa3b.UUCP> Sender: news@ibmpa.awdpa.ibm.com (news id) Reply-To: eclarke@ibmpa.awdpa.ibm.com (Eric S. Clarke) Organization: IBM Advanced Workstations Division, Palo Alto Lines: 62 In article <1602@msa3b.UUCP>, mgphl@msa3b.UUCP (Michael Phillips) writes: |> sharif@lamar.colostate.edu (Thomas Abdallah) writes: |> |> >Okay, It's about time to begin pulling hair out ! |> |> >I've been fighting with Borland's C++ v2.0 trying to get it to handle |> >floating point numbers. The manual specifically states that : |> |> > "The default Borland C++ code generation option is emulation |> > ^^^^^^^ |> > (the -f command-line compiler option). This option is for |> > programs that may or may not have floating point, and for |> > machines that nay or may not have an 80x87 math coprocessor." |> |> > -Borland C++ Programmers Guide, p.220 |> |> >When I use the BUILD option I can see the stupid thing compile my program |> ???????? |> >and then actually read the EMU.LIB file during its link phase. Now when |> >I try to go back and [rest deleted] |> |> You say "build" ? I assume then that you are compiling from the IDE, |> please check "OPTIONS" --> "Code generation" --> "more" and insure |> that the "project file" (or default, if no prj is active) specifies |> "floating point emulation" and not "none". I believe that the TLINK.CFG |> is NOT used by the IDE. I read the original post with interest because I was having some floating point problems myself. I am not sure if the problem you are having is the same as the one that I had, but here is the solution to mine. I was reading some floating point numbers from a file with fscanf. The program compiled fine, I too could see that the EMU.LIB file was being linked. But, when I ran the program the first time it hit the fscanf with the %f format, it would abort. The message stated that "floating point formats not liked." After waiting on hold for some length of time, a very helpful person at Borland explained the problem. The compiler is too smart for its own good. Those are my words, not those of the person at Borland. It seems that TC++ and BC++ decide if floating point routines need to be linked into the package based on some magic cookies. My program only read the floating point numbers and then wrote them back to a file with out actually manipulating them. So the compiler decided that I didn't need any floating point routines. To solve this just add to lines to the program. float foo, *junk; junk = &foo; The program now runs just fine. The person at borland said he would add my name to the list of people that have requested 1) Documentation about this feature and 2) A method of neatly overriding the feature. -- Eric S. Clarke INTERNET: eclarke@ibmpa.awdpa.ibm.com 1510 Page Mill Road UUCP: uunet!ibmsupt!eclarke Palo Alto, CA 94304 IBM VNET: ECLARKE at AUSVMQ 415-855-4458 T/L: 465-4458