Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!hjj From: hjj@athena.mit.edu (Hector Jimenez-Gonzalez) Newsgroups: comp.sys.amiga.programmer Subject: SAS/C : -f8 + float + scanf = garbage Keywords: SAS C scanf Message-ID: <1991Apr3.220228.24727@athena.mit.edu> Date: 3 Apr 91 22:02:28 GMT Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 31 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: #include #include #include main() { 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 correspond to the input. Changing float to double and %f to %lf in "scanf" the problem goes away. Has anyone else noticed this problem? If not, could this be harware related? (I am using an A2500/20). Hector Jimenez hjj@athena.mit.edu