Path: chuka.playstation.co.uk!news From: Nick Slaven Newsgroups: scee.yaroze.programming.codewarrior Subject: Re: float and integer trouble Date: Fri, 12 Jun 1998 00:44:53 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 32 Message-ID: <35806BF5.1479FC36@compuserve.com> References: <358043B8.19F1@cs.bham.ac.uk> NNTP-Posting-Host: ld36-170.lon.compuserve.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) Steve Randerson wrote: > > I seem to be having a bit of trouble with integers and floats. I'm a > Java programmer normally and don't have much experience with C so it may > be me being crap but anyway. whenever I try any arithmetic involving a > float and an integer i get errors from codearrior. it compiles fine but > has a linker error saying it can't find _f_ftoi. > I presume it is legal to add a float aand an int otherwise it would > have a compiler error. I've tried searching all the header files to see > if I can find ftoi but i can't. > If anyone has any suggestions, or what i'm trying is just not possible > then any help would be much appreciated. > > cheers steve Sounds like a library problem to me, have you specified all the libs you need? I think there is an extra maths lib you have to link in if you want to use floating point arithmatic. (ftoi will be a "float to int" function call generated by the compiler & the only place it will be defined is inside a library) & yes its perfectly legal in C to mix all the variable types you like in calculations (including pointers!). Cheers Nick -- http://www.netyaroze-europe.com/~nslaven/