Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8968481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:27:36+00:00 2026-06-15T17:27:36+00:00

What is the highest int that NSNumber allows? I’ve seen the answer elsewhere on

  • 0

What is the highest int that NSNumber allows? I’ve seen the answer elsewhere on these forums hence why I’m deeply confused here.

int miles = 35000;
vehicle.mileage = [NSNumber numberWithInt:miles];
NSLog(@"int value = %d", miles);
NSLog(@"mileage = %@", vehicle.mileage);

The output is:

int value = 35000
mileage = -30536

I must be missing some terrible easy here, but can someone explain to me why this is not working correctly?

UPDATE:
After looking further, vehicle.mileage is getting set correctly to 35000 but when I display this via NSLog(@”%@”, vehicle.mileage) it is outputting it incorrectly. I have yet to find the “magic” value when this stops working because as of now, it works for values up to ~30,000.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:27:37+00:00Added an answer on June 15, 2026 at 5:27 pm

    NSNumber is just a wrapper so it goes in overflow when the wrapped primitive type goes in overflow.
    So if you use numberWithInt the maximum number allowed is INT_MAX (defined in limits.h), if you use a numberWithFloat the maximum number allowed is FLOAT_MAX, and so on.
    So in this case you aren’t going in overflow, I doubt that INT_MAX would be so low.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the table that I'm working with: CREATE TABLE `index` ( `wid` int(7) unsigned
Here is my table: id int(11) name varchar(255) description text highest_bidder int(11) value varchar(255)
I have the following List<int> collection and I need to find the highest integer
I have a function that returns the highest value of an attribute in an
Can I always assume that if... int main() { ... foo1(); foo2(); foo3(); ...
I have a collections.defaultdict(int) that I'm building to keep count of how many times
Let's say I have a class that looks something like this: class Foo(Prop1:Int, Prop2:Int,
int main() { srand((unsigned)time(0)); int random_integer; int lowest=0, highest=10; int range=(highest-lowest)+1; for(int index=0; index<20;
Possible Duplicate: What is JavaScript's Max Int? What's the highest Integer value a Number
I have program that prints the highest interval every 5 minutes. I have previously

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.