Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!ncsuvx!ece-csc!ncrcae!hubcap!disd From: disd@hubcap.clemson.edu (BJ Backitis) Newsgroups: comp.sys.amiga Subject: Manx and floats Message-ID: <5135@hubcap.clemson.edu> Date: 17 Apr 89 16:11:46 GMT Distribution: na Organization: Clemson University, Clemson, SC Lines: 60 I don't think this qualifies for .tech. It's probably just a misapprehension of either the Manx docs or the C language (or both). Yesterday, for the first time, I decided to use floating point numbers with the Manx compiler. (I know, "Ick! You *want* to use floats?") Never mind why, I just do. Anyway I read in the documentation that in order to use floats, one must compile using the +f option. +ff for FFP, and +fi for IEEE. Then you must link using the appropriate math library. (Though it isn't clear which libraries are appropriate for which options.) Well the docs make mention of an mx.lib. Mx.lib doesn't exist in my LIB directory. The on-disk release notes say that the mx.lib's were removed for rel 3.6a, but they don't say what is intended to replace them. Anyway, to my problem. I have need to convert text of the following sort, " 2.78 \n", to the corresponding floating point value. "Okay", says I, "I'll just use sscanf." Right. So I added something similar to the following to my code: char text[80]; float number; /* We do an fgets to get the digits from a file and put them to 'text' */ /* Why *does* fgets return the string *plus* the newline character? */ /* then .... */ sscanf(text,"%f",&number); I compiled the program using either one of the +f flags and linked using the following: ln -g [.o files here] -larp -l["appropriate" math lib here] -lc Now according to SDB, text is indeed " 2.78 \n", but number does not get converted to the floating point equivalent. I played around with sscanf a little using an integer variable just to see if sscanf would work with ints. (SDB makes for a wonderful C interpreter. :-) It converted text to 2 and stored it in the int variable just so. So sscanf works as advertised, but something needed for proper float use is missing. Does anyone have any suggestions? ("Buy Lattice 5.02." or "Wait for Manx 5.0" are not acceptable suggestions. :-) Am I using proper procedure? What exactly are the correct math libraries for floats? Am I accidentally getting a sscanf from the arp.lib? And will Justine divorce Brad? Thanks, Gary (seasoned Amigan, seasoned programmer, apprentice C programmer) -- Frank J. ("BJ") Backitis,Jr. -- Information Systems Development (aka KB4VSW) Clemson University, Clemson, SC Question authority ... but make sure to raise your hand first.