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

Re: double cast to unsigned int gets different results on PPC


  • Subject: Re: double cast to unsigned int gets different results on PPC
  • From: Marshall Clow <email@hidden>
  • Date: Mon, 21 Apr 2008 12:34:44 -0700

At 8:58 AM +1000 4/18/08, Chris Suter wrote:
At 10:27 AM -0700 4/18/08, David Alter wrote:
I think you're straying into an area of undefined behaviour. My interpretation of the C99 standard is that the result is undefined.

Just a little more info. If I cast into a unsigned long long first then cast into an unsigned int I get the correct result on Intel for unsigned int. Here is the code

David -
To quote Inigo Montoya - "I do not think that word means what you think it means." ;-)


There is no "correct result" for this operation.
That's what "undefined behaviour" is all about.


	double val = -1;
	printf ( "unsigned long long=%llu \n", (unsigned long long)val );
	printf ( "unsigned=%u \n\n", (unsigned int)val );


-- -- Marshall

Marshall Clow     Idio Software   <mailto:email@hidden>

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.
_______________________________________________
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


References: 
 >re: double cast to unsigned int gets different results on PPC (From: George Warner <email@hidden>)
 >Re: double cast to unsigned int gets different results on PPC (From: David Alter <email@hidden>)

  • Prev by Date: Re: G4 867mhz, Leopard, and XCode 3
  • Next by Date: Re: Using STL strings and supporting 10.2.x
  • Previous by thread: Re: double cast to unsigned int gets different results on PPC
  • Next by thread: How to configure Subversion to work with Xcode?
  • Index(es):
    • Date
    • Thread