Re: double cast to unsigned int gets different results on PPC
Re: double cast to unsigned int gets different results on PPC
- Subject: Re: double cast to unsigned int gets different results on PPC
- From: Chris Suter <email@hidden>
- Date: Fri, 18 Apr 2008 08:58:18 +1000
On 18/04/2008, at 7:45 AM, David Alter wrote:
I have a double that is assigned a negative value. I get different
results if it is cast to an unsigned int depending on if I'm on PPC
or Intel.
I think you're straying into an area of undefined behaviour. My
interpretation of the C99 standard is that the result is undefined.
To get defined portable behaviour cast to int first:
i.e. intVal = (unsigned)(int)doubleVal;
- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden