Doubtful its a compiler bug.  I used other development systems that required
the same thing.  I use double extensively in most of my apps, so I try to
always type cast when working with mixed types.  Habit I guess.

Try using defines for type casting to help make your code easier to read
(and debug)
i.e.
#define F(x) ((float)(x))
#define D(x) ((double)(x))

int a = 20;
float b = 30.0;
float c;

c = F(a) * b;

----- Original Message -----
From: "Richard Anderson" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 9:30 AM
Subject: RE: unsigned float?


> Ive come accross some issues with floats and casting etc. Make sure you
add
> a float part as said before ie not 10 but 10.0. Also if you cast anything
to
> floats in a equation make sure you bracket everthing up to the point of
> being over the top. I cant exactly remember the problem but i think it was
> somthing like this:
>
> int a = 20;
> float b  = 30.0;
> float c;
>
>
> c = (float)a * b;    but the calculation was done in integer, and
> then cast to a float
>
> I solved it by
>
> c = ((float)a) * b;
>
> this may of not been the exact senario, but it was something like this
with
> the casting. Compiler Bug ???
>
> Regards,
>
> Rik
>
> > -----Original Message-----
> > From: Dave Lippincott [SMTP:[EMAIL PROTECTED]]
> > Sent: 19 July 2001 14:16
> > To: Palm Developer Forum
> > Subject: Re: unsigned float?
> >
> > You definitely have a bug in your code.  As already pointed out, 32768
is
> > well within the range of a double or even float.
> >
> > ----- Original Message -----
> > From: "JF" <[EMAIL PROTECTED]>
> > Newsgroups: palm-dev-forum
> > To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 18, 2001 10:06 PM
> > Subject: Re: unsigned float?
> >
> >
> > > Oh and I tried it as a double, which I know is 8 bytes, but it STILL
> > > basically turns negative after 32768 ( 8 ^ 5)... Any ideas??
> > >
> > > Thanks,
> > > Jason
> > >
> >
> >
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palmos.com/dev/tech/support/forums/
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to