Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-25-2012, 05:05 AM   #1 (permalink)
Is this a peanut, doctor?
 
Join Date: Apr 2011
Location: Copenhagen
Posts: 254
teCma is on a distinguished road
Default Larger int type?

I want to have a data type with stores integer values with more than what the underneath accomplishes
Code:
unsigned long long int
__________________
Check out my apps here!
teCma is offline   Reply With Quote
Old 01-25-2012, 06:35 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by teCma View Post
I want to have a data type with stores integer values with more than what the underneath accomplishes
Code:
unsigned long long int
How many bits long do you need?
RLScott is offline   Reply With Quote
Old 01-25-2012, 01:47 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

use scientific notation if you need very large numbers. otherwise, you are dealing with some kind of design flaw because computers are not meant to manage that many entities.
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 01-25-2012, 02:52 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by teCma View Post
I want to have a data type with stores integer values with more than what the underneath accomplishes
Code:
unsigned long long int
long long gives you every integer from 0 to 2^128.

That's 3.4028E38. 3, followed by THIRTY-EIGHT ZEROS.

Quote:
340,280,000,000,000,000,000,000,000,000,000,000,00 0
That's a really, really huge number. Why do you need such huge integers?

Usually, you use floating point values for very large quantities. It doesn't have as much precision in the integer portion as a long integer, but since it has an exponent, you can scale it very large.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-25-2012, 05:55 PM   #5 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
long long gives you every integer from 0 to 2^128.

That's 3.4028E38. 3, followed by THIRTY-EIGHT ZEROS.


That's a really, really huge number. Why do you need such huge integers?.
I can't speak for teCma, but BigIntegers arbitrarily long are used in RSA-type calculations in public key encryption.
RLScott is offline   Reply With Quote
Old 01-26-2012, 12:45 PM   #6 (permalink)
Registered Member
 
Join Date: Dec 2010
Location: Seattle, WA
Posts: 408
RickSDK is on a distinguished road
Default

on a side note... to me that's a bit overkill. Computers are not as all powerful as people think and dealing with numbers that large is rarely needed.

here's something that very few people know... if you were to plot 100 cities on a map of the united states... do you realize that there is not a computer in the world that could calculate the shortest path that a person could take to hit all 100 cities? its true.

actually computers could eventually find it, but it would take weeks or even months of processing because there are so many trillions of calculations needed to find it.

sorry, this post just reminded me of that fact. And I am just curious to know why the original poster feels he needs numbers that large.
__________________
Check out my apps

RickSDK is offline   Reply With Quote
Old 01-26-2012, 01:04 PM   #7 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by RickSDK View Post
on a side note... to me that's a bit overkill. Computers are not as all powerful as people think and dealing with numbers that large is rarely needed.

here's something that very few people know... if you were to plot 100 cities on a map of the united states... do you realize that there is not a computer in the world that could calculate the shortest path that a person could take to hit all 100 cities? its true.

actually computers could eventually find it, but it would take weeks or even months of processing because there are so many trillions of calculations needed to find it.

sorry, this post just reminded me of that fact. And I am just curious to know why the original poster feels he needs numbers that large.
Sure. The "traveling salesman" problem. A classic in computer science.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 01-30-2012, 04:10 AM   #8 (permalink)
Is this a peanut, doctor?
 
Join Date: Apr 2011
Location: Copenhagen
Posts: 254
teCma is on a distinguished road
Default

Sorry for not replying.

Here it is, my little project:

I've developed an algorithm for calculating primes, and I was planning having the app run for a year or so. Soo, it would end up finding some pretty huge numbers (:
__________________
Check out my apps here!
teCma is offline   Reply With Quote
Old 01-30-2012, 05:33 AM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Quote:
Originally Posted by teCma View Post
Sorry for not replying.

Here it is, my little project:

I've developed an algorithm for calculating primes, and I was planning having the app run for a year or so. Soo, it would end up finding some pretty huge numbers (:
First of all, compute-intensive applications like that are not very suitable for mobile devices. Your desktop computer, whatever it is, would be much more appropriate. Second, really big prime numbers like the ones used in RSA encryption are not found deterministically. They are found probabilistically. Look up "primality testing", especially the Miller-Rabin method, for more info.

Last edited by RLScott; 01-30-2012 at 05:36 AM.
RLScott is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 399
11 members and 388 guests
Atatator, condor304, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, PowerGoofy, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,123
Posts: 402,908
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:52 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0