double cast to unsigned int gets different results on PPC
double cast to unsigned int gets different results on PPC
- Subject: double cast to unsigned int gets different results on PPC
- From: David Alter <email@hidden>
- Date: Thu, 17 Apr 2008 14:45:22 -0700
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. The PPC values look correct.
Here is the code for may test
double val = -1;
printf ( "unsigned long long=%llu \n", (unsigned long long)val );
printf ( "unsigned=%u \n\n", (unsigned int)val );
Here is the results on PPC
unsigned long long=4294967295
unsigned=4294967295
Here is the results on Intel
unsigned long long=18446744073709551615
unsigned=0
Casting into signed numbers works the same on both PPC and Intel.
Any ideas. It sure would be nice it worked the same on both platforms
thanks for the help
-dave
_______________________________________________
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