Re: Math.h functions with CGFloat
Re: Math.h functions with CGFloat
- Subject: Re: Math.h functions with CGFloat
- From: steven Hooley <email@hidden>
- Date: Tue, 10 Aug 2010 15:12:24 +0100
Yes, sorry - i meant /usr/include/math.h
Because CGFloat is typedef'd to float on 32bit and double on 64bit i
have to swap between, eg, atan and atanf depending on my build
settings. I have a framework which is intended to support 32bit and
64bit.
I thought this may have been a common scenario and some useful macros
might already exist.
Thanks
On 10 August 2010 14:10, lbland <email@hidden> wrote:
> hi-
>
> On Aug 10, 2010, at 8:42 AM, steven Hooley wrote:
>
>> Is there a preferred way to use the Math.h functions with CGFloats
>> that is 32 and 64 bit safe?
>> Do some Macros already exist somewhere?
>>
>> Should i even be using Math.h functions in Cocoa?
>
> What do you mean by Math.h ? Do you mean: math.h (/usr/include/math.h) ?
>
> You can use math.h in Cocoa.
>
> math.h is a C standard and doesn't know about CGFloat (except that CGFloat is typedef to double or float). math.h functions generally take doubles (with implicit promotion of floats), or you can use the float counterpart (such as cos() v.s. cosf() ).
>
> thanks!-
>
> -lance
_______________________________________________
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