• 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: precision problem or my error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: precision problem or my error?


  • Subject: Re: precision problem or my error?
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 7 Apr 2006 22:13:00 +0200

Ivan,

On 7.4.2006, at 21:54, Ivan Kourtev wrote:

and all subsequent values of a[] are negative. I checked and 50 * 43287250 is indeed where the number crosses the 31-bit which would result in a negative number if I were working with 2-byte short int's.

Ahem... a byte is eight bits, two-byte short is therefore 16 bits (giving you range -32768 to 32767), and four-byte int is 32 bits (with the range you are experiencing problems with, namely, -2147483648 to 2147483647).


If you need eight-byte ints of 64 bits with range -9223372036854775808 to 9223372036854775807, use long long (note that long is in fact equivalent to int).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >precision problem or my error? (From: Ivan Kourtev <email@hidden>)

  • Prev by Date: Re: Universal Binaries with 10.2.8 vs 10.4 conditional compiling
  • Next by Date: Re: precision problem or my error?
  • Previous by thread: precision problem or my error?
  • Next by thread: Re: precision problem or my error?
  • Index(es):
    • Date
    • Thread