A92: Re: What the heck is wrong with this?!


[Prev][Next][Index][Thread]

A92: Re: What the heck is wrong with this?!




In a message dated 8/18/99 4:49:19 PM Eastern Daylight Time, 
Adam.Kutell@OmegaResearch.com writes:

> I haven't used TIGCC, although I have used GCC before, so I might be able to
>  answer your question.
>  The example (which works) you multiplied a floating-point value by another
>  floating-point value, and an automatic cast was given to the copy (equal)
>  operator.  However, in both of your examples which don't work, you 
attempted
>  to multiply an integer by a float.  In most modern compilers, this is
>  normally allowed, but it seems you must link with a special library to make
>  it work in TIGCC.  You might want to try the following type-casts, and see
>  if it works (for your two examples):
>  
>          key2 = (int)(3.8 * (float) key);
>      or
>          key2 = (int)((double) 3.8 * (double) key);
>  
>  and
>          a = (int)(((float)a) * 3.8);
>      or
>          a = (int)(((double)a) * (double)3.8);
>  Adam
>  

l've tried those, and it gives errors about parse errors after int, etc.  How 
can l get an int value after multiplying an int var by a float?  or even a 
float var by a float, which doesn't work either.