Re: [iPhone] Floating Point numbers with .f and without .f Suffix
Re: [iPhone] Floating Point numbers with .f and without .f Suffix
- Subject: Re: [iPhone] Floating Point numbers with .f and without .f Suffix
- From: Rick Mann <email@hidden>
- Date: Tue, 12 Oct 2010 00:07:14 -0700
Without a suffix, a literal with a decimal in it (123.0) will be treated as a double-precision floating-point number. If you assign or pass that to a single-precision variable or parameter, the compiler will (should) issue a warning. Appending f tells the compiler you want the literal to be treated as a single-precision floating-point number.
On Oct 11, 2010, at 23:58:47, Tharindu Madushanka wrote:
> Hi,
>
> I would like to clarify about the usage of .f suffix when using floating
> point numbers related to iPhone. I read .f is to tell the compiler about the
> number is a float at start avoid any casting.
>
> So when we use CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat
> height) I usually see people use without .f.
>
> For example, CGRectMake(0,0,320,460) instead of
> CGRectMake(0.0f,0.0f,320.0f,460.0f)
>
> Is there any minor performance of using either approach. Could someone
> kindly clarify on this.
>
> Thanks and Kind Regards,
>
> Tharindu Madushanka.
> _______________________________________________
>
> 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
_______________________________________________
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