• 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
double cast to unsigned int gets different results on PPC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: double cast to unsigned int gets different results on PPC
      • From: Jeffrey Oleander <email@hidden>
    • Re: double cast to unsigned int gets different results on PPC
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: Hello
  • Next by Date: Re: property-level locking (was Re: Suppressing warning)
  • Previous by thread: Re: Hello
  • Next by thread: Re: double cast to unsigned int gets different results on PPC
  • Index(es):
    • Date
    • Thread