Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: SAS/C : -f8 + float + scanf = garbage Message-ID: <1991Apr8.101226.29522@kuhub.cc.ukans.edu> Date: 8 Apr 91 10:12:26 CDT References: <1991Apr3.220228.24727@athena.mit.edu> Organization: University of Kansas Academic Computing Services Lines: 35 In article <1991Apr3.220228.24727@athena.mit.edu>, hjj@athena.mit.edu (Hector Jimenez-Gonzalez) writes: > > I have the following problem with SAS/C V5.10: whenever I use the -f8 option > of "lc" (in order to use the M68881 coprocessor for floating point >calculations) and the object used in the "fscanf" or "scanf" is declared as a > float the value is read in incorrectly. If instead of float I use double > everything works correctly. As an illustration of this problem look at this > little program: > > float v; > > while(scanf("%f", &v) == 1) > printf("\t%f\n",v); > } > if this is now compiled with lc -f8 -Lm , the printed value does not Well, one problem is you are telling the compiler to link with the standard math library, although you've got 881 support in the object file, try: lc -f8 -Lm881 to get the correct library. It may be that SAS/Lattice "promotes" parameters differently or changes the default size of float with 881 support. > Hector Jimenez > hjj@athena.mit.edu -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~