Re: Confused about floats
Re: Confused about floats
- Subject: Re: Confused about floats
- From: Scott Ribe <email@hidden>
- Date: Tue, 5 Oct 2010 11:25:35 -0600
On Oct 5, 2010, at 11:18 AM, Amy Heavey wrote:
> I changed it to > 299 and voila it worked. I did also have to (is the term cast?) the 299 to a float.
Yes, the term is "cast".
No you didn't need to cast 299 to a float. It's not wrong to do so, just unnecessary. (And, if you care, you could instead just write 299.0, or 299f, or 299.0f.)
You could also just use if( x >= 300 ).
If you were using fractional pixels anywhere, you'd want x = 0 instead of x = x-300, so that rounding errors would not accumulate.
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden