Re: [C]

From: Kenneth G. Cavness (kcavness@PROXICOM.COM)
Date: 10/07/97


On Tue, 7 Oct 1997, Rich Chiavaroli wrote:

> Just a short question here about floats with ANSI C on AIX.
>
> This is an example of something I was trying to do.
>
> float a;
>
> a = 10 / 100;

(int) / (int) always returns (int).


Most compilers nowadays will also see two literals and do the math before
linking, so that that simple conversion doesn't need to be done more than
once.

What you want is

a = 10.0 / 100.0;

--
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