• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Floating Point numbers with .f and without .f Suffix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >[iPhone] Floating Point numbers with .f and without .f Suffix (From: Tharindu Madushanka <email@hidden>)

  • Prev by Date: [iPhone] Floating Point numbers with .f and without .f Suffix
  • Next by Date: Re: [iPhone] Floating Point numbers with .f and without .f Suffix
  • Previous by thread: [iPhone] Floating Point numbers with .f and without .f Suffix
  • Next by thread: Re: [iPhone] Floating Point numbers with .f and without .f Suffix
  • Index(es):
    • Date
    • Thread