• 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: CGFloat and 64 Bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGFloat and 64 Bit


  • Subject: Re: CGFloat and 64 Bit
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 9 Feb 2009 14:08:14 -0500
  • Organization: Rogue Research Inc.

On 2/9/09 12:02 PM, Nick Zitzmann said:

>> I agree with the OP that CGFloat is very annoying in this respect.  My
>> solution has been to use the 'f' suffix for constants.
>
>The problem with that is, if you do a mathematical operation on a
>double using a float (including constants), you will lose a little
>precision, which does not happen when you stick strictly to doubles.
>If losing precision is not important, though, then I guess that's OK.

Agreed.

>That's why I think the two best solutions to this problem are:
>1. Cast double constants to CGFloat
>2. Write all constants as doubles, and build your 32-bit code with the
>-fsingle-precision-constant flag
>
>(2) is my favorite since it's easier and less messy.

I guess (1) is best really, but it's so ugly and annoying.

>> Similarly, there
>> is no CGFloat version of sin() and other math functions.
>
>Yeah, I solved that one by using macros, like this: (typed in Mail but
>should work)
>
>#if CGFLOAT_IS_DOUBLE == 1
>#define MyCGFloatSin(x) sin(x)
>#else
>#define MyCGFloatSin(x) sinf(x)
>#endif

I'm looking forward to going 64 bit-only, but waiting for the tools to
catch up. :)  I know you are too. :)

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: 
 >CGFloat and 64 Bit (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)
 >Re: CGFloat and 64 Bit (From: "Sean McBride" <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: CGFloat and 64 Bit
  • Next by Date: Re: CGFloat and 64 Bit
  • Previous by thread: Re: CGFloat and 64 Bit
  • Next by thread: Re: CGFloat and 64 Bit
  • Index(es):
    • Date
    • Thread