On Tue, 7 Oct 1997, Rich Chiavaroli wrote: > On Tue, 7 Oct 1997, George wrote: > > > This is doing integer division and an integer cannot store .1 > > Try 10.0 / 100.0, you will be dividing two floats there. > > Ahha.. so I would have to cast variables as floats for it to work? If those variables were ints, yes. so: int a = 10, b = 100; float answer; answer = a / b; will give the answer 0. however, answer= (float) a / (float) b; Will provide the answer 0.1. You will probably be able to get away with just one of the variables being cast explicitly to (float). (See K&R's C Primer) -- Kenneth G. Cavness ph#:+1-301-767-0977 | mailto:kcavness@proxicom.com +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST