Re: Float constants
Re: Float constants
- Subject: Re: Float constants
- From: Michael Vannorsdel <email@hidden>
- Date: Wed, 17 Mar 2010 17:25:42 -0600
This is exactly why I do it for the 32bit builds. What I'm trying to avoid in the sections that use doubles is having the constant generate a float load, double store, double load for each constant. I'm still poking through the assembly to see if gcc is indeed doing this but I'm also checking if someone has experience with this and how to avoid causing unnecessary load/store/loads to promote the constants to doubles. For instance if putting an explicit cast like (double)1.2345 will tell gcc to treat it as a double despite the single precision flag.
On Mar 17, 2010, at 4:52 PM, Nick Zitzmann wrote:
> For me, anyway, setting that compiler flag is SOP when building for 32-bit code. A lot of older 32-bit Cocoa code was written under the assumption that it's okay to use double constants in places that expect floats, because under Xcode's default warning set, nothing happens when the code does that. Changing them to float constants is tedious and causes a little (insignificant) precision loss when building for 64-bit, so I just keep them as double constants and use that flag to make them into float constants on 32-bit builds.
>
> Of course, I don't think there is any one true way of tackling this problem...
_______________________________________________
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